This commit is contained in:
Daniel afx 2022-02-04 20:27:38 +02:00
commit 61d9c4bee1
6 changed files with 34 additions and 16 deletions

View file

@ -8,7 +8,7 @@ Uses the default Flask development server.
1. Build the images and run the containers: 1. Build the images and run the containers:
```sh ```sh
$ docker-compose up -d --build $ docker-compose -f docker-compose.dev.yml up -d --build
``` ```
Test it out at [http://localhost:5000](http://localhost:5000). The "web" folder is mounted into the container and your code changes apply automatically. Test it out at [http://localhost:5000](http://localhost:5000). The "web" folder is mounted into the container and your code changes apply automatically.
@ -18,10 +18,11 @@ Uses the default Flask development server.
Uses gunicorn + nginx. Uses gunicorn + nginx.
1. Rename *.env.prod-sample* to *.env.prod* and *.env.prod.db-sample* to *.env.prod.db*. Update the environment variables. 1. Rename *.env.prod-sample* to *.env.prod* and *.env.prod.db-sample* to *.env.prod.db*. Update the environment variables.
1. Build the images and run the containers: 2. run osmtile with import script
2. Build the images and run the containers:
```sh ```sh
$ docker-compose -f docker-compose.prod.yml up -d --build $ docker-compose up -d --build
``` ```
Test it out at [http://localhost:1337](http://localhost:1337). No mounted folders. To apply changes, the image must be re-built. Test it out at [http://localhost:1337](http://localhost:1337). No mounted folders. To apply changes, the image must be re-built.

View file

@ -11,6 +11,8 @@ services:
- "./lb:/usr/local/etc/haproxy" - "./lb:/usr/local/etc/haproxy"
depends_on: depends_on:
- "certbot" - "certbot"
- "flask"
- "osmtile"
restart: always restart: always
networks: networks:
- internal - internal
@ -59,7 +61,7 @@ services:
- "DOWNLOAD_PBF=https://download.geofabrik.de/europe/bulgaria-latest.osm.pbf" - "DOWNLOAD_PBF=https://download.geofabrik.de/europe/bulgaria-latest.osm.pbf"
- "DOWNLOAD_POLY=https://download.geofabrik.de/europe/bulgaria.poly" - "DOWNLOAD_POLY=https://download.geofabrik.de/europe/bulgaria.poly"
volumes: volumes:
- "./data/osmtile/pgdata:/var/lib/postgresql/data/" - "./data/osmtile/pgdata:/var/lib/postgresql/12/main"
networks: networks:
- internal - internal
#entrypoint: "/run.sh import" #entrypoint: "/run.sh import"

View file

@ -31,7 +31,10 @@ sys.stderr.flush()
app = Flask(__name__) app = Flask(__name__)
app.config.from_object("forest.config.Config") app.config.from_object("forest.config.Config")
<<<<<<< HEAD
=======
>>>>>>> 830f996d6068222f74a4460d104568313b8d4434
db = SQLAlchemy(app) db = SQLAlchemy(app)
#db = SQLAlchemy(session_options = { "autoflush": False }) #db = SQLAlchemy(session_options = { "autoflush": False })
db.init_app(app) db.init_app(app)

View file

@ -1,18 +1,16 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import subprocess, shlex
from forest import app, db, User
from flask.cli import FlaskGroup from flask.cli import FlaskGroup
from forest import app, db, User
from flask_migrate import Migrate from flask_migrate import Migrate
from flask_migrate import MigrateCommand
cli = FlaskGroup(app) cli = FlaskGroup(app)
migrate = Migrate(app, db)
cli.add_command('db', MigrateCommand)
migrate = Migrate()
migrate.init_app(app, db)
@cli.command("create_db") @cli.command("create_db")
def create_db(): def create_db():

View file

@ -1,4 +1,18 @@
Flask==1.1.2 gunicorn
Flask-SQLAlchemy==2.5.1 psycopg2-binary
gunicorn==20.1.0 alembic
psycopg2-binary==2.8.6 Babel
Flask
Flask-SQLAlchemy
Flask-Admin
Flask-Babel
Flask-Bootstrap
Flask-Login
Flask-Mail
Flask-Migrate
Flask-Moment
Flask-Uploads
Flask-WTF
Jinja2
PyQRCode
WTForms

View file

@ -59,7 +59,7 @@ frontend https
use_backend %[req.hdr(Host),lower] use_backend %[req.hdr(Host),lower]
backend map.forest.deflax.net backend map.deflax.net
# Get from cache / put in cache # Get from cache / put in cache
http-request cache-use mapscache http-request cache-use mapscache
http-response cache-store mapscache http-response cache-store mapscache
@ -70,7 +70,7 @@ backend forest.deflax.net
# server list # server list
server s1 flask:5000 check server s1 flask:5000 check
#backend swagger.deflax.net #backend docs.deflax.net
# # server list # # server list
# server s1 swagger:80 check # server s1 swagger:80 check