Compare commits
No commits in common. "98936a066b47220bfbe102e19068e2f84330838a" and "4e7d8bc743ed7b998401a4064e67dfd82e3abf49" have entirely different histories.
98936a066b
...
4e7d8bc743
4 changed files with 6 additions and 62 deletions
|
@ -1,8 +1,7 @@
|
||||||
1. Rename *dist.env* to *.env*. Update the environment variables.
|
1. Rename *dist.env* to *.env*. Update the environment variables.
|
||||||
2. run osmtile with import script
|
2. run osmtile with import script
|
||||||
3. Build the images and run the containers:
|
2. Build the images and run the containers:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ docker-compose up -d --build --remove-orphans ; docker-compose logs -f --timestamps
|
$ docker-compose up -d --build --remove-orphans ; docker-compose logs -f --timestamps
|
||||||
```
|
```
|
||||||
4. Seed db
|
|
||||||
|
|
8
dist.env
8
dist.env
|
@ -10,11 +10,11 @@ DATABASE_URL=postgresql://forest:forest123@db:5432/forest_prod
|
||||||
POSTGRES_USER=forest
|
POSTGRES_USER=forest
|
||||||
POSTGRES_PASSWORD=forest123
|
POSTGRES_PASSWORD=forest123
|
||||||
POSTGRES_DB=forest_prod
|
POSTGRES_DB=forest_prod
|
||||||
|
PGADMIN_DEFAULT_EMAIL=daniel@deflax.net
|
||||||
|
PGADMIN_DEFAULT_PASSWORD=
|
||||||
|
PGADMIN_CONFIG_SERVER_MODE=False
|
||||||
|
|
||||||
PGADMIN_DEFAULT_EMAIL=mail@example.com
|
MAIL_ADMIN=daniel@deflax.net
|
||||||
PGADMIN_DEFAULT_PASSWORD=hackme
|
|
||||||
|
|
||||||
MAIL_ADMIN=mail@example.com
|
|
||||||
MAIL_SUBJECT_PREFIX=ForestNet
|
MAIL_SUBJECT_PREFIX=ForestNet
|
||||||
MAIL_SERVER=smtp.gmail.com
|
MAIL_SERVER=smtp.gmail.com
|
||||||
MAIL_USERNAME=admin@gmail.com
|
MAIL_USERNAME=admin@gmail.com
|
||||||
|
|
|
@ -20,7 +20,7 @@ from flask_mail import Mail
|
||||||
from flask_wtf.csrf import CSRFProtect, CSRFError
|
from flask_wtf.csrf import CSRFProtect, CSRFError
|
||||||
from flask_moment import Moment
|
from flask_moment import Moment
|
||||||
|
|
||||||
from models import db, lm
|
from models import lm
|
||||||
|
|
||||||
sys.stderr.write("worker uid={} gid={}".format(os.getuid(), os.getgid()))
|
sys.stderr.write("worker uid={} gid={}".format(os.getuid(), os.getgid()))
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
@ -28,7 +28,6 @@ sys.stderr.flush()
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object("config.Config")
|
app.config.from_object("config.Config")
|
||||||
|
|
||||||
db.init_app(app)
|
|
||||||
lm.init_app(app)
|
lm.init_app(app)
|
||||||
|
|
||||||
mail = Mail()
|
mail = Mail()
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from flask.cli import FlaskGroup
|
|
||||||
from forest import app, db
|
|
||||||
from forest.models import User
|
|
||||||
|
|
||||||
from flask_migrate import Migrate
|
|
||||||
|
|
||||||
cli = FlaskGroup(app)
|
|
||||||
|
|
||||||
migrate = Migrate()
|
|
||||||
migrate.init_app(app, db)
|
|
||||||
|
|
||||||
@cli.command("create_db")
|
|
||||||
def create_db():
|
|
||||||
db.drop_all()
|
|
||||||
db.create_all()
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command("seed_db")
|
|
||||||
def seed_db():
|
|
||||||
db.session.add(User(email="daniel@deflax.net"))
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command("upgrade_db")
|
|
||||||
def upgrade_db():
|
|
||||||
"""Run deployment tasks."""
|
|
||||||
from flask_migrate import upgrade
|
|
||||||
from app.models import Role, User
|
|
||||||
|
|
||||||
# migrate database to latest revision
|
|
||||||
upgrade()
|
|
||||||
|
|
||||||
# create user roles
|
|
||||||
Role.insert_roles()
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command("restore_db")
|
|
||||||
def restore_db(restore_file):
|
|
||||||
""" recreate db from grid export with python3 manage.py restore /path/grid.tar.bz2 """
|
|
||||||
print(str(restore_file))
|
|
||||||
#TODO
|
|
||||||
from app.models import User
|
|
||||||
db.session.add(User(email=str(user), password=str(password), confirmed=True, confirmed_on=datetime.datetime.now()))
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
cli()
|
|
||||||
|
|
Loading…
Reference in a new issue