#!/bin/bash

# install git, docker
sudo yum install git -y
sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y 
sudo systemctl start docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose


# download project code
git clone https://github.com/lazydragon/sample_django_app.git 

# customize settings
TODO

# create django database
mysql -h <host> -P 4000 -u root -e "create database django;"

# build project
cd sample_django_app
docker-compose build
docker-compose up -d
docker-compose run web python manage.py migrate
docker-compose run web python manage.py createsuperuser --username=admin --email=''
