Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 7 additions & 2 deletions cafebabel/core/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
12 changes: 12 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.