- Install Requirements
- Copier
- install at least copier=v9.2.0
- Ansible
- Terraform
- Pre-commit
- Poetry
- Retrieve input data file
curl -o input.yml https://raw.githubusercontent.com/CorrelAid/directus_iac_template/main/input.yml.tmpl
- Edit values of input data file
See the file itself. Sensitive data will be stored in ansible vault and will not be stored in the answers.yml of copier. Be aware however, that they are still hardcoded in the input data file you edited. Best practice is to delete this file after you are done.
- Run copier
copier copy --data-file input.yml --trust gh:CorrelAid/directus_iac_template <folder name>
- cd into the resulting folder and set up pre-commit
git init
pre-commit install
- Create Repo in browser with name specified in input data, then and commit local files to new repo
git add .
git commit -m "init"
git remote add origin [email protected]:CorrelAid/<repo name>.git
git branch -M main
git push -u origin main
- Provide Terraform with the required tokens
Depends on how you run terraform. If your run it locally, set the environment variables:
# depends on which provider you chose
# export DIGITALOCEAN_TOKEN=token
export HCLOUD_TOKEN=token
export HETZNER_DNS_API_TOKEN=token
export GITHUB_TOKEN=token
- cd into /terraform folder and tun terraform
terraform init
terraform apply
-
Pull changes made through terraform
-
cd to root folder and run ansible
ansible-playbook ansible/playbook.yml
- cd into /python-tools and install poetry project
poetry install
The python-tools package contained in this folder provides some functionality to interact with the directus instances
poetry run python save_schema.py
poetry run python apply_schema.py