M type/__evilham_discourse/files/standalone.yml.sh => type/__evilham_discourse/files/standalone.yml.sh +5 -4
@@ 14,7 14,7 @@ EOF
)"
fi
-if [ -z "${DISCOURSE_LOCALE}" ]; then
+if [ -z "${DISCOURSE_LOCALE:-}" ]; then
DISCOURSE_DEFAULT_LOCALE="# DISCOURSE_DEFAULT_LOCALE: en"
else
DISCOURSE_DEFAULT_LOCALE="DISCOURSE_DEFAULT_LOCALE: ${DISCOURSE_LOCALE}"
@@ 25,7 25,7 @@ while IFS='' read -r cmd;
do
HOOK_COMMANDS="$(cat <<EOF
${HOOK_COMMANDS}
- - ${cmd}
+ - ${cmd}
EOF
)"
done <<EOF
@@ 139,10 139,11 @@ hooks:
${HOOK_COMMANDS}
## Any custom commands to run after building
run:
- - exec: echo "Beginning of custom commands"
+- exec: echo "Beginning of custom commands"
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
#- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- - exec: echo "End of custom commands"
+${AFTER_BUILD_COMMANDS}
+- exec: echo "End of custom commands"
EOF
)"
M type/__evilham_discourse/man.rst => type/__evilham_discourse/man.rst +41 -4
@@ 62,6 62,18 @@ smtp-port
OPTIONAL MULTIPLE PARAMETERS
----------------------------
+after-build-command
+ Custom commands that will be added to the app.yml file towards the end in
+ the after-build hooks.
+ Mainly use for things like templates, see examples for details.
+
+custom-commands
+ Custom commands that will be added to app.yml file as a line of code to be
+ executed.
+ For official plugins there is a helper argument `--official-plugin` which
+ appends the necessary commands to this variable.
+ This can be useful to install unofficial plugins.
+
developer-email
An email that will be allowed to register an admin account from the web
interface.
@@ 69,9 81,12 @@ developer-email
If it is set though, you will have to list `--admin-email` here too if you
want it to be able to register an admin account.
-custom-commands
- Custom commands that will be added to app.yml file as a line of code to be
- executed. Mainly use for adding plugins for discourse.
+official-plugin
+ An discourse official plugin available at
+ 'https://github.com/discourse/discourse-${plugin}.git'
+ This will append as many commands to `--custom-commands` as necessary.
+ The argument can be either passed multiple times or as a space-separated
+ list of plugins.
EXAMPLES
--------
@@ 83,7 98,29 @@ EXAMPLES
--admin-email 'info@exo.cat' \
--smtp-host 'smtp.exo.cat' \
--smtp-user 'discourse@exo.cat' \
- --smtp-pass 'WeNeedGoodSecurity'
+ --smtp-pass 'WeNeedGoodSecurity' \
+ --official-plugin "calendar reactions spoiler-alert templates math bbb docs checklist footnote" \
+ --custom-command "git clone https://github.com/jonmbake/discourse-ldap-auth.git" \
+ --after-build-command "$(cat <<EOF
+ - file:
+ path: /tmp/discotoc.yml
+ contents: |
+ DiscoTOC:
+ url: https://github.com/discourse/DiscoTOC.git
+ add_to_all_themes: true
+ - file:
+ path: /tmp/jitsi.yml
+ contents: |
+ jitsi:
+ url: https://github.com/discourse/discourse-jitsi.git
+ add_to_all_themes: true
+ - exec:
+ cd: \$home
+ cmd: su discourse -c 'bundle exec rake themes:install < /tmp/discotoc.yml'
+ cmd: su discourse -c 'bundle exec rake themes:install < /tmp/jitsi.yml'
+ EOF
+ )"
+
SEE ALSO
M type/__evilham_discourse/manifest => type/__evilham_discourse/manifest +29 -6
@@ 1,4 1,4 @@
-#!/bin/sh -e
+#!/bin/sh -eu
os="$(cat "${__global}/explorer/os")"
case "${os}" in
@@ 48,10 48,14 @@ for pkg in sudo curl; do
__package "${pkg}"
done
-if [ ! -f "${__object}/parameter/use-upstream-docker" ]; then
+if [ -f "${__object}/parameter/use-upstream-docker" ]; then
+ # Use upstream's docker
+ __docker
+ export require="${require:-} __docker"
+else
# Use OS' docker
__package "docker.io"
- export require="${require} __package/docker.io"
+ export require="${require:-} __package/docker.io"
fi
USER="discourse"
@@ 68,16 72,35 @@ __user "${USER}" --uid 1000 --gid 1000 --system \
--comment "Discourse user"
export require="${require} __user/${USER}"
-VERSION="v3.0.1"
+VERSION="v3.0.3"
# Official installation
DISCOURSE_REPO="https://github.com/discourse/discourse_docker.git"
__git "${DISCOURSE_DIR}" --source "${DISCOURSE_REPO}" \
--owner "${USER}" --group "${GROUP}" \
- --branch "master" # TODO: Fix
+ --branch "main"
export require="${require} __git/${DISCOURSE_DIR}"
-CUSTOM_COMMANDS="$(cat "${__object}/parameter/custom_commands" || true)"
+OFFICIAL_PLUGINS=""
+if [ -f "${__object}/parameter/official-plugin" ]; then
+ OFFICIAL_PLUGINS="$(cat "${__object}/parameter/official-plugin")"
+fi
+CUSTOM_COMMANDS=""
+if [ -f "${__object}/parameter/custom-command" ]; then
+ CUSTOM_COMMANDS="$(cat "${__object}/parameter/custom-command")"
+fi
+AFTER_BUILD_COMMANDS=""
+if [ -f "${__object}/parameter/after-build-command" ]; then
+ AFTER_BUILD_COMMANDS="$(cat "${__object}/parameter/after-build-command")"
+fi
+
+for plugin in ${OFFICIAL_PLUGINS:-}; do
+ CUSTOM_COMMANDS="$(cat <<EOF
+git clone 'https://github.com/discourse/discourse-${plugin}.git'
+${CUSTOM_COMMANDS:-}
+EOF
+)"
+done
# Add upstream config for easy comparison
__file "${CONFIG_FILE}.orig" --source "${__type}/files/standalone.yml.orig"
A type/__evilham_discourse/parameter/default/after-build-command => type/__evilham_discourse/parameter/default/after-build-command +0 -0
A type/__evilham_discourse/parameter/default/custom-command => type/__evilham_discourse/parameter/default/custom-command +0 -0
A type/__evilham_discourse/parameter/default/official-plugin => type/__evilham_discourse/parameter/default/official-plugin +0 -0
M type/__evilham_discourse/parameter/optional_multiple => type/__evilham_discourse/parameter/optional_multiple +3 -1
@@ 1,2 1,4 @@
developer-email
-custom_commands
+official-plugin
+custom-command
+after-build-command