Create a Virtual Office with WorkAdventure on Your Server
Tags: workadventure
Published: 2023-05-24 09:32:38

---
title: Create a Virtual Office with WorkAdventure on Your Server
published: true
description: Step-by-step guide to install and set up WorkAdventure on your server
tags: WorkAdventure
cover_image: https://yuki777.github.io/public-images/images/work-adventure.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-24 08:13 +0000
---

## About WorkAdventure

WorkAdventure is a collaborative web application presented in the form of a 16-bit RPG video game. This innovative approach to remote collaboration offers a unique, engaging, and virtual office-like environment.

For more information, visit the [Official Website](https://workadventu.re/) or check out the project's [GitHub page.](https://github.com/thecodingmachine/workadventure)

## Motivation

Installing WorkAdventure can seem a bit challenging at first. I have written this guide to make the process simpler for others. If it can assist even one person, I will be satisfied.

## Installation Guide

### Prerequisites

Before we begin, it's worth mentioning that the steps in this guide have been tested and confirmed to work on a server with the following specifications:

- Distribution: Canonical, Ubuntu Server Pro, 22.04 LTS, amd64 jammy image built on 2023-05-16
- CPU Architecture: x86_64 (This guide does not support ARM-based CPUs)
- AMI: ami-0702b27a97d5bbcba
- Instance type: t2.medium (4GB Memory)
- Storage: 20GB

Please note that while the steps should generally work on servers with different specifications, this guide cannot guarantee the same results for other configurations or CPU architectures. Always ensure your server meets the requirements of the software you are installing.

Set your environment with the following variables:

```bash
version=v1.15.11
domain=your.example.com
```

### Step 1: Install Docker

We'll be using Docker for our installation. If you haven't installed Docker on your Ubuntu server yet, you can do so by following the instructions available on [Docker's official documentation](https://docs.docker.com/engine/install/ubuntu/).

Alternatively, you can use the following script to install Docker:

```bash
$(cat << 'EOF' > ~/install-docker.sh

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
sudo docker run hello-world

EOF
)

/bin/bash ~/install-docker.sh
```

### Step 2: Clone WorkAdventure Repository and Prepare Deployment Files

The next step is to clone the WorkAdventure repository and prepare the necessary deployment files. Use the following commands to achieve this:

```bash
cd

$(cat << EOF > ~/copy-deployment-files

mkdir -p ~/git
cd ~/git
sudo rm -fr ~/git/workadventure
git clone https://github.com/thecodingmachine/workadventure.git -b $version
cd ~/git/workadventure/contrib/docker
cp .env.prod.template .env
cp docker-compose.prod.yaml docker-compose.yaml

EOF
)

/bin/bash ~/copy-deployment-files
```

### Step 3: Configure Your Environment

Once Docker is installed and the repository is cloned, configure your environment using the following script:

```bash
cd

$(cat << EOF > ~/configure-your-environment.sh

cd ~/git/workadventure/contrib/docker
sed -i 's/^SECRET_KEY=$/SECRET_KEY=foobar/' .env
sed -i "s/^DOMAIN=workadventure.localhost$/DOMAIN=${domain}/" .env
sed -i "s/workadventure.localhost/${domain}/" .env
sed -i "s/^VERSION=master$/VERSION=${version}/" .env
sed -i "s/^MAP_STORAGE_AUTHENTICATION_USER=$/MAP_STORAGE_AUTHENTICATION_USER=map-storage-user/" .env
sed -i "s/^MAP_STORAGE_AUTHENTICATION_PASSWORD=$/MAP_STORAGE_AUTHENTICATION_PASSWORD=map-storage-pass/" .env
sed -i 's/^ADMIN_API_URL=$/#ADMIN_API_URL=/' .env
echo PLAY_HOST=play.$domain >> .env

EOF
)

/bin/bash ~/configure-your-environment.sh

sed -i '/PROMETHEUS_AUTHORIZATION_TOKEN: "$PROMETHEUS_AUTHORIZATION_TOKEN"/a \
      AUTHENTICATION_STRATEGY: "Basic"\
      AUTHENTICATION_TOKEN: "token"\
      AUTHENTICATION_USER: "user"\
      AUTHENTICATION_PASSWORD: "pass"' ~/git/workadventure/contrib/docker/docker-compose.yaml

```

### Step 4: Launch the WorkAdventure Environment

With your environment configured, start the WorkAdventure environment with the following command:

```bash
cd ~/git/workadventure/contrib/docker && sudo docker-compose up
```

### Step 5: Create and Upload Your First Map

WorkAdventure operates with maps that define the virtual space. Here is how you can create your first map and upload it to your server:

```bash
# Delete old repository and clone repository
mkdir -p ~/git
cd ~/git
rm -fr workadventure-map-starter-kit
git clone https://github.com/thecodingmachine/workadventure-map-starter-kit.git -b v3.3.3
cd ~/git/workadventure-map-starter-kit

# volta pin node@20 # Use Node.js v20 via volta
npm ci

# Build
npm run build
mv dist map
zip -r map.zip map
cp map.zip ~/Desktop
```

## Testing Your Installation

Now that you have installed WorkAdventure and uploaded your first map, it's time to test it out. Here are some useful links:


- Upload map
  - `https://map-storage.YOUR.EXAMPLE.COM/`
  - user : pass
  - Directory: `/`
- View maps
  - `https://map-storage.YOUR.EXAMPLE.COM/maps`
- Play
  - `https://play.YOUR.EXAMPLE.COM/_/global/map-storage.YOUR.EXAMPLE.COM/map/map.tmj`

## Future Work

- Integrate Jitsi for video conferencing capabilities
- Set the correct timezone for server operations


Remember, installing and setting up WorkAdventure is just the beginning of the journey. Have fun exploring and creating your own unique virtual office!