Compare commits
5 Commits
85f19e6832
...
f9954e3b52
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9954e3b52 | ||
|
|
187986d1a3 | ||
|
|
0312ffdf98 | ||
|
|
8e6a189e42 | ||
|
|
000bf3f594 |
6
README.org
Normal file
6
README.org
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- ispell-local-dictionary: "english" -*-
|
||||
|
||||
* What is jev-charms
|
||||
|
||||
This contains the 0k charm recipes for a managed deployment of ~opensem~
|
||||
app on a 0k ready installation.
|
||||
@@ -3,8 +3,73 @@
|
||||
|
||||
* Build source code
|
||||
|
||||
Using a ~Dockerfile~ and forcing latest known working ~composer.lock~
|
||||
and ~yarn.lock~ to ensure reproducible build.
|
||||
Using ~opensem~ source code, with the ~./build.sh~, we can build a proper
|
||||
~opensem-X.Y.Z.tar.xz~ that is ready for deployment.
|
||||
|
||||
We provide the resulting production ready application files in a
|
||||
~tar.xz~.
|
||||
* Charm usage
|
||||
|
||||
Please note that =paylib-system= relation is required and no
|
||||
auto-summon exists. It won't auto-pair neither as no charm currently
|
||||
provides this relation.
|
||||
|
||||
So you need to explicitly express this relation to a =stub= service.
|
||||
|
||||
* Usage
|
||||
|
||||
** Opensem
|
||||
|
||||
Typical installation of opensem would be:
|
||||
|
||||
#+begin_src yaml
|
||||
opensem:
|
||||
charm: opensem
|
||||
options:
|
||||
env:
|
||||
mail:
|
||||
from:
|
||||
name: "Boutique Jardin En Vie"
|
||||
address: boutique@jardinenvie.com
|
||||
|
||||
relations:
|
||||
publish-dir:
|
||||
frontend:
|
||||
domain: boutique.jardinenvie.com
|
||||
paybox-system:
|
||||
paybox:
|
||||
test: true
|
||||
rank: "001" ## keep the double-quotes !
|
||||
site: 2XXXX9
|
||||
id: 2XXXXX4
|
||||
hmac-key: "FFAXXXXX...XXXXX"
|
||||
|
||||
paybox:
|
||||
charm: stub
|
||||
|
||||
letsencrypt:
|
||||
options:
|
||||
email: my-email@example.com
|
||||
|
||||
frontend:
|
||||
charm: mailcow-www
|
||||
|
||||
logrotate:
|
||||
|
||||
cron:
|
||||
|
||||
jev-smtp:
|
||||
charm: smtp-stub
|
||||
options:
|
||||
host: mail.jardinenvie.com
|
||||
port: 465
|
||||
connection-security: ssl
|
||||
auth-method: password
|
||||
login: boutique@jardinenvie.com
|
||||
password: CXXXXXXXXXXg
|
||||
|
||||
rsync-backup:
|
||||
options:
|
||||
ident: ext-00.jardinenvie.com
|
||||
target: my-backup-host.com
|
||||
private-key: |
|
||||
# ...
|
||||
#+end_src
|
||||
|
||||
62
opensem/hooks/paybox_system-relation-joined
Executable file
62
opensem/hooks/paybox_system-relation-joined
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
. lib/common
|
||||
|
||||
set -e
|
||||
|
||||
test=$(relation-get test 2>/dev/null) || true
|
||||
site=$(relation-get site) || {
|
||||
err "The 'site' option is required."
|
||||
exit 1
|
||||
}
|
||||
rank=$(relation-get rank) || {
|
||||
err "The 'rank' option is required."
|
||||
exit 1
|
||||
}
|
||||
id=$(relation-get id) || {
|
||||
err "The 'id' option is required."
|
||||
exit 1
|
||||
}
|
||||
hmac_key=$(relation-get hmac-key) || {
|
||||
err "The 'hmac-key' option is required."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$test" ] && opensem:config-set PAYBOX_TEST "$test"
|
||||
opensem:config-set PAYBOX_SITE "$site"
|
||||
opensem:config-set PAYBOX_RANK "$rank"
|
||||
opensem:config-set PAYBOX_ID "$id"
|
||||
opensem:config-set PAYBOX_HMAC_KEY "$hmac_key"
|
||||
|
||||
paybox_url="http://www1.paybox.com/wp-content/uploads/2014/03/pubkey.pem"
|
||||
paybox_pubkey_path="$SERVICE_DATASTORE/var/lib/opensem/paybox/pubkey.pem"
|
||||
|
||||
if ! [ -f "$paybox_pubkey_path" ]; then
|
||||
mkdir -p "${paybox_pubkey_path%/*}"
|
||||
if ! curl -sSL "$paybox_url" -o "$paybox_pubkey_path"; then
|
||||
err "Failed to download Paybox public key from $paybox_url"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
## and create the mount point also:
|
||||
paybox_mount_dir="$SERVICE_CONFIGSTORE/opt/apps/$SERVICE_NAME/storage/paybox"
|
||||
if ! [ -d "$paybox_mount_dir" ]; then
|
||||
mkdir -p "$paybox_mount_dir" || {
|
||||
err "Could not create directory $paybox_mount_dir"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
php_fpm_service=$(service:traverse "$SERVICE_NAME":php-fpm) || {
|
||||
err "Could not find php-fpm service for $SERVICE_NAME"
|
||||
exit 1
|
||||
}
|
||||
|
||||
config-add "
|
||||
services:
|
||||
$php_fpm_service:
|
||||
volumes:
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/paybox:/opt/apps/$SERVICE_NAME/storage/paybox:ro
|
||||
"
|
||||
@@ -5,3 +5,6 @@
|
||||
set -e
|
||||
|
||||
mv -v "${OPENSEM_CONFIG_FILE}" "${OPENSEM_CONFIG_FILE%.prepare}"
|
||||
|
||||
artisan migrate -v --force &&
|
||||
artisan migrate -v --path=database/migrations/shop --force
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
OPENSEM_DIR="/opt/apps/opensem"
|
||||
OPENSEM_CODE="$SERVICE_CONFIGSTORE$OPENSEM_DIR"
|
||||
OPENSEM_RELEASE=1.0.0-rc.1
|
||||
OPENSEM_RELEASE=1.0.0-rc.5
|
||||
OPENSEM_URL=https://docker.0k.io/downloads/opensem-"${OPENSEM_RELEASE}".tar.xz
|
||||
OPENSEM_CONFIG_FILE="${OPENSEM_CODE}"/.env.prepare
|
||||
|
||||
|
||||
@@ -74,3 +74,11 @@ uses:
|
||||
solves:
|
||||
unmanaged-logs: "in docker logs"
|
||||
#default-options:
|
||||
paybox-system:
|
||||
#constraint: required | recommended | optional
|
||||
#auto: pair | summon | none ## default: pair
|
||||
constraint: required
|
||||
auto: pair
|
||||
solves:
|
||||
missing-payment: "credit card payment"
|
||||
#default-options:
|
||||
|
||||
Reference in New Issue
Block a user