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

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

View File

@ -8,13 +8,16 @@ echo "oshipka is at: $OSHIPKA_PATH"
#!/usr/bin/env bash #!/usr/bin/env bash
HELP=" 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 bootstrap [PROJECT_PATH] Create a new project in PROJECT_PATH
worker Start worker worker Start worker
web Start webapp web Start webapp
venv Init venv venv Init venv
install Install requirements install Install requirements
link Link dev oshipka
cert [DOMAIN] Install certificate
" "
worker () { worker () {
@ -36,6 +39,21 @@ install_reqs() {
pip install -r requirements.txt 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() { bootstrap() {
shift shift
PROJECT_PATH=$1 PROJECT_PATH=$1
@ -68,8 +86,7 @@ bootstrap() {
cp ${OSHIPKA_PATH}/bootstrap/.gitignore ${PROJECT_PATH}/.gitignore cp ${OSHIPKA_PATH}/bootstrap/.gitignore ${PROJECT_PATH}/.gitignore
cd ${PROJECT_PATH} cd ${PROJECT_PATH}
init_venv init_venv
source venv/bin/activate link_dev_oshipka
pip install -e ${OSHIPKA_PATH}
} }
command_main() { command_main() {
@ -85,7 +102,9 @@ command_main() {
;; ;;
install) install_reqs "$@" install) install_reqs "$@"
;; ;;
link) install_reqs "$@" link) link_dev_oshipka "$@"
;;
cert) install_cert "$@"
;; ;;
*) >&2 echo -e "${HELP}" *) >&2 echo -e "${HELP}"
return 1 return 1