Skip to content

Instantly share code, notes, and snippets.

@orb
Last active December 4, 2015 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orb/b09f6258b64c48d24c12 to your computer and use it in GitHub Desktop.
Save orb/b09f6258b64c48d24c12 to your computer and use it in GitHub Desktop.
deploy tomcat digital ocean
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
apt-get update
apt-get install -y tmux emacs24-nox openjdk-7-jdk tomcat7 tomcat7-admin libhsqldb-java nginx haveged
cat > /etc/nginx/sites-available/myapp <<EOF
upstream myapp {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name localhost;
location / {
client_max_body_size 100M;
proxy_pass http://myapp;
proxy_read_timeout 180;
}
}
EOF
ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/myapp
rm /etc/nginx/sites-enabled/default
nginx -s reload
cat > /etc/tomcat7/tomcat-users.xml <<EOF
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-gui"/>
<user username="admin" password="s3cret" roles="manager-gui"/>
</tomcat-users>
EOF
service tomcat7 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment