setup_lxd.sh 985 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # Copyright 2022 Felix Freeman <libsys@hacktivista.org>
  3. #
  4. # This script is licensed under the 'MIT No Attribution' license terms. I don't
  5. # want attribution nor exclusive rights over it, but I'd love that you free your
  6. # software too.
  7. # Environment variables
  8. #
  9. # - CONTAINER: HAWESE lxd container name
  10. CONTAINER=${CONTAINER:-hawese}
  11. lxc launch images:debian/11 "$CONTAINER"
  12. printf "uid %s 1000\ngid %s 33" "$(id -u)" "$(id -g)" |
  13. lxc config set "$CONTAINER" raw.idmap -
  14. lxc config device add "$CONTAINER" src disk source="$(pwd)" path="/opt/hawese"
  15. lxc restart "$CONTAINER"
  16. sleep 2
  17. lxc exec "$CONTAINER" -- \
  18. env HAWESE_ENV="$HAWESE_ENV" \
  19. env ENDPOINT="$ENDPOINT" \
  20. env CORS_ENDPOINT="$CORS_ENDPOINT" \
  21. env PROJECTS="$PROJECTS" \
  22. env WALLET_ADD_FUNDS_URL="$WALLET_ADD_FUNDS_URL" \
  23. env PAYMENT_RETURN_URL="$PAYMENT_RETURN_URL" \
  24. env CERTBOT_EMAIL="$CERTBOT_EMAIL" \
  25. env XDEBUG_CLIENT_HOST="${XDEBUG_CLIENT_HOST:-_gateway.lxd}" \
  26. sh -c /opt/hawese/setup/setup.sh