Skip to content

Automatically deploy FoundryVTT via Docker, Ansible, and Terraform to Oracle Cloud Free Tier

License

Notifications You must be signed in to change notification settings

afwolfe/terraform-foundryvtt-oci-free-tier

Repository files navigation

terraform-foundryvtt-oci-free-tier

Introduction

This Terraform module provisions 1 OCI instance using Oracle Cloud's Always Free services: https://www.oracle.com/cloud/free/. By default, the resources will be created in the us-ashburn-1 region.

The repo also contains a series of Ansible playbooks to help automate configuring:

Prerequisites

  • An Oracle Cloud Free Tier account
  • A valid license key for FoundryVTT
  • Ansible
  • Terraform/OpenTofu

Variables

Execution

Creating the Infrastructure

terraform init
cp terraform.tfvars.dist terraform.tfvars # and fill it with your own data
terraform plan
terraform apply

Configuring the Instance

  1. After creating the infrastructure, you will now have a new OCI instance and some files will have been generated, including an Ansible inventory with the instance's IP address.
  2. Go to the ansible folder with: cd ansible
  3. Install required Ansible packages with: ansible-galaxy install -r requirements.yml
  4. Install Docker: ansible-playbook -i inventory install-docker.yml
  5. Configure the host_vars
    1. cp host_vars/fvtt-instance-1.yml.dist host_vars/fvtt-instance-1.yml
    2. Modify the file with your email, DuckDNS domain, and DuckDNS API key
    3. Set any environment variables for Foundry. See felddy/foundryvtt-docker for more details on configuration and options.
  6. Configure certificates with Certbot and DuckDNS: ansible-playbook -i inventory certbot.yml
  7. Install and start Foundry: ansible-playbook -i inventory foundry.yml
  8. (Optional) Enable unattended-upgrades (for APT): ansible-playbook -i inventory unattended-upgrades.yml

Updating your Foundry configuration

The docker-compose.yml is generated by the Ansible playbook.

You should make any changes to the environment variables in the list and rerun the playbook with: ansible-playbook -i inventory foundry.yml

This will also automatically restart your Foundry instance.