From cc76955a08017a5b2f0e82896ba00f73d83e1ba1 Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Mon, 29 Jun 2020 11:00:34 +0200 Subject: [PATCH] app bootstrap transfer (+tranlations) --- oshipka.sh | 34 +++++++ provision/provision_app/app.py | 24 +++++ .../provision_app/templates/bootstrap.html | 98 +++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 provision/provision_app/app.py create mode 100644 provision/provision_app/templates/bootstrap.html diff --git a/oshipka.sh b/oshipka.sh index 61edf0d..24f13db 100755 --- a/oshipka.sh +++ b/oshipka.sh @@ -21,6 +21,8 @@ Usage $0 [ bootstrap | model | db_migrate | db_upgrade | db_populate | db_recrea db_recreate Delete the database, recreate to latest migration and populate db_purge_recreate Same as db_recreate but also purge the migrations + translate Translations subcommand + worker Start worker web Start webapp @@ -33,6 +35,36 @@ Usage $0 [ bootstrap | model | db_migrate | db_upgrade | db_populate | db_recrea cert [DOMAIN] Install certificate " +#!/usr/bin/env bash + +HELP_TRANSLATION=" +USAGE ./manage.sh translate [extract|gen {lang}|compile|update] + + extract Extract strings in files as defined in translations/babel.cfg + gen {lang} Init translations for {lang} + compile Compile all translations + update Use after a new extract - it may mark strings as fuzzy. +" + +command_translate() { + TRANSLATE_COMMAND=$1 + shift + case "$TRANSLATE_COMMAND" in + extract) pybabel extract -F translations/babel.cfg -o translations/messages.pot . + ;; + gen) pybabel init -i translations/messages.pot -d translations -l "$@" + ;; + compile) pybabel compile -d translations + ;; + update) pybabel update -i translations/messages.pot -d translations + ;; + *) >&2 echo -e "${HELP_TRANSLATION}" + ;; + esac + return $? +} + + worker () { source venv/bin/activate python worker.py @@ -287,6 +319,8 @@ command_main() { ;; db_purge_recreate) db_purge_recreate "$@" ;; + translate) command_translate "$@" + ;; init) init "$@" ;; download_sensitive) download_sensitive "$@" diff --git a/provision/provision_app/app.py b/provision/provision_app/app.py new file mode 100644 index 0000000..78e6982 --- /dev/null +++ b/provision/provision_app/app.py @@ -0,0 +1,24 @@ +import json + +from flask import Flask, render_template, request, jsonify + +app = Flask(__name__) + + +@app.route('/') +def home(): + return render_template("bootstrap.html") + + +@app.route('/config', methods=["post"]) +def post_config(): + config = json.loads(request.form) + + return jsonify( + { + "raw": config, + }) + + +if __name__ == "__main__": + app.run(debug=True, port=4999) diff --git a/provision/provision_app/templates/bootstrap.html b/provision/provision_app/templates/bootstrap.html new file mode 100644 index 0000000..6ccbb9c --- /dev/null +++ b/provision/provision_app/templates/bootstrap.html @@ -0,0 +1,98 @@ +

New project

+
+

Project name: +

Project path: +

Development

+ + Local machine
+ This will install all required system packages on your local machine and all python packages in a virtual environment +

+ + Docker containers
+ This will install docker on your local machine and start containers for development +

+ + Using Vagrant + Virtualbox
+ This will create a virtual machine on your machine +

+ +

Production environment

+ + Using systemd services + nginx
+ This will create systemd services and nginx as reverse proxy +

+ + Docker containers
+ This will create docker containers for all services +

+ + Using Kubernetes
+ This will create pods, deployments and other k8s objects for your services +
+ + SSL for development
+ +

Components

+

Back end

+
+ +
+ Database | type +
+ Authentication
+ Workers and Queue | type +
+ Scheduling | type: celery beat
+ Search +
+ Translations
+ Limiter
+ Caching
+

Management

+ Debugtoolbar for development
+ Database managemt | type: pgadmin
+ Workers managemt | type: flower
+ Queue managemt | type: rabbitmq-mgmt
+ Admin webapp
+ Monitoring | type: monit
+ Error tracking | type: sentry
+
+

Front end

+

JS: + Jquery
+ Chosen
+ Datatables
+ Fuse (front-end search)
+ Draggable
+ Lightbox
+ Autocomplete JS
+ Backbone JS
+ CRUDy
+

CSS: +
+ Font Awesome
+ Websockets
+


+ Gravatar Enabled
+
+ +

+