- Deploy a server
- Point domain name to server IP address
- Install Dependencies
- Copy/clone source code into server
- Copy
sample.envto.envand edit variables - Bring containers up:
docker-compose up -d - Run certbot (requires .env file and working domain):
docker-compose exec nginx /bin/certbot.sh
- Open crontab:
docker-compose exec nginx crontab -e - At the bottom, add:
@daily sleep $[ ( $RANDOM % 9000 ) + 1 ]s; certbot renew
Ubuntu:
sudo apt-get updatecurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"sudo apt-get updatesudo apt-get install -y docker-cesudo usermod -aG docker $USER- Restart terminal session (logout and back in)
CentOS (AWS Linux AMI):
sudo yum update -ysudo yum install -y dockersudo service docker startsudo usermod -aG docker $USER- Restart terminal session (logout and back in)
Linux:
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
Ubuntu:
sudo apt-get install -y git-core
CentOS (AWS Linux AMI):
sudo yum install -y git
- Add Git submodule:
git submodule add <git project url> - NPM install in all submodules:
git submodule foreach npm install - Update submodules:
git submodule update --remote - Ignore dirty submodule: Add
ignore = dirtyto the submodule config for the specific one. - Restart containers:
docker-compose restart - Rebuild containers:
docker-compose build - Request certificates:
docker-compose exec nginx certbot certonly --webroot -w /var/lib/certbot/ --agree-tos --non-interactive --text -d example.com --email you@example.com - Renew certificates:
docker-compose exec nginx certbot renew - Restart NGINX:
docker-compose exec nginx nginx -s reload - Access terminal:
docker-compose exec nginx /bin/bash