Skip to content

Instantly share code, notes, and snippets.

@claylo
Created April 27, 2011 01:08
Show Gist options
  • Save claylo/943532 to your computer and use it in GitHub Desktop.
Save claylo/943532 to your computer and use it in GitHub Desktop.
Perform the steps to get JIRA ready to be proxied and locked down to localhost and using MySQL
# we'll only have IPv4 addresses to look for
sed -i -e 's/standalone=JIRA/standalone=JIRA -Djava.net.preferIPv4Stack=true/' jira/bin/setenv.sh
# block anyone not on localhost IP
sed -i -e '/<Context>/ a\
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\\.0\\.0\\.1" />
' jira/conf/context.xml
# make sure Tomcat knows it's behind a proxy
# UPDATE THIS FOR YOUR ATLASSIAN SUITE SERVER HOSTNAME
sed -i -e 's/<Connector port="8080"/<Connector scheme="https" proxyHost="atlassian.example.com" proxyPort="443" port="8080"/' jira/conf/server.xml
# Go ahead and tell JIRA we want MySQL
# YES, I know there could be more magical sed usage here.
# Keep your eyes on the prize.
sed -i -e 's/driverClassName="org.hsqldb.jdbcDriver"/driverClassName="com.mysql.jdbc.Driver"/' jira/conf/server.xml
sed -i -e 's/url="jdbc:hsqldb[^"]*"/url="jdbc:mysql:\/\/localhost\/jira?useUnicode=true\&amp;characterEncoding=UTF8"/' jira/conf/server.xml
sed -i -e 's/username="sa"/username="jirauser"/' jira/conf/server.xml
sed -i -e 's/password=""/password="some_pass"/' jira/conf/server.xml
sed -i -e '/^ *minEvictableIdleTimeMillis="4000"$/ d' jira/conf/server.xml
sed -i -e '/^ *timeBetweenEvictionRunsMillis="5000"$/ d' jira/conf/server.xml
sed -i -e 's/maxActive="20"/maxActive="20" validationQuery="select 1"/' jira/conf/server.xml
# And make sure the Webapp knows we want MySQL
sed -i -e '/^ schema-name="PUBLIC"/ d' jira/atlassian-jira/WEB-INF/classes/entityengine.xml
sed -i -e 's/datasource name="defaultDS" field-type-name="hsql"/datasource name="defaultDS" field-type-name="mysql"/' jira/atlassian-jira/WEB-INF/classes/entityengine.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment