remove init script in favor of an abra.sh function, add liberaforms container to proxy and update readme.
This commit is contained in:
		| @ -17,7 +17,7 @@ DEFAULT_TIMEZONE="America/New_York" | ||||
| ENABLE_RSS_FEED=True | ||||
|  | ||||
| ENABLE_PROMETHEUS_METRICS=False | ||||
| #GUNICORN_WORKERS= # Advanced option based on the specs of your server, defaults to 6 | ||||
| #GUNICORN_WORKERS= # Advanced option based on the specs of your server, defaults to 3 | ||||
|  | ||||
| #ALERT_MAILS = ["your_email_address", "another_email_address"] # Optional. Recieve Internal Server 500 errors. Good for debugging. | ||||
|  | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
|  | ||||
| * **Category**: Apps | ||||
| * **Status**: wip | ||||
| * **Image**: [`liberaforms`](https://hub.docker.com/r/liberaforms), 4, upstream | ||||
| * **Image**: [`liberaforms`](https://fung.uy/mycosystems/-/packages/container/liberaforms/), 1 | ||||
| * **Healthcheck**: Yes | ||||
| * **Backups**: No | ||||
| * **Email**: 1 | ||||
| @ -20,6 +20,6 @@ | ||||
| * `abra app new liberaforms --secrets` | ||||
| * `abra app config <app-name>` | ||||
| * `abra app deploy <app-name>` | ||||
| * `abra app run <app-name> app /init.sh` [Create tables](https://gitlab.com/liberaforms/liberaforms/-/blob/main/docs/docker.md?ref_type=heads#create-the-database) in pgsql database | ||||
| * `abra app cmd forms.fung.uy app create_database` [Create tables](https://gitlab.com/liberaforms/liberaforms/-/blob/main/docs/docker.md?ref_type=heads#create-the-database) | ||||
|  | ||||
| For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). | ||||
|  | ||||
							
								
								
									
										40
									
								
								abra.sh
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								abra.sh
									
									
									
									
									
								
							| @ -1,2 +1,42 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| export ENTRYPOINT_VERSION=v2 | ||||
| export INIT_VERSION=v1 | ||||
|  | ||||
| file_env() { | ||||
|     local var="$1" | ||||
|     local fileVar="${var}_FILE" | ||||
|     local def="${2:-}" | ||||
|  | ||||
|     if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then | ||||
|         echo >&2 "error: both $var and $fileVar are set (but are exclusive)" | ||||
|         exit 1 | ||||
|     fi | ||||
|  | ||||
|     local val="$def" | ||||
|  | ||||
|     if [ "${!var:-}" ]; then | ||||
|         val="${!var}" | ||||
|     elif [ "${!fileVar:-}" ]; then | ||||
|         val="$(<"${!fileVar}")" | ||||
|     fi | ||||
|  | ||||
|     export "$var"="$val" | ||||
|     unset "$fileVar" | ||||
| } | ||||
|  | ||||
| setup_db() { | ||||
|     file_env "DB_PASSWORD" | ||||
|     file_env "CRYPTO_KEY" | ||||
|     file_env "SECRET_KEY" | ||||
|     file_env "LDAP_BIND_PASSWORD" | ||||
|  | ||||
|     echo "Creating tables..." | ||||
|     flask database create-tables && flask db stamp | ||||
|     if [ $? -ne 0 ]; then | ||||
|         echo -e "\033[0;31m\nDatabase failed to initialize please open an issue at https://git.coopcloud.tech/coop-cloud/liberaforms/issues\n" | ||||
|         return 1 | ||||
|     fi | ||||
|  | ||||
|     echo "Database setup complete. <3" | ||||
| } | ||||
|  | ||||
							
								
								
									
										20
									
								
								compose.yml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								compose.yml
									
									
									
									
									
								
							| @ -9,10 +9,8 @@ services: | ||||
|       - source: entrypoint | ||||
|         mode: 0555 | ||||
|         target: /custom-entrypoint.sh | ||||
|       - source: init | ||||
|         mode: 0555 | ||||
|         target: /init.sh | ||||
|     entrypoint: /custom-entrypoint.sh | ||||
|     command: "/usr/bin/supervisord -n" | ||||
|     environment: | ||||
|       ENABLE_LDAP: "False" | ||||
|       FLASK_DEBUG: "False" | ||||
| @ -29,9 +27,8 @@ services: | ||||
|       SESSION_TYPE: "filesystem" | ||||
|       LOG_LEVEL: INFO | ||||
|       LOG_DIR: /app/logs | ||||
|       GUNICORN_WORKERS: ${GUNICORN_WORKERS:-6} | ||||
|       GUNICORN_WORKERS: ${GUNICORN_WORKERS:-3} | ||||
|     volumes: | ||||
|       - app | ||||
|       - uploads:/app/uploads | ||||
|       - log:/app/logs | ||||
|     secrets: | ||||
| @ -40,12 +37,13 @@ services: | ||||
|       - crypto_key | ||||
|     networks: | ||||
|       - internal | ||||
|       - proxy | ||||
|     deploy: | ||||
|       labels: | ||||
|         - "coop-cloud.${STACK_NAME}.version=" | ||||
|         - "coop-cloud.${STACK_NAME}.version=wip" | ||||
|         - "traefik.enable=true" | ||||
|         - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=5000" | ||||
|         - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})" | ||||
|         - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)" | ||||
|         - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" | ||||
|         - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" | ||||
|  | ||||
| @ -93,11 +91,3 @@ configs: | ||||
|     name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} | ||||
|     file: entrypoint.sh.tmpl | ||||
|     template_driver: golang | ||||
|   init: | ||||
|     name: ${STACK_NAME}_init_${INIT_VERSION} | ||||
|     file: init.sh.tmpl | ||||
|     template_driver: golang | ||||
|   nginx_conf: | ||||
|     name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION} | ||||
|     file: nginx.conf.tmpl | ||||
|     template_driver: golang | ||||
|  | ||||
							
								
								
									
										34
									
								
								init.sh.tmpl
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								init.sh.tmpl
									
									
									
									
									
								
							| @ -1,34 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| set -e | ||||
|  | ||||
| file_env() { | ||||
|    local var="$1" | ||||
|    local fileVar="${var}_FILE" | ||||
|    local def="${2:-}" | ||||
|  | ||||
|    if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then | ||||
|       echo >&2 "error: both $var and $fileVar are set (but are exclusive)" | ||||
|       exit 1 | ||||
|    fi | ||||
|  | ||||
|    local val="$def" | ||||
|  | ||||
|    if [ "${!var:-}" ]; then | ||||
|       val="${!var}" | ||||
|    elif [ "${!fileVar:-}" ]; then | ||||
|       val="$(< "${!fileVar}")" | ||||
|    fi | ||||
|  | ||||
|    export "$var"="$val" | ||||
|    unset "$fileVar" | ||||
| } | ||||
|  | ||||
| file_env "DB_PASSWORD" | ||||
| file_env "CRYPTO_KEY" | ||||
| file_env "SECRET_KEY" | ||||
| file_env "LDAP_BIND_PASSWORD" | ||||
|  | ||||
| flask database create --docker-container db | ||||
|  | ||||
| flask database create-tables | ||||
		Reference in New Issue
	
	Block a user