diff --git a/README.md b/README.md index aa347b6..20737c0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ PaaS - creates easily deployable declarative web applications with (moslty) file ## TODO +* [ ] [prod_install] Download sensitive prompt * [ ] [vm_gen] Auto generate dependency graph for `view_models/_process_order` * [ ] [auto_dns] Start and test `auto_dns.service` * [ ] [migrations] ALTER doesn't work with sqlite3 \ No newline at end of file diff --git a/oshipka.sh b/oshipka.sh index ee0a15a..59e2908 100755 --- a/oshipka.sh +++ b/oshipka.sh @@ -12,6 +12,7 @@ Usage $0 [ bootstrap | model | db_migrate | db_upgrade | db_populate | db_recrea bootstrap [PROJECT_PATH] Create a new project in PROJECT_PATH init Install dev env + download_sensitive Download sensitive model Create or update a model from files in webapp/view_models/*.yaml db_migrate DB migration @@ -58,10 +59,21 @@ link_dev_oshipka() { pip install -e ${TWW_PATH} } +download_sensitive() { + if [ ! -f sensitive.py ]; then + echo "File sensitive.py NOT FOUND" + exit 1; + fi +} + init() { init_venv install_reqs link_dev_oshipka + mkdir -p data + db_upgrade + download_sensitive + db_populate } install_cert() { @@ -121,7 +133,11 @@ run_in_prod() { prod_install() { shift - sudo apt install nginx dnsutils + if [ ! -f ${OSHIPKA_PATH}/provision/auto_dns/sensitive.py ]; then + echo "File ${OSHIPKA_PATH}/provision/auto_dns/sensitive.py NOT FOUND" + exit 1; + fi + sudo apt install -y nginx dnsutils source venv/bin/activate PROJECT_NAME=$(basename `pwd`) echo "1/6 Generating service and config files..." @@ -269,6 +285,8 @@ command_main() { ;; init) init "$@" ;; + download_sensitive) download_sensitive "$@" + ;; worker) worker "$@" ;; web) web "$@" diff --git a/provision/prod_mgmt.py b/provision/prod_mgmt.py index 04d0e7c..8b29ca7 100644 --- a/provision/prod_mgmt.py +++ b/provision/prod_mgmt.py @@ -14,6 +14,7 @@ MAX_UPLOAD_SIZE = "10m" oshipka_path = os.environ.get('OSHIPKA_PATH') TEMPLATES_PATH = os.path.join(oshipka_path, "provision", "templates") TMP_PATH = os.path.join(oshipka_path, "provision", "tmp") +os.makedirs(TMP_PATH, exist_ok=True) shutil.rmtree(TMP_PATH) os.makedirs(TMP_PATH, exist_ok=True) env = Environment(