vim trading_sample/settings/production.py
docker image build --rm -t python:django ./src
docker image build --rm -t nginx:django ./nginx
echo "<--username-->" | sudo docker secret create pg_username -
echo "<--password-->" | sudo docker secret create pg_password -
docker config create nginx nginx/nginx.conf
docker config create my_nginx nginx/my_nginx.conf
docker run --rm \
-p 443:443 -p 80:80 --name letsencrypt \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
certbot/certbot certonly -n \
-m "YOUR_EMAIL" \
-d example.com \
--standalone --agree-tos
docker stack deploy -c docker-compose.yml django
docker container exec -it <--django container--> bash
python manage.py migrate
python manage.py collectstatic
python manage.py createsuperuser
docker run --rm --name letsencrypt \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-v "/usr/share/nginx/html:/usr/share/nginx/html" \
certbot/certbot:latest \
renew --quiet
check address already in use or not
netstat -pna | grep $THE_PORT
check service errors
docker service ps --no-trunc <--service name-->
- split compose files
- Django settings via Docker secrets