- This guide supports both AWS EC2 and Azure VM with Terraform.
# Local
# Clone repository
git clone https://github.com/Arata1202/WorkAdventure.git
cd WorkAdventure
# Install dependencies
make wa-initWhen using Azure, generate an SSH key first:
# Local
ssh-keygen -t ed25519 -C "workadventure" -f ~/.ssh/workadventure -N ""# Local
# Move to repository
cd WorkAdventure
cd terraform/aws # or terraform/azure
# Prepare and edit local values
cp terraform.tfvars.example terraform.tfvars
vi terraform.tfvars
# Create resources
terraform init
terraform plan
terraform applyFor Azure, set ssh_public_key in terraform.tfvars to the contents of ~/.ssh/workadventure.pub.
- Default for AWS is SSM.
# Local
# Configure AWS CLI credentials and region before connecting
aws configure
# Connect to AWS EC2 via SSM
aws ssm start-session --target <EC2_INSTANCE_ID>
# Switch to ubuntu user
sudo -iu ubuntu- Default for Azure is SSH (Azure Bastion can be costly).
Host workadventure
HostName <VM_PUBLIC_IPV4_ADDRESS>
User ubuntu
IdentityFile ~/.ssh/workadventure# Local
# Connect to VM via SSH
ssh workadventure# VM
# Clone repository
git clone https://github.com/Arata1202/WorkAdventure.git
cd WorkAdventure
# Set up Ubuntu
./ubuntu/setup.sh
# Install dependencies
make wa-init- https://github.com/workadventure/workadventure/blob/develop/contrib/docker/README.md
- https://github.com/workadventure/workadventure/releases
# VM
# Move to repository
cd WorkAdventure
# Remove existing .env file
rm -f .env
# Generate random strings for .env values
openssl rand -hex 16
openssl rand -hex 32
# Prepare and edit .env file
cp .env.example .env
vi .env# Required
SECRET_KEY=<UNIQUE_RANDOM_64_HEX>
DOMAIN=<YOUR_FQDN>
MAP_STORAGE_AUTHENTICATION_TOKEN=<UNIQUE_RANDOM_64_HEX>
MAP_STORAGE_AUTHENTICATION_USER=admin
MAP_STORAGE_AUTHENTICATION_PASSWORD=<UNIQUE_RANDOM_32_HEX>- Add an A record in your DNS provider to point your domain to the VM public IP
| Record Name | Type | Value | TTL |
|---|---|---|---|
| <YOUR_FQDN> | A | <VM_PUBLIC_IPV4_ADDRESS> | 300 |
# VM
# Move to repository
cd WorkAdventure
# Encrypt .env file
make encrypt
# Start services
make upBack up .env.keys securely. It is required to decrypt .env and must not be committed.
# VM
# Move to repository
cd WorkAdventure
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
TZ=Asia/Tokyo
# Optional
ACME_EMAIL=<EMAIL_ADDRESS>
ENABLE_TELEMETRY=true
SECURITY_EMAIL=<EMAIL_ADDRESS>
FEATURE_FLAG_BROADCAST_AREAS=true# Local
# Move to repository
cd WorkAdventure
# Prepare .env file
cp maps/.env.example maps/.env
# Preview the map locally
make wa-dev
# Edit the map file (maps/office.tmj) using Tiled
# Upload the map
make wa-upload
Please enter your Map storage URL: https://<YOUR_FQDN>/map-storage/
Please enter your API Key: <MAP_STORAGE_AUTHENTICATION_TOKEN>
Upload directory: maps# VM
# Move to repository
cd WorkAdventure
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
START_ROOM_URL=/~/maps/office.wam
MAP_STORAGE_ENABLE_BEARER_AUTHENTICATION=true- Access the uploaded map
https://<YOUR_FQDN>
- Configure GitHub Actions secrets for
upload-wa-maps.yml
# Required
UPLOAD_MODE=MAP_STORAGE
MAP_STORAGE_URL=https://<YOUR_FQDN>/map-storage/
MAP_STORAGE_API_KEY=<MAP_STORAGE_AUTHENTICATION_TOKEN>
UPLOAD_DIRECTORY=maps- Configure GitHub Actions secrets for
deploy.yml
Note
The deploy.yml workflow requires direct SSH access and is not compatible with the default AWS SSM setup.
# Required
SSH_HOST=<VM_PUBLIC_IPV4_ADDRESS>
SSH_USERNAME=ubuntu
SSH_PRIVATE_KEY=<SSH_PRIVATE_KEY>- Run the
deployworkflow manually from GitHub Actions to apply repository changes to the VM
For Google OIDC, see Set Up Google OIDC.
- Access Microsoft Azure portal
- Go to Microsoft Entra ID -> App registrations
- Create a new registration
- Name: WorkAdventure
- Supported account types: Accounts in this organizational directory only
- Platform: Web
- Redirect URI:
https://<YOUR_FQDN>/openid-callback
- Open Authentication and add another Web redirect URI
- Redirect URI:
https://matrix.<YOUR_FQDN>/_synapse/client/oidc/callback
- Redirect URI:
- Open Certificates & secrets and create a new client secret
- Open Token configuration and add the
emailoptional claim- Token type: ID
- Claim:
email - Keep
Turn on the Microsoft Graph email permissionenabled
- Save the following values
- Application (client) ID
- Directory (tenant) ID
- Client secret Value (not the Secret ID)
# VM
# Move to repository
cd WorkAdventure
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
OPENID_IDP_ID=microsoft
OPENID_IDP_NAME=Microsoft
OPENID_CLIENT_ID=<APPLICATION_CLIENT_ID>
OPENID_CLIENT_SECRET=<CLIENT_SECRET_VALUE>
OPENID_CLIENT_ISSUER=https://login.microsoftonline.com/<DIRECTORY_TENANT_ID>/v2.0
OPENID_LOGOUT_REDIRECT_URL=https://<YOUR_FQDN>
OPENID_USERNAME_CLAIM=preferred_username
OPENID_SCOPE=openid email profile
# Optional
DISABLE_ANONYMOUS=true# VM
# Move to repository
cd WorkAdventure
# Generate random strings for .env values
openssl rand -hex 32
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
LIVEKIT_HOST=https://livekit.<YOUR_FQDN>
LIVEKIT_API_KEY=<UNIQUE_RANDOM_64_HEX>
LIVEKIT_API_SECRET=<UNIQUE_RANDOM_64_HEX>
# Optional
MAX_PER_GROUP=<NUMBER>- Add an A record in your DNS provider to point your domain to the VM public IP
| Record Name | Type | Value | TTL |
|---|---|---|---|
| livekit.<YOUR_FQDN> | A | <VM_PUBLIC_IPV4_ADDRESS> | 300 |
# VM
# Move to repository
cd WorkAdventure
# Generate random strings for .env values
openssl rand -hex 32
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
TURN_SERVER=turn:<YOUR_FQDN>:3478,turns:<YOUR_FQDN>:5349
TURN_STATIC_AUTH_SECRET=<UNIQUE_RANDOM_64_HEX>
STUN_SERVER=stun:stun.l.google.com:19302# VM
# Move to repository
cd WorkAdventure
# Generate random strings for .env values
openssl rand -hex 16
openssl rand -hex 32
# Edit .env file
make decrypt
vi .env
make encrypt
# Prepare Synapse data volume
npx dotenvx run -- docker compose run --rm --user root --entrypoint sh synapse -lc 'chown -R 991:991 /data'
# Restart server
make up-f
# Create a Matrix Admin User
npx dotenvx run -- sh -lc 'docker compose exec synapse register_new_matrix_user -c /data/homeserver.yaml -u "$MATRIX_ADMIN_USER" -p "$MATRIX_ADMIN_PASSWORD" --admin http://localhost:8008'# Required
MATRIX_API_URI=http://synapse:8008/
MATRIX_DOMAIN=matrix.<YOUR_FQDN>
MATRIX_PUBLIC_URI=https://matrix.<YOUR_FQDN>
MATRIX_ADMIN_USER=admin
MATRIX_ADMIN_PASSWORD=<UNIQUE_RANDOM_32_HEX>
MATRIX_REGISTRATION_SHARED_SECRET=<UNIQUE_RANDOM_64_HEX>
MATRIX_MACAROON_SECRET_KEY=<UNIQUE_RANDOM_64_HEX>
MATRIX_FORM_SECRET=<UNIQUE_RANDOM_64_HEX>
POSTGRES_DB=synapse
POSTGRES_USER=admin
POSTGRES_PASSWORD=<UNIQUE_RANDOM_32_HEX>- Add an A record in your DNS provider to point your domain to the VM public IP
| Record Name | Type | Value | TTL |
|---|---|---|---|
| matrix.<YOUR_FQDN> | A | <VM_PUBLIC_IPV4_ADDRESS> | 300 |
- Access Element Web:
https://element.io - Click Sign in -> Open Element web
- Click Sign in
- Enter your Matrix homeserver URL:
https://matrix.<YOUR_FQDN> - Click Continue
- Enter your Matrix credentials:
- Username: admin
- Password: <MATRIX_ADMIN_PASSWORD>
- Click Sign in
- After successful authentication, you will be redirected back to Element and logged in
# VM
# Move to repository
cd WorkAdventure
# Generate random strings for .env values
openssl rand -hex 32
# Edit .env file
make decrypt
vi .env
make encrypt
# Restart server
make up-f# Required
LIVEKIT_RECORDING_S3_ENDPOINT=http://rustfs-livekit:9000
LIVEKIT_RECORDING_S3_CDN_ENDPOINT=https://cdn-livekit.<YOUR_FQDN>
LIVEKIT_RECORDING_S3_ACCESS_KEY=<UNIQUE_RANDOM_64_HEX>
LIVEKIT_RECORDING_S3_SECRET_KEY=<UNIQUE_RANDOM_64_HEX>
LIVEKIT_RECORDING_S3_BUCKET=livekit-recordings
LIVEKIT_RECORDING_S3_REGION=ap-northeast-1
MAX_USERS_FOR_WEBRTC=0- Add A records in your DNS provider to point your domain to the VM public IP
| Record Name | Type | Value | TTL |
|---|---|---|---|
| cdn-livekit.<YOUR_FQDN> | A | <VM_PUBLIC_IPV4_ADDRESS> | 300 |
| rustfs-livekit.<YOUR_FQDN> | A | <VM_PUBLIC_IPV4_ADDRESS> | 300 |
- Access RustFS Console:
https://rustfs-livekit.<YOUR_FQDN> - Enter your RustFS credentials:
- Username: <LIVEKIT_RECORDING_S3_ACCESS_KEY>
- Password: <LIVEKIT_RECORDING_S3_SECRET_KEY>
- Click Sign in
- After successful authentication, you will be logged in