So, you want to host Foundry in Azure? Let's do it!
Azure can accomodate a friendly budget for most people. If you need a development environment, you could host Foundry completely for free (with a license of course!). If you are a once-a-week type of gamer, you could expect costs of about $5-$10 a month. If you need something more robust, you could expect to spend about $15-$20. It's completely up to you!
Great shout-out to Felddy for creating the docker container for Foundry. I made a couple of tweaks to the image to make it compatible within Azure. We'll be using my docker image located here:
Name | Description | URL |
---|---|---|
Docker Image | Prebuilt Image | armyguy255a/foundryvtt:latest |
Git Repository | Manual Build | URL |
While docker images remain consistent, compose files may change from time-to-time. Therefore, please use the following compose file in this wiki to run within Azure. It's important that Foundry runs on port 80 in Azure. The Application Service or Container Instance will take care of handling all the SSL requirements for you.
No need to worry about SSL if you are on a paid tier. If you care about encryption, be sure to choose the B1 subscription plan. It comes standard. If you want to implement a custom domain name with a custom SSL certificate, that's not a problem either. You can pick up a cheap .app domain name from GoDaddy that comes with a free SSL certificate for about $19. The B1 service plan will allow you to use a cert from GoDaddy and register your custom domain name.
Nobody can deny that running Foundry on your favorite laptop at home is pretty sweet. But, imagine telling your friends that you're running it in the cloud without the virtual machine. That's right... Each of these implemetations takes advantage of a concept known as Platform as a Service. This is the cheapest way to implement anything in the cloud. Let's get started!
First, ensure you have an active Azure Subscription. You can get one here: Azure
All you need for this implementation is an F1 or B1 App Service Plan and an App Service.
version: "3.8"
services:
foundry:
image: armyguy255a/foundryvtt:latest
hostname: YourAppName.azurewebsites.net
init: true
restart: always
volumes:
- ${WEBAPP_STORAGE_HOME}/Data:/data
environment:
- FOUNDRY_PASSWORD=YourFoundryPassword
- FOUNDRY_USERNAME=YourFoundryUsername
- FOUNDRY_ADMIN_KEY=YourFoundryVTTAdminPassword
- CONTAINER_CACHE=/data/cache
- CONTAINER_PRESERVE_OWNER=^.*data.*$
- CONTAINER_PATCHES=/data/patches
- CONTAINER_PRESERVE_CONFIG=true
- CONTAINER_VERBOSE=true
Note: I appologize for not populating this section. I found some serious problems when deploying via the CLI and it required significant changes to make operational. I will only post instructions for manually deploying. You CAN deploy this via CI/CD if you wanted to. This is beyond the scope of this wiki entry.
Ensure you select the .yml file that is suits your budget. Remember, you get what you pay for!
Navigate to Azure
Click on "+ Create a Resource"
Create a Web App
Basics Tab
a. Recommend creating a new Resource Group called FoundryVTT
b. Name: Use a unique name
c. Publish: Docker Container
d. Operating System: Linux
e. Region: Choose a location closest to you
f. App Service Plan: Choose the Tier that suits your lifestyle. You can always scale this up or down.
Docker Tab
a. Options: Docker Compose (Preview)
b. Image Source: Docker Hub
c. Access Type: Public
d. Configuration File: Select your docker-compose file
Review Tab
a. Ensure you selected the correct App Service Plan tier. F1 is Free. I recommend B1 (~$20/month)
b. Click Review + Create
c. Click Create
Post Deployment
a. Click Go To Resource or navigate to your App Service you named in the Basic's Tab
b. Click on the Configuration blade
c. Set the WEBSITES_ENABLE_APP_SERVICE_STORAGE application setting to true
Note: This will enable persistent storage across reboots on the app service.
d. Click on the Overview blade
e. Restart the App Service
f. Navigate to your application using the URL provided in the Overview blade
Note: Your installation can take from 5-10 minutes to initialize. Please be patient as your app service downloads the docker image and initializes
The great thing about the cloud is you only pay for what you use. That said, Microsoft will continue to bill you even if your app service is not used. Be sure to scale your App Service down when you're finished with your gaming session. Since this IS the cloud, you could just delete the app service alltogether IF you're using backend storage. See below on how to set that up.
I prefer to use a storage account to house all of my data. You should too. It's cheap and a great way to make sure you never lose your hardcore, custom-built campaign. Here's what you need to do!
Create a Storage Account
Create a File Share
Modify App Service Configuration
Update the docker-compose Configuration
volumes:
- ${WEBAPP_STORAGE_HOME}/Data:/data
AFTER
volumes:
- fvttbackend:/data
Confirmation
You can verify that everything is working correctly if you navigate back to your Storage Account and open your file share. You should have 4 folders in the file share directory when the app service is restarted.
I recommend using the Storage Account option in this case. Basically, you can use a tool like Azure Storage Explorer to drag-and-drop your local Foundry data to the Storage Account. Only the folders listed in the aforementioned Confirmation section are important.
Troubleshooting can be a pain. Luckily, there are only a few things that can go wrong here.
This is pretty common, and frustrating. Use these steps to help troubleshoot.
Scan through the logs and find your issue/resolution below.