- Make some changes and push them to github
- Go to AWS by ssh
ssh -i <<path to babybots.cer>> ec2-user@ec2-34-229-136-66.compute-1.amazonaws.com
- Go to project folder
cd babybots
- Now you need to restart the server. Please use commands:
docker-compose down; docker-compose up --build -d
— possible in single line
- Run next commands:
git fetch
git pull
NOTE: Make sure that the branch you push to is the same that you pull from.
All script run logs will be in files:
- run-script.out
- run-script.err
How to get web application logs?
- use docker-compose command:
docker-compose logs -f
Choice or create folder for deploy. Go to the project folder and and download the project from GitHub here:
cd ~/project_folder
git clone https://github.com/Simple2B/babybots.git .
Open a project and create python virtual environment:
cd ~/project_folder
python3 -m virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt
In the project folder need create file .env with next context:
SECRET_KEY=<<secret-key-string>>
ADMIN_USER_NAME=admin
ADMIN_USER_PASS=1234
NOTE: Please put here default admin credentials. Also you need to choose SECRET_KEY.
Execute following lines under virtual environment
flask drob-db
flask create-db
To start docker container:
sudo systemctl enable docker
sudo systemctl start docker
To build and run docker container:
docker-compose up --build -d
After changing in project you need to restart docker:
docker-compose down
docker-compose up --build -d
Crontab run script every minute
crontab -e
Write to file:
* * * * * path to run-script.sh
Read file:
crontab -l
server {
server_name <<your DNS server name>>;
location / {
proxy_pass http://localhost:5000;
}
listen 80;
}