diff --git a/docuseal/README.org b/docuseal/README.org new file mode 100644 index 0000000..fdf8387 --- /dev/null +++ b/docuseal/README.org @@ -0,0 +1,5 @@ +# -*- ispell-local-dictionary: "english" -*- + +## Charm for DocuSeal - allow to sign Documents + +repo : https://github.com/docusealco/docuseal \ No newline at end of file diff --git a/docuseal/hooks/init b/docuseal/hooks/init new file mode 100755 index 0000000..84552a7 --- /dev/null +++ b/docuseal/hooks/init @@ -0,0 +1,24 @@ +#!/bin/bash + +## Init is run on host +## For now it is run every time the script is launched, but +## it should be launched only once after build. + +## Accessible variables are: +## - SERVICE_NAME Name of current service +## - DOCKER_BASE_IMAGE Base image from which this service might be built if any +## - SERVICE_DATASTORE Location on host of the DATASTORE of this service +## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service + + +set -e + +version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } + +## bug: https://github.com/adoptium/containers/issues/215#issuecomment-1142046045 +docker_version=$(docker info --format '{{.ServerVersion}}') +if ! version_gt "$docker_version" 20.10.0; then + err "Sorry, $SERVICE_NAME require docker version >= 20.10 (current: $docker_version)" + exit 1 +fi + diff --git a/docuseal/hooks/postgres_database-relation-joined b/docuseal/hooks/postgres_database-relation-joined new file mode 100755 index 0000000..ccc2f6c --- /dev/null +++ b/docuseal/hooks/postgres_database-relation-joined @@ -0,0 +1,15 @@ +set -e + +PASSWORD="$(relation-get password)" +USER="$(relation-get user)" +DBNAME="$(relation-get dbname)" + + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + DATABASE_URL: postgres://$USER:$PASSWORD@$TARGET_SERVICE_NAME/$DBNAME +" + +info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access." diff --git a/docuseal/hooks/web_proxy-relation-joined b/docuseal/hooks/web_proxy-relation-joined new file mode 100755 index 0000000..3e2d624 --- /dev/null +++ b/docuseal/hooks/web_proxy-relation-joined @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +DOMAIN=$(relation-get domain) || exit 1 + +## These are mainly to setup the correct web-hook +if [ "$MASTER_BASE_SERVICE_NAME" == "$DOMAIN" ]; then + ## This is because the IP will be the docker container version + USESSL="" +else + USESSL="CMD_PROTOCOL_USESSL: 'true'" +fi + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + FORCE_SSL: $DOMAIN + $USESSL +" \ No newline at end of file diff --git a/docuseal/metadata.yml b/docuseal/metadata.yml new file mode 100644 index 0000000..ff190ad --- /dev/null +++ b/docuseal/metadata.yml @@ -0,0 +1,35 @@ +docker-image: docuseal/docuseal:latest +data-resources: + - /data + +uses: + postgres-database: + #constraint: required | recommended | optional + #auto: pair | summon | none ## default: pair + constraint: required + auto: summon + solves: + database: "main storage" + web-proxy: + #constraint: required | recommended | optional + #auto: pair | summon | none ## default: pair + constraint: recommended + auto: pair + solves: + proxy: "Public access" + default-options: + target: !var-expand ${MASTER_BASE_SERVICE_NAME}:3000 + backup: + constraint: optional + auto: pair + solves: + backup: "Automatic regular backup" + default-options: + ## First pattern matching wins, no pattern matching includes. + ## include-patterns are checked first, then exclude-patterns + ## Patterns rules: + ## - ending / for directory + ## - '*' authorized + ## - must start with a '/', will start from $SERVICE_DATASTORE + #exclude-patterns: + # - "/var/lib/odoo/sessions/" \ No newline at end of file