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.

33 lines
1.7 KiB

  1. #!/usr/bin/env bash
  2. set -o errexit
  3. if [[ -z "${DOCCANO_LOCATION}" ]]; then echo "Missing DOCCANO_LOCATION environment variable" >&2; exit 1; fi
  4. if [[ -z "${DOCCANO_RESOURCE_GROUP}" ]]; then echo "Missing DOCCANO_LOCATION environment variable" >&2; exit 1; fi
  5. if [[ -z "${DOCCANO_APP_NAME}" ]]; then echo "Missing DOCCANO_APP_NAME environment variable" >&2; exit 1; fi
  6. if [[ -z "${DOCCANO_SECRET_KEY}" ]]; then echo "Missing DOCCANO_SECRET_KEY environment variable" >&2; exit 1; fi
  7. if [[ -z "${DOCCANO_ADMIN_USERNAME}" ]]; then echo "Missing DOCCANO_ADMIN_USERNAME environment variable" >&2; exit 1; fi
  8. if [[ -z "${DOCCANO_ADMIN_CONTACT_EMAIL}" ]]; then echo "Missing DOCCANO_ADMIN_CONTACT_EMAIL environment variable" >&2; exit 1; fi
  9. if [[ -z "${DOCCANO_ADMIN_PASSWORD}" ]]; then echo "Missing DOCCANO_ADMIN_PASSWORD environment variable" >&2; exit 1; fi
  10. if ! az account show >/dev/null; then echo "Must be logged into Azure" >&2; exit 2; fi
  11. set -o nounset
  12. az group create \
  13. --location "${DOCCANO_LOCATION}" \
  14. --name "${DOCCANO_RESOURCE_GROUP}"
  15. az group deployment create \
  16. --resource-group "${DOCCANO_RESOURCE_GROUP}" \
  17. --name "azuredeploy$1" \
  18. --parameters \
  19. appName="${DOCCANO_APP_NAME}" \
  20. secretKey="${DOCCANO_SECRET_KEY}" \
  21. adminUserName="${DOCCANO_ADMIN_USERNAME}" \
  22. adminContactEmail="${DOCCANO_ADMIN_CONTACT_EMAIL}" \
  23. adminPassword="${DOCCANO_ADMIN_PASSWORD}" \
  24. dockerImageName="${DOCKER_REGISTRY:-${DOCKER_USERNAME:-doccano}}/doccano:${1:-latest}" \
  25. dockerRegistry="${DOCKER_REGISTRY}" \
  26. dockerRegistryUserName="${DOCKER_USERNAME}" \
  27. dockerRegistryPassword="${DOCKER_PASSWORD}" \
  28. --template-file azuredeploy.json