Rename all .env.example to .env and provide your passwords before running the start app command. If you specify ci environment copy the .env files to a server space. MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD are not predefined and can be freely chosen by the user. SECRET_KEY should be genereted by Django. The GITHUB_ and SERVER_ environment variables are only needed by devops script commands pullserver and sshserver.
Generate self-signed certificates with mkcert for local environment and Let's Encrypt certificates for stage environment.
Set up a local DNS like Dnsmasq (Mac OS) for local environment in order to direct traffic from test domain to localhost.
https://passingcuriosity.com/2013/dnsmasq-dev-osx/
Go to frontend and backend project folders.
docker build --target dev-stage -t alonimacaroni/vote-frontend:local .
docker build --target dev-stage -t alonimacaroni/vote-backend:local .docker build --target prod-stage -t alonimacaroni/vote-frontend:stage .
docker build --target prod-stage -t alonimacaroni/vote-backend:stage .select corresponding LOC parameter:
LOC=stage ./devops.sh setupSet LOC parameter equal to local (default), ci, stage, op or exec.
LOC=stage ./devops.shWait for database connection:
LOC=exec ./devops.sh waitApply migrations.
local:
LOC=exec ./devops.sh exitstage:
LOC=exec ./devops.sh exitstageci:
LOC=exec ./devops.sh exitciAll command options are also available by setting LOC=exec in order to execute commands in running container.
Apply migrations:
LOC=stage ./devops.sh migrateMake migrations:
LOC=stage ./devops.sh makemigReset Database:
LOC=stage ./devops.sh flushRun automated tests:
LOC=stage ./devops.sh testPush code to Github:
LOC=op ./devops.sh pushPull code from Github:
LOC=op ./devops.sh pullSSH to server:
LOC=op ./devops.sh sshserverReset and clean Docker environment:
LOC=op ./devops.sh clean