diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4c76851 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +goto_src=cd ~/src && source ~/venv/bin/activate + +help: + @echo "Make tasks for deployment. Checkout the makefile content." + +deploy: + @echo "> Fetching master branch and updating sources." + ssh cafebabel "${goto_src} && git fetch origin master && git checkout master && git reset --hard FETCH_HEAD" + ssh cafebabel "${goto_src} && pip install -r requirements.txt" + ssh cafebabel "${goto_src} && python app.py 0.0.0.0:5000 &" + +install: + @echo "> Installing sources, dependencies and database." + ssh cafebabel "git clone https://github.com/cafebabel/cafebabel.com.git ~/src" + ssh cafebabel "python3.6 -m venv ~/venv" + ssh cafebabel "${goto_src} && pip install -r requirements.txt" + ssh cafebabel "${goto_src} && FLASK_APP=app.py flask initdb" diff --git a/cafebabel/core/__init__.py b/cafebabel/core/__init__.py index 585ce1d..4842f02 100644 --- a/cafebabel/core/__init__.py +++ b/cafebabel/core/__init__.py @@ -1,7 +1,6 @@ from pathlib import Path from flask import Flask -from flask_debugtoolbar import DebugToolbarExtension from flask_peewee.db import Database from flask_mail import Mail @@ -13,4 +12,10 @@ db = Database(app) mail = Mail(app) -toolbar = DebugToolbarExtension(app) + +# Dev specific packages +try: + from flask_debugtoolbar import DebugToolbarExtension + toolbar = DebugToolbarExtension(app) +except ModuleNotFoundError: + pass diff --git a/readme.md b/readme.md index 2a61237..dcbc150 100644 --- a/readme.md +++ b/readme.md @@ -35,8 +35,20 @@ re-initializing the database. flask run ``` + ## Running a dummy mail server ``` sudo python -m smtpd -n -c DebuggingServer localhost:25 ``` + + +## Production installation + +In order to deploy to the staging server, you should have an SSH access +to the server with the _cafebabel_ user callable via the command `ssh cafebabel`. + +Your server must have python3.6 installed. + +Installation can be processed with `make install`. +Deploying will run through `make deploy`.