Readme edit

This commit is contained in:
Matej Maťkuliak 2021-04-04 23:07:05 +02:00
parent 11a4c2c01e
commit 0e63f93d85
6 changed files with 83 additions and 8 deletions

9
z1/.env Normal file
View File

@ -0,0 +1,9 @@
# Add Environment Variables
DEBUG=False
SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
DB_NAME=postgres
DB_USER=postgres
DB_PASS=postgres
DB_SERVICE=postgres
DB_PORT=5432

View File

@ -1,11 +1,23 @@
## Dockerizing Flask With Compose and Machine - From Localhost to the Cloud Jednoducha message web aplikacia pouzivajuca Flask, Nginx a Postgres.
Featuring: Nalsedoval som navod: https://realpython.com/dockerizing-flask-with-compose-and-machine-from-localhost-to-the-cloud/
- Docker v18.09.2 Aplikaciu spustime skriptom "start-app".
- Docker Compose v1.23.2
- Docker Machine v0.16.1
**Check out the awesome blog post here > https://realpython.com/blog/python/dockerizing-flask-with-compose-and-machine-from-localhost-to-the-cloud/** Aplikaciu zastavime skriptom "stop-app"
Tento skript pouziva "docker stop", teda spravy poslane do aplikacie ktore sa ulozili do databazy budu dostupne aj po opatovnom spusteni aplikacie. Databaza teda bezi v perzistentom containeri.
Cheers! Aplikaciu zastavime a kompletne odstranime skriptom "stop-and-remove-app".
Sucasti:
Postgres databaza
Bezi na porte 5432
Buildnuta z oficialneho PostgreSQL imagu
Nginx sluzba
Bezi na porte 80
Pouzivana ako reverse proxy, presmerovanie trafiky bud do Flask aplikacie, alebo do statickych suborov
Flask aplikacia
Bezi na exposnutom porte 8000

28
z1/start-app.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#tento script pripravi a spusti vsetko, po jeho ukonceni je aplikacia beziaca a funkcna
echo "Starting setup"
docker-machine create -d virtualbox dev;
docker-compose up --build -d
docker-compose run web /usr/local/bin/python create_db.py
echo "Setup and install finished"
echo "Looking for web app IP"
echo "-"
echo "--"
echo "---"
echo "----"
echo "-----"
echo "------"
echo "-------"
echo "--------"
echo "---------"
echo "----------"
echo "-----------"
echo "------------"
echo "Go to port 8000 of this address:"
docker inspect z1_web_1 | grep "IPAddress"

13
z1/stop-and-remove-app.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#tento script zastavi beziace containery a vymaze ich
docker stop z1_nginx_1 && docker rm -f z1_nginx_1
echo "Nginx odstraneny"
docker stop z1_web_1 && docker rm -f z1_web_1
echo "Web odstraneny"
docker stop z1_postgres_1 && docker rm -f z1_postgres_1
echo "Postgres odstraneny"
echo "------------"
echo "Aplikacia zastavena a prostredie vycistene "

13
z1/stop-app.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#tento script zastavi beziace containery ALE nevymaze ich
docker stop z1_nginx_1
echo "Nginx zastaveny"
docker stop z1_web_1
echo "Web zastaveny"
docker stop z1_postgres_1
echo "Postgres zastaveny"
echo "------------"
echo "Aplikacia zastavena"

View File

@ -6,4 +6,4 @@ SQLAlchemy==1.3.1
Werkzeug==0.15.1 Werkzeug==0.15.1
gunicorn==19.9.0 gunicorn==19.9.0
itsdangerous==1.1.0 itsdangerous==1.1.0
psycopg2==2.7.7 psycopg2==2.7.7