feat: entrypoint basic auth generation
This commit is contained in:
parent
acf824c967
commit
dba79dc23b
6
abra.sh
6
abra.sh
@ -1,6 +1,6 @@
|
|||||||
export ENTRYPOINT_VERSION=v1
|
export APP_ENTRYPOINT_VERSION=v1
|
||||||
export HTPASSWD_CONF_VERSION=v1
|
export BADGER_ENTRYPOINT_VERSION=v1
|
||||||
export NGINX_CONF_VERSION=v1
|
export DEFAULT_CONF_VERSION=v1
|
||||||
export SSH_CONF_VERSION=v1
|
export SSH_CONF_VERSION=v1
|
||||||
export SSH_DEPLOY_KEY_VERSION=v1
|
export SSH_DEPLOY_KEY_VERSION=v1
|
||||||
export WEBHOOKD_SCRIPT_VERSION=v1
|
export WEBHOOKD_SCRIPT_VERSION=v1
|
||||||
|
6
app-entrypoint.sh.tmpl
Normal file
6
app-entrypoint.sh.tmpl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
{{ if eq (env "AUTH_ENABLED") "1" }}
|
||||||
|
apk add --no-cache apache2-utils
|
||||||
|
htpasswd -b -c /etc/nginx/.htpasswd {{ env "AUTH_USERNAME" }} {{ secret "auth_password" }}
|
||||||
|
{{ end }}
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
version: "3"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
@ -7,9 +7,6 @@ services:
|
|||||||
- AUTH_ENABLED
|
- AUTH_ENABLED
|
||||||
- AUTH_USERNAME
|
- AUTH_USERNAME
|
||||||
- DOMAIN
|
- DOMAIN
|
||||||
configs:
|
|
||||||
- source: htpasswd_conf
|
|
||||||
target: /etc/nginx/.htpasswd
|
|
||||||
secrets:
|
secrets:
|
||||||
- auth_password
|
- auth_password
|
||||||
|
|
||||||
@ -17,9 +14,3 @@ secrets:
|
|||||||
auth_password:
|
auth_password:
|
||||||
external: true
|
external: true
|
||||||
name: ${STACK_NAME}_auth_password_${SECRET_AUTH_PASSWORD_VERSION}
|
name: ${STACK_NAME}_auth_password_${SECRET_AUTH_PASSWORD_VERSION}
|
||||||
|
|
||||||
configs:
|
|
||||||
htpasswd_conf:
|
|
||||||
name: ${STACK_NAME}_htpasswd_conf_${HTPASSWD_CONF_VERSION}
|
|
||||||
file: htpasswd.conf.tmpl
|
|
||||||
template_driver: golang
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
version: "3"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
badger:
|
badger:
|
||||||
|
29
compose.yml
29
compose.yml
@ -1,19 +1,22 @@
|
|||||||
---
|
---
|
||||||
version: "3"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: nginx:1.25.3-alpine
|
image: nginx:1.25.3-alpine
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN
|
- DOMAIN
|
||||||
configs:
|
|
||||||
- source: nginx_conf
|
|
||||||
target: /etc/nginx/conf.d/default.conf
|
|
||||||
volumes:
|
volumes:
|
||||||
- nginx-data:/usr/share/nginx/website
|
- nginx-data:/usr/share/nginx/website
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
- internal
|
- internal
|
||||||
|
configs:
|
||||||
|
- source: app_entrypoint
|
||||||
|
target: /docker-entrypoint.d/666-app-entrypoint.sh
|
||||||
|
mode: 0555
|
||||||
|
- source: default_conf
|
||||||
|
target: /etc/nginx/templates/default.conf.template
|
||||||
deploy:
|
deploy:
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
@ -39,7 +42,7 @@ services:
|
|||||||
- source: webhookd_script
|
- source: webhookd_script
|
||||||
target: /root/scripts/deploy.sh
|
target: /root/scripts/deploy.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
- source: entrypoint
|
- source: badger_entrypoint
|
||||||
target: /entrypoint.sh
|
target: /entrypoint.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
volumes:
|
volumes:
|
||||||
@ -58,11 +61,15 @@ configs:
|
|||||||
name: ${STACK_NAME}_webhookd_script_${WEBHOOKD_SCRIPT_VERSION}
|
name: ${STACK_NAME}_webhookd_script_${WEBHOOKD_SCRIPT_VERSION}
|
||||||
file: deploy.sh.tmpl
|
file: deploy.sh.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
||||||
nginx_conf:
|
default_conf:
|
||||||
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
|
name: ${STACK_NAME}_default_conf_${DEFAULT_CONF_VERSION}
|
||||||
file: nginx.conf.tmpl
|
file: default.conf.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
||||||
entrypoint:
|
app_entrypoint:
|
||||||
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
|
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
|
||||||
file: entrypoint.sh.tmpl
|
file: app-entrypoint.sh.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
badger_entrypoint:
|
||||||
|
name: ${STACK_NAME}_badger_entrypoint_${BADGER_ENTRYPOINT_VERSION}
|
||||||
|
file: badger-entrypoint.sh.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{{ env "AUTH_USERNAME" }}:{{ secret "auth_password" }}
|
|
Loading…
x
Reference in New Issue
Block a user