provisioning tool for building opinionated architecture
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

52 lines
1.4 KiB

#!/bin/bash
### CHECK
function check() {
PREFIX="recipe:discourse:check"
container_exists "$CONTAINER" || return 1
container_running "$CONTAINER" || return 2
var_discourse_exists "$CONTAINER" || return 3
}
function var_discourse_exists() {
container="$1"
lxc exec "$container" -- test -d /var/discourse/containers
}
### INSTALL
function install() {
PREFIX="recipe:discourse:install"
: $PREFIX
launch_container "$CONTAINER" "-o nesting"
echo "initializing discourse ... "
lxc exec "$CONTAINER" -- bash <<EOF
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=\$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
\$(. /etc/os-release && echo "\$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
EOF
PREFIX="" echo "OK"
}
### MAIN
. "$MIAOU_BASEDIR/lib/init.sh"
arg1_required "$@"
readonly CONTAINER="$1"
check || (
install
check
)