Verified Commit a3592b73 authored by David Haynes's avatar David Haynes 🙆

Migrate back to docker-compose for local dev

- clean and rename the startup script
parent 6520581f
This diff is collapsed.
version: "3"
services:
db:
image: mysql
deploy:
replicas: 1
restart_policy:
condition: on-failure
networks:
- go
ports:
- "3306:3306"
environment:
......@@ -18,15 +13,9 @@ services:
web:
image: go_web
deploy:
replicas: 1
restart_policy:
condition: on-failure
networks:
- go
ports:
- '8000:8000'
command: ./startup.sh
command: ./docker-startup.sh
volumes:
- .:/go
depends_on:
......@@ -47,6 +36,3 @@ services:
- GO_EMAIL_FROM=
- GO_EMAIL_TO=
- SUPERUSER=dhaynes3
networks:
go:
#! /bin/bash
until nc -z db 3306; do
echo "waiting for database to start..."
sleep 1
done
export GO_SECRET_KEY
export GO_CREATE_SUPERUSER
GO_SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
GO_CREATE_SUPERUSER="from django.contrib.auth import get_user_model; User = get_user_model(); me = User.objects.get(username='$SUPERUSER'); me.first_name = 'David'; me.last_name = 'Haynes'; me.save(); "
python go/manage.py makemigrations
python go/manage.py makemigrations go
python go/manage.py migrate
python go/manage.py createsuperuser --noinput --username=$SUPERUSER --email=$SUPERUSER$GO_EMAIL_DOMAIN
echo "from django.contrib.auth import get_user_model; User = get_user_model(); me = User.objects.get(username='$SUPERUSER'); me.first_name = 'David'; me.last_name = 'Haynes'; me.save(); " | python go/manage.py shell
python go/manage.py createsuperuser --noinput --username="$SUPERUSER" --email="$SUPERUSER$GO_EMAIL_DOMAIN"
echo "$GO_CREATE_SUPERUSER" | python go/manage.py shell
python go/manage.py runserver 0.0.0.0:8000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment