diff --git a/bootstrap/.gitignore b/bootstrap/.gitignore index 4b47bbc..71e8dbc 100644 --- a/bootstrap/.gitignore +++ b/bootstrap/.gitignore @@ -2,4 +2,5 @@ venv *.pyc data/ -__pycache__ \ No newline at end of file +__pycache__ +sensitive.py \ No newline at end of file diff --git a/oshipka.sh b/oshipka.sh index e28a468..75b4329 100755 --- a/oshipka.sh +++ b/oshipka.sh @@ -8,13 +8,16 @@ echo "oshipka is at: $OSHIPKA_PATH" #!/usr/bin/env bash HELP=" -Usage $0 [ bootstrap | worker | web | venv | install ] +Usage $0 [ bootstrap | worker | web | venv | install | link | cert ] bootstrap [PROJECT_PATH] Create a new project in PROJECT_PATH worker Start worker web Start webapp venv Init venv install Install requirements + link Link dev oshipka + + cert [DOMAIN] Install certificate " worker () { @@ -36,6 +39,21 @@ install_reqs() { pip install -r requirements.txt } +link_dev_oshipka() { + source venv/bin/activate + pip install -e ${OSHIPKA_PATH} +} + +install_cert() { + #[ ! -f /tmp/certbot-auto ] && wget -O /tmp/certbot-auto https://dl.eff.org/certbot-auto +#chmod +x /tmp/certbot-auto +#certbot=/tmp/certbot-auto + shift + PROJECT_DOMAIN=$1 + sudo apt install certbot + certbot certonly --authenticator standalone --installer nginx --pre-hook "service nginx stop" --post-hook "service nginx start" --redirect --agree-tos --no-eff-email --email admin@app.com -d ${PROJECT_DOMAIN} --no-bootstrap +} + bootstrap() { shift PROJECT_PATH=$1 @@ -68,8 +86,7 @@ bootstrap() { cp ${OSHIPKA_PATH}/bootstrap/.gitignore ${PROJECT_PATH}/.gitignore cd ${PROJECT_PATH} init_venv - source venv/bin/activate - pip install -e ${OSHIPKA_PATH} + link_dev_oshipka } command_main() { @@ -85,7 +102,9 @@ command_main() { ;; install) install_reqs "$@" ;; - link) install_reqs "$@" + link) link_dev_oshipka "$@" + ;; + cert) install_cert "$@" ;; *) >&2 echo -e "${HELP}" return 1