cert command

This commit is contained in:
Daniel Tsvetkov 2020-04-15 21:13:28 +02:00
parent 882cfb2a98
commit 9ecab37cc0
2 changed files with 25 additions and 5 deletions

View File

@ -2,4 +2,5 @@
venv
*.pyc
data/
__pycache__
__pycache__
sensitive.py

View File

@ -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