new:[n8n] add charm
This commit is contained in:
31
n8n/hooks/init
Executable file
31
n8n/hooks/init
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
||||
|
||||
sender=$(options-get sender-email) || exit 1
|
||||
|
||||
init-config-add "
|
||||
$SERVICE_NAME:
|
||||
volumes:
|
||||
- $SERVICE_DATASTORE/.n8n:/home/node/.n8n
|
||||
environment:
|
||||
N8N_SMTP_SENDER: \"$sender\"
|
||||
GENERIC_TIMEZONE: "Europe/Paris"
|
||||
TZ: "Europe/Paris"
|
||||
"
|
||||
|
||||
uid=$(docker_get_uid "$SERVICE_NAME" "node")
|
||||
mkdir -p "$SERVICE_DATASTORE/.n8n"
|
||||
chown "$uid" "$SERVICE_DATASTORE/.n8n"
|
||||
|
22
n8n/hooks/postgres_database-relation-joined
Executable file
22
n8n/hooks/postgres_database-relation-joined
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PASSWORD="$(relation-get password)"
|
||||
USER="$(relation-get user)"
|
||||
DBNAME="$(relation-get dbname)"
|
||||
|
||||
|
||||
config-add "\
|
||||
services:
|
||||
$MASTER_BASE_SERVICE_NAME:
|
||||
environment:
|
||||
DB_TYPE: postgresdb
|
||||
DB_POSTGRESDB_HOST: $TARGET_SERVICE_NAME
|
||||
DB_POSTGRESDB_PORT: 5432
|
||||
DB_POSTGRESDB_DATABASE: $DBNAME
|
||||
DB_POSTGRESDB_USER: $USER
|
||||
DB_POSTGRESDB_PASSWORD: $PASSWORD
|
||||
"
|
||||
|
||||
info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."
|
20
n8n/hooks/smtp_server-relation-joined
Executable file
20
n8n/hooks/smtp_server-relation-joined
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
host=$(relation-get host) || exit 1
|
||||
port=$(relation-get port) || exit 1
|
||||
user=$(relation-get login) || exit 1
|
||||
password="$(relation-get password)" || exit 1
|
||||
|
||||
|
||||
config-add "\
|
||||
services:
|
||||
$MASTER_BASE_SERVICE_NAME:
|
||||
environment:
|
||||
N8N_SMTP_USER: \"$user\"
|
||||
N8N_SMTP_PASS: \"${password//\$/\$\$}\"
|
||||
N8N_SMTP_HOST: \"$host\"
|
||||
N8N_SMTP_PORT: \"$port\"
|
||||
"
|
||||
|
Reference in New Issue
Block a user