forked from 0k/0k-charms
Browse Source
Merge pull request 'maj master' (#1) from 0k/0k-charms:master into master
Merge pull request 'maj master' (#1) from 0k/0k-charms:master into master
Reviewed-on: https://git.myceliandre.fr/StephanSainleger/0k-charms/pulls/1master
StephanSainleger
3 years ago
102 changed files with 3097 additions and 483 deletions
-
17apache/build/Dockerfile
-
4bitwarden/metadata.yml
-
12codimd/hooks/init
-
4cron/build/Dockerfile
-
8cron/hooks/init
-
20cron/hooks/pre_deploy
-
4cron/metadata.yml
-
2cyclos/hooks/init
-
63cyclos/hooks/pre_deploy
-
61cyclos/lib/common
-
6cyclos/metadata.yml
-
BINcyclos/src/init.sql.gz
-
14drone/metadata.yml
-
33etherpad/README.org
-
39etherpad/hooks/init
-
26etherpad/hooks/postgres_database-relation-joined
-
53etherpad/metadata.yml
-
3gitea/metadata.yml
-
47gogocarto/README.org
-
4gogocarto/hooks/init
-
2gogocarto/hooks/mongo_database-relation-joined
-
11gogocarto/hooks/publish_dir-relation-joined
-
44gogocarto/hooks/schedule_commands-relation-joined
-
44gogocarto/lib/common
-
5gogocarto/metadata.yml
-
12hedgedoc/hooks/init
-
0hedgedoc/hooks/postgres_database-relation-joined
-
22hedgedoc/hooks/web_proxy-relation-joined
-
4hedgedoc/metadata.yml
-
2logrotate/build/src/entrypoint.sh
-
19mariadb/build/Dockerfile
-
20mariadb/build/src/entrypoint.sh
-
48mariadb/hooks/init
-
102mariadb/hooks/install.d/60-backup.sh
-
3mariadb/hooks/schedule_command-relation-joined
-
4mariadb/metadata.yml
-
42mariadb/resources/bin/mysql-backup
-
27monujo/hooks/init
-
17monujo/metadata.yml
-
4mysql/hooks/install
-
13nextcloud/build/Dockerfile
-
14nextcloud/build/database-accept-dots.patch
-
2nextcloud/metadata.yml
-
50odoo-tecnativa/actions/install
-
20onlyoffice/hooks/init
-
3onlyoffice/hooks/nextcloud_app-relation-joined
-
34onlyoffice/hooks/postgres_database-relation-joined
-
36onlyoffice/metadata.yml
-
14peertube/build/Dockerfile
-
26peertube/build/dbname.patch
-
1peertube/hooks/init
-
2peertube/hooks/postgres_database-relation-joined
-
2postgres/metadata.yml
-
4precise/0k-odoo-light/hooks/install
-
2precise/apt-cacher/hooks/install
-
42precise/base-0k/hooks/install.d/00-base.sh
-
2precise/base-0k/hooks/install.d/05-shyaml.sh
-
6precise/base-0k/hooks/install.d/20-kal-scripts.sh
-
80precise/base-0k/hooks/install.d/30-customize.sh
-
2precise/ca/hooks/install
-
2precise/git/hooks/install
-
4precise/host/hooks/install.d/38-ntp.sh
-
3precise/host/hooks/install.d/39-logrotate.sh
-
5precise/host/hooks/install.d/40-btrfs.sh
-
45precise/host/hooks/install.d/50-lxc.sh
-
38precise/host/hooks/install.d/60-docker.sh
-
1precise/host/hooks/install.d/61-mirror-dir.sh
-
23precise/host/hooks/install.d/70-0k.sh
-
23precise/host/hooks/install.d/75-fail2ban.sh
-
19precise/host/hooks/install.d/80-dns-waterfall.sh
-
253precise/host/hooks/install.d/90-shorewall.sh
-
37precise/host/hooks/install.d/95-checks.sh
-
74precise/host/hooks/install.d/96-backup-lxc.sh
-
2precise/mirror/hooks/install
-
2precise/pypi-cacher/hooks/install
-
2precise/svn/hooks/install
-
8precise/vpn/hooks/install
-
60rocketchat/README.org
-
4rocketchat/metadata.yml
-
125rsync-backup-target/README.org
-
10rsync-backup-target/build/Dockerfile
-
42rsync-backup-target/build/entrypoint.sh
-
7rsync-backup-target/build/src/etc/sudoers.d/recover
-
3rsync-backup-target/build/src/etc/sudoers.d/rsync
-
76rsync-backup-target/build/src/usr/local/sbin/request-recovery-key
-
106rsync-backup-target/build/src/usr/local/sbin/ssh-admin-cmd-validate
-
66rsync-backup-target/build/src/usr/local/sbin/ssh-cmd-validate
-
152rsync-backup-target/build/src/usr/local/sbin/ssh-key
-
97rsync-backup-target/build/src/usr/local/sbin/ssh-recover-cmd-validate
-
68rsync-backup-target/build/src/usr/local/sbin/ssh-update-keys
-
73rsync-backup-target/hooks/init
-
83rsync-backup-target/hooks/log_rotate-relation-joined
-
12rsync-backup-target/metadata.yml
-
50rsync-backup-target/resources/bin/compose-add-rsync-key
-
2rsync-backup/build/Dockerfile
-
38rsync-backup/hooks/install.d/60-install.sh
-
1rsync-backup/hooks/schedule_command-relation-joined
-
2rsync-backup/metadata.yml
-
652rsync-backup/resources/bin/mirror-dir
-
12searx/hooks/web_proxy-relation-joined
@ -1,12 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
init-config-add "\ |
|||
$SERVICE_NAME: |
|||
environment: |
|||
CMD_USECDN: \"false\" |
|||
" |
|||
|
|||
## ``codimd`` create uploads folder with wrong permission |
|||
|
|||
mkdir -p "$SERVICE_DATASTORE/home/hackmd/app/public/uploads" |
|||
chown -R 1500:1500 "$SERVICE_DATASTORE/home/hackmd/app/public/" |
@ -0,0 +1,20 @@ |
|||
#!/bin/bash |
|||
## Should be executable N time in a row with same result. |
|||
|
|||
set -e |
|||
|
|||
cron_config_hash() { |
|||
debug "Adding config hash to enable recreating upon config change." |
|||
config_hash=$({ |
|||
find "$SERVICE_CONFIGSTORE/etc/cron"{,.hourly,.weekly,.daily,.monthly} \ |
|||
-type f -exec md5sum {} \; |
|||
} | md5_compat) || exit 1 |
|||
init-config-add " |
|||
$MASTER_BASE_SERVICE_NAME: |
|||
labels: |
|||
- compose.config_hash=$config_hash |
|||
" |
|||
} |
|||
|
|||
|
|||
cron_config_hash || exit 1 |
@ -0,0 +1,63 @@ |
|||
#!/bin/bash |
|||
|
|||
## |
|||
## Get domain in option of relation "web-proxy" |
|||
## |
|||
|
|||
## XXXvlab: there is a tiny lapse of time where database is not yet |
|||
## installed, and admin password is the default value. |
|||
|
|||
|
|||
. lib/common |
|||
|
|||
set -ex |
|||
|
|||
|
|||
admin_password=$(options-get admin-password 2>/dev/null ) || exit 1 |
|||
|
|||
CONTROL_PASSWORD_FILE="$SERVICE_DATASTORE/.control-pass" |
|||
## Was it already properly propagated to database ? |
|||
control_password=$(H "${admin_password}") |
|||
if ! [ -e "$CONTROL_PASSWORD_FILE" ] || [ "$control_password" != "$(cat "$CONTROL_PASSWORD_FILE")" ]; then |
|||
|
|||
hash="$(htpasswd -nbBC 10 USER "$admin_password" | cut -f 2- -d :)" || { |
|||
err "Couldn't generate hash for admin password." |
|||
exit 1 |
|||
} |
|||
|
|||
if ! sql < <(e " |
|||
UPDATE passwords SET value = '$hash' |
|||
WHERE user_id = 1 |
|||
AND status = 'ACTIVE' |
|||
AND password_type_id in ( |
|||
SELECT id FROM password_types |
|||
WHERE input_method = 'TEXT_BOX' |
|||
AND password_mode = 'MANUAL'); |
|||
"); then |
|||
debug "Failed to set password for admin users." |
|||
exit 1 |
|||
fi |
|||
mkdir -p "${CONTROL_PASSWORD_FILE%/*}" |
|||
e "$control_password" > "$CONTROL_PASSWORD_FILE" |
|||
fi |
|||
|
|||
|
|||
|
|||
url=$(named-relation-get "web-proxy" url) || exit 1 |
|||
|
|||
CONTROL_URL_FILE="$SERVICE_DATASTORE/.control-url" |
|||
## Was it already properly propagated to database ? |
|||
control_url=$(H "${url}") |
|||
if ! [ -e "$CONTROL_URL_FILE" ] || [ "$control_url" != "$(cat "$CONTROL_URL_FILE")" ]; then |
|||
## In ``configurations`` table, columns login_url, logout_url, root_url |
|||
|
|||
if ! sql < <(e " |
|||
UPDATE configurations |
|||
SET |
|||
root_url = '$url' |
|||
"); then |
|||
debug "Failed to set password for admin users." |
|||
exit 1 |
|||
fi |
|||
e "$control_password" > "$CONTROL_URL_FILE" |
|||
fi |
@ -0,0 +1,33 @@ |
|||
# -*- ispell-local-dictionary: "english" -*- |
|||
|
|||
#+TITLE: Etherpad Charm |
|||
|
|||
* Upgrade |
|||
|
|||
Based on https://github.com/ether/etherpad-lite , following: |
|||
|
|||
https://github.com/ether/etherpad-lite/blob/develop/doc/docker.md |
|||
|
|||
Used: |
|||
|
|||
#+begin_src sh |
|||
TAG=1.8.14 |
|||
git clone https://github.com/ether/etherpad-lite --depth 1 -b $TAG |
|||
docker build --build-arg INSTALL_SOFFICE=1 \ |
|||
--build-arg ETHERPAD_PLUGINS=" \ |
|||
ep_font_family ep_mammoth ep_comments_page ep_table_of_contents \ |
|||
ep_markdown ep_image_upload ep_spellcheck ep_headings2 ep_align \ |
|||
ep_who_did_what ep_what_have_i_missed ep_embedmedia \ |
|||
ep_openid_connect ep_rss ep_git_commit_saved_revision" \ |
|||
. -t docker.0k.io/etherpad:${TAG}-0k |
|||
docker push docker.0k.io/etherpad:${TAG}-0k |
|||
#+end_src |
|||
|
|||
|
|||
* Admin password |
|||
|
|||
We choose to NOT include admin panel as it allows to change settings |
|||
and install plugins but this will not allow to reproduce an install |
|||
easily. We can do this on the =compose.yml= side in a reproducible |
|||
manner. |
|||
|
@ -0,0 +1,39 @@ |
|||
#!/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 |
|||
|
|||
|
|||
. lib/common |
|||
|
|||
set -e |
|||
|
|||
|
|||
dirs=( |
|||
"$SERVICE_DATASTORE/var/lib/etherpad" |
|||
) |
|||
|
|||
uid_gid=($(docker_get_uid_gid "$SERVICE_NAME" "etherpad" "etherpad")) || { |
|||
err "Could not fetch uid/gid on image of service ${DARKYELLOW}$SERVICE_NAME${NORMAL}." |
|||
return 1 |
|||
} |
|||
|
|||
uid="${uid_gid[0]}" |
|||
gid="${uid_gid[1]}" |
|||
for dir in "${dirs[@]}"; do |
|||
mkdir -p "$dir" |
|||
find "$dir" \! -uid "$uid" -print0 | while read-0 f; do |
|||
chown -v "$uid" "$f" || return 1 |
|||
done |
|||
find "$dir" \! -gid "$gid" -print0 | while read-0 f; do |
|||
chgrp -v "$gid" "$f" || return 1 |
|||
done |
|||
done |
|||
|
@ -0,0 +1,26 @@ |
|||
#!/bin/bash |
|||
|
|||
set -e |
|||
|
|||
PASSWORD="$(relation-get password)" |
|||
USER="$(relation-get user)" |
|||
DBNAME="$(relation-get dbname)" |
|||
|
|||
control=$(echo -en "$USER\0$DBNAME\0$PASSWORD\0$ADMIN_PASSWORD" | md5_compat) |
|||
|
|||
config-add "\ |
|||
services: |
|||
$MASTER_BASE_SERVICE_NAME: |
|||
environment: |
|||
DB_TYPE: postgres |
|||
DB_HOST: \"$MASTER_TARGET_SERVICE_NAME\" |
|||
DB_NAME: \"$DBNAME\" |
|||
DB_PASS: \"$PASSWORD\" |
|||
DB_USER: \"$USER\" |
|||
" |
|||
|
|||
[ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0 |
|||
|
|||
relation-set control "$control" |
|||
|
|||
info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access." |
@ -0,0 +1,53 @@ |
|||
name: etherpad |
|||
summary: "Etherpad-lite server" |
|||
maintainer: "Valentin Lab <valentin.lab@kalysto.org>" |
|||
inherit: base-0k |
|||
## Custom built from git 1.8.14 https://github.com/ether/etherpad-lite with |
|||
## build arg --build-arg INSTALL_SOFFICE=1 |
|||
docker-image: docker.0k.io/etherpad:1.8.14-soffice ## custom built from git m etherpad/etherpad |
|||
description: | |
|||
Etherpad-lite service. |
|||
|
|||
data-resources: |
|||
- /var/lib/etherpad |
|||
|
|||
docker-compose: |
|||
command: node src/node/server.js --apikey /var/lib/etherpad/APIKEY.txt |
|||
environment: |
|||
SOFFICE: '/usr/bin/soffice' |
|||
|
|||
uses: |
|||
postgres-database: |
|||
#constraint: required | recommended | optional |
|||
#auto: pair | summon | none ## default: pair |
|||
constraint: required |
|||
auto: summon |
|||
solves: |
|||
database: "main storage" |
|||
default-options: |
|||
extensions: |
|||
- unaccent |
|||
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}:9001 |
|||
|
|||
backup: |
|||
constraint: recommended |
|||
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/" |
@ -0,0 +1,44 @@ |
|||
#!/bin/bash |
|||
|
|||
## When writing relation script, remember: |
|||
## - they should be idempotents |
|||
## - they can be launched while the dockers is already up |
|||
## - they are launched from the host |
|||
## - the target of the link is launched first, and get a chance to ``relation-set`` |
|||
## - both side of the scripts get to use ``relation-get``. |
|||
|
|||
. lib/common |
|||
|
|||
set -e |
|||
|
|||
## XXXvlab: should use container name here so that it could support |
|||
## multiple postgres |
|||
label=${SERVICE_NAME} |
|||
DST=$CONFIGSTORE/$TARGET_SERVICE_NAME/etc/cron/$label |
|||
|
|||
## XXXvlab: Should we do a 'docker exec' instead ? |
|||
bin_console="dc run -u www-data --rm --entrypoint \\\"$GOGOCARTO_DIR/bin/console\\\" $MASTER_BASE_SERVICE_NAME" |
|||
|
|||
## Warning: 'docker -v' will use HOST directory even if launched from |
|||
## 'cron' container. |
|||
file_put "$DST" <<EOF |
|||
@daily root lock ${label}-checkvote -D -p 10 -c "\ |
|||
$bin_console app:elements:checkvote" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-checkvote_script.log |
|||
|
|||
@daily root lock ${label}-checkExternalSourceToUpdate -D -p 10 -c "\ |
|||
$bin_console app:elements:checkExternalSourceToUpdate" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-checkExternalSourceToUpdate_script.log |
|||
|
|||
@daily root lock ${label}-notify-moderation -D -p 10 -c "\ |
|||
$bin_console app:notify-moderation" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-notify-moderation_script.log |
|||
|
|||
|
|||
@hourly root lock ${label}-sendNewsletter -D -p 10 -c "\ |
|||
$bin_console app:users:sendNewsletter" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-sendNewsletter_script.log |
|||
|
|||
|
|||
*/5 * * * * root lock ${label}-webhooks-post -D -p 10 -c "\ |
|||
$bin_console --env=prod app:webhooks:post" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-webhooks-post_script.log |
|||
|
|||
|
|||
EOF |
|||
chmod +x "$DST" |
@ -0,0 +1,12 @@ |
|||
#!/bin/bash |
|||
|
|||
init-config-add "\ |
|||
$SERVICE_NAME: |
|||
environment: |
|||
CMD_USECDN: \"false\" |
|||
" |
|||
|
|||
## ``codimd`` create uploads folder with wrong permission |
|||
uid=$(docker_get_uid "$SERVICE_NAME" "hedgedoc") |
|||
mkdir -p "$SERVICE_DATASTORE/hedgedoc/public/uploads" |
|||
chown "$uid" "$SERVICE_DATASTORE/hedgedoc/public/uploads" |
@ -0,0 +1,22 @@ |
|||
#!/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: |
|||
CMD_DOMAIN: $DOMAIN |
|||
$USESSL |
|||
" |
|||
|
@ -1,6 +1,6 @@ |
|||
docker-image: docker.0k.io/hackmd:2.2.0 ## from: nabo.codimd.dev/hackmdio/hackmd:2.2.0 |
|||
docker-image: docker.0k.io/hedgedoc:1.7.2 ## from: quay.io/hedgedoc/hedgedoc:1.7.2-alpine |
|||
data-resources: |
|||
- /home/hackmd/app/public/uploads |
|||
- /hedgedoc/public/uploads |
|||
|
|||
default-options: |
|||
|
@ -0,0 +1,19 @@ |
|||
FROM alpine:3.9 |
|||
|
|||
RUN apk add --no-cache mariadb mariadb-client mariadb-server-utils && \ |
|||
rm -f /var/cache/apk/* |
|||
|
|||
## Required by mysql-backup |
|||
RUN apk add --no-cache bash gzip && \ |
|||
rm -f /var/cache/apk/* |
|||
|
|||
RUN mkdir -p /run/mysqld && \ |
|||
chown -R mysql:mysql /run/mysqld |
|||
|
|||
RUN sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/my.cnf.d/mariadb-server.cnf |
|||
|
|||
COPY src/ / |
|||
|
|||
EXPOSE 3306 |
|||
|
|||
ENTRYPOINT ["/entrypoint.sh"] |
@ -0,0 +1,20 @@ |
|||
#!/bin/sh |
|||
|
|||
|
|||
|
|||
if ! [ -d /var/lib/mysql/mysql ]; then |
|||
chown -R mysql:mysql /var/lib/mysql |
|||
mysql_install_db --user=mysql --ldata=/var/lib/mysql > /dev/null |
|||
fi |
|||
|
|||
|
|||
|
|||
## Support of Ctrl-C: see https://github.com/docker-library/mysql/issues/47 |
|||
run() { |
|||
"$@" & |
|||
pid="$!" |
|||
trap "kill -SIGQUIT $pid" INT TERM |
|||
wait |
|||
} |
|||
|
|||
run mysqld --user=mysql --skip-name-resolve --skip-networking=0 "$@" |
@ -0,0 +1,102 @@ |
|||
|
|||
set -eux ## important for unbound variable ? |
|||
|
|||
## Require these to be set |
|||
# MYSQL_ROOT_PASSWORD= |
|||
# MYSQL_CONTAINER= |
|||
|
|||
[ "${MYSQL_ROOT_PASSWORD}" ] || { |
|||
echo "Error: you must set \$MYSQL_ROOT_PASSWORD prior to running this script." >&2 |
|||
exit 1 |
|||
} |
|||
|
|||
[ "${MYSQL_CONTAINER}" ] || { |
|||
echo "Error: you must set \$MYSQL_CONTAINER prior to running this script." >&2 |
|||
exit 1 |
|||
} |
|||
|
|||
|
|||
## |
|||
## Init, to setup passwordless connection to mysql |
|||
## |
|||
|
|||
type -p mysql >/dev/null || { |
|||
case $(lsb_release -is) in |
|||
Debian) |
|||
case $(lsb_release -rs) in |
|||
10) |
|||
apt-get install -y default-mysql-client </dev/null |
|||
;; |
|||
*) |
|||
apt-get install -y mysql-client </dev/null |
|||
;; |
|||
esac |
|||
;; |
|||
Ubuntu) |
|||
apt-get install -y mysql-client </dev/null |
|||
;; |
|||
esac |
|||
} |
|||
|
|||
if ! [ -e "/root/.my.cnf" ]; then |
|||
cat <<EOF > ~/.my.cnf |
|||
[client] |
|||
password=${MYSQL_ROOT_PASSWORD} |
|||
EOF |
|||
chmod 600 ~/.my.cnf |
|||
fi |
|||
|
|||
## |
|||
## installation of the mysql-backup script |
|||
## |
|||
|
|||
|
|||
apt-get install -y kal-shlib-{core,pretty,common} </dev/null |
|||
ln -sf "${PWD}/resources/bin/mysql-backup" /usr/local/sbin/mysql-backup |
|||
|
|||
|
|||
## |
|||
## Connection to cron |
|||
## |
|||
|
|||
|
|||
depends cron |
|||
cat <<EOF > /etc/cron.d/mysql-backup |
|||
SHELL=/bin/bash |
|||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|||
|
|||
0 * * * * root /usr/local/sbin/mysql-backup --host \$(docker-ip "$MYSQL_CONTAINER" 2>/dev/null | sed -r 's/ +/ /g' | cut -f 3 -d " ") | logger -t mysql-backup |
|||
|
|||
EOF |
|||
|
|||
|
|||
## |
|||
## Connection with backup |
|||
## |
|||
|
|||
if type -p mirror-dir >/dev/null 2>&1; then |
|||
[ -d "/etc/mirror-dir" ] || { |
|||
echo "'mirror-dir' is installed but no '/etc/mirror-dir' was found." >&2 |
|||
exit 1 |
|||
} |
|||
depends shyaml |
|||
|
|||
if ! sources=$(shyaml get-values default.sources < /etc/mirror-dir/config.yml); then |
|||
echo "Couldn't query 'default.sources' in '/etc/mirror-dir/config.yml'." >&2 |
|||
exit 1 |
|||
fi |
|||
|
|||
if ! echo "$sources" | grep "^/var/backups/mysql$" 2>/dev/null; then |
|||
sed -i '/sources:/a\ - /var/backups/mysql' /etc/mirror-dir/config.yml |
|||
cat <<EOF >> /etc/mirror-dir/config.yml |
|||
/var/backups/mysql: |
|||
exclude: |
|||
- "/*.inprogress" |
|||
EOF |
|||
fi |
|||
else |
|||
echo "warn: 'mirror-dir' not installed, backup won't be sent" >&2 |
|||
fi |
|||
|
|||
|
|||
|
@ -0,0 +1,27 @@ |
|||
#!/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 |
|||
|
|||
APP_NAME=monujo |
|||
SOURCE_URL="https://docker.0k.io/downloads/$APP_NAME-0.0.1.tar.bz2" |
|||
LOCATION="$SERVICE_DATASTORE/opt/apps/$APP_NAME" |
|||
|
|||
mkdir -p "$LOCATION" |
|||
if dir_is_empty "$LOCATION"; then |
|||
cd "$LOCATION" |
|||
wget -q "$SOURCE_URL" -O file.tar.bz2 |
|||
tar xjf file.tar.bz2 |
|||
rm file.tar.bz2 |
|||
chown root:root "$LOCATION" -R |
|||
fi |
|||
|
@ -0,0 +1,17 @@ |
|||
description: "LokWallet" |
|||
maintainer: "Valentin Lab <valentin.lab@kalysto.org>" |
|||
subordinate: true |
|||
|
|||
uses: |
|||
publish-dir: |
|||
#constraint: required | recommended | optional |
|||
#auto: pair | summon | none ## default: pair |
|||
scope: container |
|||
constraint: required |
|||
auto: summon |
|||
solves: |
|||
container: "main running server" |
|||
default-options: |
|||
location: !var-expand "$DATASTORE/$BASE_SERVICE_NAME/opt/apps/monujo" |
|||
# data-dirs: ## write permission for web-app |
|||
# - . |
@ -1,13 +0,0 @@ |
|||
## This is a cache of nextcloud:18.0.1 image (gmp is included) |
|||
FROM docker.0k.io/nextcloud:1.2.0 |
|||
|
|||
|
|||
## |
|||
## What is following is only to patch nextcloud to remove |
|||
## some database name checks |
|||
## |
|||
|
|||
COPY database-accept-dots.patch /tmp/ |
|||
|
|||
RUN cd /usr/src/nextcloud && \ |
|||
patch -p1 < /tmp/database-accept-dots.patch |
@ -1,14 +0,0 @@ |
|||
diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php
|
|||
index 0cbfecf..a821a2e 100644
|
|||
--- a/lib/private/Setup/AbstractDatabase.php
|
|||
+++ b/lib/private/Setup/AbstractDatabase.php
|
|||
@@ -72,9 +72,6 @@ abstract class AbstractDatabase {
|
|||
} elseif (empty($config['dbname'])) { |
|||
$errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); |
|||
} |
|||
- if(substr_count($config['dbname'], '.') >= 1) {
|
|||
- $errors[] = $this->trans->t("%s you may not use dots in the database name", array($this->dbprettyname));
|
|||
- }
|
|||
return $errors; |
|||
} |
|||
|
@ -0,0 +1,50 @@ |
|||
#!/bin/bash |
|||
|
|||
## Load action gets a first argument a DIRECTORY holding the necessary files. |
|||
## |
|||
## |
|||
|
|||
if [ -z "$SERVICE_DATASTORE" ]; then |
|||
echo "This script is meant to be run through 'compose' to work properly." >&2 |
|||
exit 1 |
|||
fi |
|||
|
|||
usage="$exname [-h|--help] DBNAME [MODULE ...]" |
|||
|
|||
dbname= |
|||
modules=() |
|||
while [ "$1" ]; do |
|||
case "$1" in |
|||
"--help"|"-h") |
|||
print_usage |
|||
exit 0 |
|||
;; |
|||
*) |
|||
[ -z "$dbname" ] && { dbname=$1 ; shift ; continue ; } |
|||
modules+=("$1") |
|||
;; |
|||
esac |
|||
shift |
|||
done |
|||
|
|||
if [ -z "$dbname" ]; then |
|||
err "You must provide a destination database name as second argument." |
|||
print_usage |
|||
exit 1 |
|||
fi |
|||
|
|||
if [ -z "${modules[*]}" ]; then |
|||
err "You must provide at least one module as third argument." |
|||
print_usage |
|||
exit 1 |
|||
fi |
|||
|
|||
modules="$(echo "${modules[@]}" | tr " " ",")" |
|||
|
|||
## This can work only if ~/.my.cnf is correctly created by init. |
|||
|
|||
set -e |
|||
|
|||
launch_docker_compose run "$CONTAINER_NAME" --init="$modules" -d "$dbname" --stop-after-init |
|||
|
|||
info "Installed '$modules' module(s) into database '$dbname'." |
@ -0,0 +1,34 @@ |
|||
#!/bin/bash |
|||
|
|||
. lib/common |
|||
|
|||
set -e |
|||
|
|||
PASSWORD="$(relation-get password)" |
|||
USER="$(relation-get user)" |
|||
DBNAME="$(relation-get dbname)" |
|||
ADMIN_PASSWORD=$(relation-base-compose-get admin-password 2>/dev/null) || { |
|||
if [ -e "$CONFIG" ]; then |
|||
ADMIN_PASSWORD=$(grep ^admin_passwd "$CONFIG" | sed -r 's/^admin_passwd\s+=\s+(.+)$/\1/g') |
|||
fi |
|||
if [ -z "$ADMIN_PASSWORD" ]; then |
|||
info "Generating odoo admin password" |
|||
ADMIN_PASSWORD=$(gen_password) |
|||
fi |
|||
} |
|||
|
|||
database=$(options-get database 2>/dev/null) || true |
|||
database="${database:-$DBNAME}" |
|||
|
|||
config-add "\ |
|||
services: |
|||
$MASTER_BASE_SERVICE_NAME: |
|||
environment: |
|||
DB_TYPE: \"postgres\" |
|||
DB_HOST: \"$MASTER_TARGET_SERVICE_NAME\" |
|||
DB_NAME: \"$DBNAME\" |
|||
DB_PWD: \"$PASSWORD\" |
|||
DB_USER: \"$USER\" |
|||
" |
|||
|
|||
info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access." |
@ -1,26 +0,0 @@ |
|||
diff --git a/dist/server/initializers/checker-before-init.js b/dist/server/initializers/checker-before-init.js
|
|||
index d8422ee..5eb3678 100644
|
|||
--- a/dist/server/initializers/checker-before-init.js
|
|||
+++ b/dist/server/initializers/checker-before-init.js
|
|||
@@ -16,7 +16,7 @@ function checkMissedConfig() {
|
|||
const required = ['listen.port', 'listen.hostname', |
|||
'webserver.https', 'webserver.hostname', 'webserver.port', |
|||
'trust_proxy', |
|||
- 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'database.pool.max',
|
|||
+ 'database.hostname', 'database.port', 'database.dbname', 'database.username', 'database.password', 'database.pool.max',
|
|||
'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', |
|||
'email.body.signature', 'email.subject.prefix', |
|||
'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', |
|||
diff --git a/dist/server/initializers/config.js b/dist/server/initializers/config.js
|
|||
index 6aa916f..89d16fe 100644
|
|||
--- a/dist/server/initializers/config.js
|
|||
+++ b/dist/server/initializers/config.js
|
|||
@@ -12,7 +12,7 @@ const CONFIG = {
|
|||
HOSTNAME: config.get('listen.hostname') |
|||
}, |
|||
DATABASE: { |
|||
- DBNAME: 'peertube' + config.get('database.suffix'),
|
|||
+ DBNAME: config.get('database.dbname'),
|
|||
HOSTNAME: config.get('database.hostname'), |
|||
PORT: config.get('database.port'), |
|||
USERNAME: config.get('database.username'), |