diff options
author | 2018-03-25 20:33:25 +0200 | |
---|---|---|
committer | 2018-03-25 19:33:25 +0100 | |
commit | cdc5d4fec9408563595beeb0c9019e31ee3b1398 (patch) | |
tree | 563cf7caeecd98e0a36e788aa8d1326ece9c0a6d | |
parent | Made .travis.yml a bit more consistent (#44) (diff) |
Docker compose (#40)
* adds docker-compose file
* cleanup
* adds template auto reload to vagrant box
* Update index.html
-rw-r--r-- | Vagrant_bootstrap.sh | 11 | ||||
-rw-r--r-- | app.py | 6 | ||||
-rw-r--r-- | docker-compose.yml | 51 | ||||
-rw-r--r-- | templates/main/index.html | 2 |
4 files changed, 69 insertions, 1 deletions
diff --git a/Vagrant_bootstrap.sh b/Vagrant_bootstrap.sh index 32e779f5..97be3c71 100644 --- a/Vagrant_bootstrap.sh +++ b/Vagrant_bootstrap.sh @@ -69,7 +69,18 @@ export RETHINKDB_PORT="28016" export RETHINKDB_DATABASE="database" export RETHINKDB_TABLE="table" export BOT_API_KEY="abcdefghijklmnopqrstuvwxyz" +export TEMPLATES_AUTO_RELOAD="yes" alias python=python3.6 EOF + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" +apt-get update +apt-get install -y docker-ce + +curl -L https://github.com/docker/compose/releases/download/1.20.0-rc1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose + + echo 'docs: https://github.com/discord-python/site/wiki/Development-Environment-(Vagrant)' @@ -1,9 +1,15 @@ # coding=utf-8 +from os import environ + from pysite.route_manager import RouteManager manager = RouteManager() app = manager.app +debug = environ.get('TEMPLATES_AUTO_RELOAD', "no") +if debug == "yes": + app.jinja_env.auto_reload = True + if __name__ == '__main__': manager.run() diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..f0e92b9e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3' +services: + pdrdb: + hostname: "pdrdb" + image: inveracity/pdrdb-base:latest + volumes: + - "rdb:/data" + ports: + - "28016:28016" + - "28011:28011" + expose: + - "28016" + - "28011" + entrypoint: su-exec daemon:daemon rethinkdb -n pdrdb -d /data --bind 0.0.0.0 --server-tag default --http-port 28011 --driver-port 28016 + networks: + - pdnet + + pdweb: + depends_on: + - pdrdb + hostname: "pdweb" + image: inveracity/pdweb-base:latest + working_dir: "/site" + volumes: + - ".:/site" + ports: + - "80:80" + expose: + - "80" + entrypoint: /sbin/tini -- gunicorn -w 1 -b 0.0.0.0:80 --log-level info -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker --reload --max-requests 1 app:app + environment: + LOG_LEVEL: DEBUG + SERVER_NAME: "pysite.local" + WEBPAGE_PORT: "80" + WEBPAGE_SECRET_KEY: "123456789abcdefghijklmn" + RETHINKDB_HOST: "pdrdb" + RETHINKDB_PORT: "28016" + RETHINKDB_DATABASE: "database" + RETHINKDB_TABLE: "table" + BOT_API_KEY: "abcdefghijklmnopqrstuvwxyz" + TEMPLATES_AUTO_RELOAD: "yes" + + networks: + - pdnet + +volumes: + rdb: + web: + +networks: + pdnet: diff --git a/templates/main/index.html b/templates/main/index.html index 7e4c5e8f..b4796dd4 100644 --- a/templates/main/index.html +++ b/templates/main/index.html @@ -32,4 +32,4 @@ </div> </div> -{% endblock %}
\ No newline at end of file +{% endblock %} |