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

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. #!/bin/bash
  2. ### CHECK
  3. function check() {
  4. PREFIX="recipe:discourse:check"
  5. container_exists "$CONTAINER" || return 1
  6. container_running "$CONTAINER" || return 2
  7. var_discourse_exists "$CONTAINER" || return 3
  8. }
  9. function var_discourse_exists() {
  10. container="$1"
  11. lxc exec "$container" -- test -d /var/discourse/containers
  12. }
  13. ### INSTALL
  14. function install() {
  15. PREFIX="recipe:discourse:install"
  16. : $PREFIX
  17. launch_container "$CONTAINER" "-o nesting"
  18. echo "initializing discourse ... "
  19. lxc exec "$CONTAINER" -- bash <<EOF
  20. install -m 0755 -d /etc/apt/keyrings
  21. curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
  22. chmod a+r /etc/apt/keyrings/docker.asc
  23. echo \
  24. "deb [arch=\$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  25. \$(. /etc/os-release && echo "\$VERSION_CODENAME") stable" | \
  26. tee /etc/apt/sources.list.d/docker.list > /dev/null
  27. apt update
  28. apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  29. mkdir /var/discourse
  30. git clone https://github.com/discourse/discourse_docker.git /var/discourse
  31. EOF
  32. PREFIX="" echo "OK"
  33. }
  34. ### MAIN
  35. . "$MIAOU_BASEDIR/lib/init.sh"
  36. arg1_required "$@"
  37. readonly CONTAINER="$1"
  38. check || (
  39. install
  40. check
  41. )