Skip to content

Instantly share code, notes, and snippets.

@phui

phui/setup.sh

Last active Jun 21, 2019
Embed
What would you like to do?
BS server setup gist
#!/bin/bash
### ==== setting up docker ====
# clean any existing docker packages
sudo apt-get remove docker docker-engine docker.io containerd runc
# update repo list and dependencies
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common \
supervisor
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
# install most updated stable version
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# add default user into docker group
sudo usermod -aG docker ubuntu
# restart docker service to reflect the user change
sudo service docker restart
### ==== setting up reverse proxy ====
# install nginx
sudo apt-get install -y nginx
# write setting for reverse proxy
sudo echo "server {
listen 80;
server_name localhost:5000;
location / {
proxy_pass http://localhost:5000;
}
gzip on;
gzip_types text/plain application/javascript application/x-javascript application/json text/javascript text/xml text/css;
gzip_proxied no-cache no-store private expired auth;
}" | sudo tee /etc/nginx/sites-available/default
# restart nginx service to reflect change in setting
sudo service nginx restart
# start docker at startup
sudo echo '[supervisord]
nodaemon=true
logfile=/home/ubuntu/supervisord.log
logfile_maxbytes=10485760
logfile_backups=2
redirect_stderr=true
[program:docker]
environment=USER="ubuntu"
command=/usr/bin/docker run -i -p 5432:5432 -p 5000:5000 -p 9001:9001 -v rpdata:/root/bev -v pgdata:/var/lib/postgresql/data bev
stdout_logfile=/home/ubuntu/docker.log
stdout_logfile_maxbytes=10485760
stdout_logfile_backups=2
redirect_stderr=true
priority=100
' | sudo tee /etc/supervisor/conf.d/supervisord.conf
sudo chmod a+x /etc/supervisor/conf.d/supervisord.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.