Added detailed setup instructions

This commit is contained in:
Thomas Basler 2022-02-28 19:00:34 +01:00
parent 22d0327428
commit 16c880177e
3 changed files with 174 additions and 2 deletions

View File

@ -1,8 +1,76 @@
# WorkAdventure XCE for Binary Kitchen
## Install Docker
### Set up the repository
1. Update the `apt` package index and install packages to allow `apt` to use a repository over HTTPS:
```
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
```
2. Add Dockers official GPG key:
`curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg`
3. Use the following command to set up the stable repository. To add the nightly or test repository, add the word `nightly` or `test` (or both) after the word `stable` in the commands below. Learn about nightly and test channels.
```
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
### Install Docker Engine
This procedure works for Debian on `x86_64` / `amd64`, `armhf`, `arm64`, and Raspbian.
Update the `apt` package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
```
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose
```
## Install other requirements
```
sudo apt-get install nginx git
```
## Create user and directories
```
sudo useradd -M workadventure
sudo adduser workadventure docker
sudo mkdir /opt/workadventure
sudo chown workadventure.workadventure /opt/workadventure
```
## Get workadventure source
Please make sure to edit the `.env` file to match your hostnames and Jitsi Servers before startup.
```
cd /opt/workadventure
sudo -u workadventure git clone --recurse-submodules https://git.binary-kitchen.de/noby/workadventure-xce.git source
cd source
docker-compose up
```
## Install and start systemd service
```
sudo cp /opt/workadventure/source/dist/workadventure.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable workadventure
sudo systemctl start workadventure
```
## Install nginx vhost
```
sudo cp /opt/workadventure/source/dist/vhost /etc/nginx/sites-available/workadventure
sudo ln -s /etc/nginx/sites-available/workadventure /etc/nginx/sites-enabled/workadventure
```
Make sure to edit the `/etc/nginx/sites-enabled/workadventure` file and replace all occurances of
`{{ workadventure_domain }}` with your own domain. You also have to make sure that you specify the
correct paths to your certificates. You need a certificate for all the subdomains shown in the config.
If everything is done, restart nginx:
```
sudo systemctl restart nginx
```

76
dist/vhost vendored Normal file
View File

@ -0,0 +1,76 @@
server {
listen 80;
listen [::]:80;
server_name {{ workadventure_domain }} play.{{ workadventure_domain }} pusher.{{ workadventure_domain }} uploader.{{ workadventure_domain }};
location /.well-known/acme-challenge {
default_type "text/plain";
alias /var/www/acme-challenge;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ workadventure_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ workadventure_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ workadventure_domain }}.crt;
location / {
root /opt/workadventure/source/landing/dist;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name play.{{ workadventure_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ workadventure_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ workadventure_domain }}.crt;
location / {
root /opt/workadventure/source/src/front/dist;
try_files $uri uri/ /index.html?$args;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name pusher.{{ workadventure_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ workadventure_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ workadventure_domain }}.crt;
location / {
proxy_pass http://localhost:8002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name uploader.{{ workadventure_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ workadventure_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ workadventure_domain }}.crt;
location / {
proxy_pass http://localhost:8005;
}
}

28
dist/workadventure.service vendored Normal file
View File

@ -0,0 +1,28 @@
[Unit]
Description=WorkAdventure service using docker compose
Requires=docker.service
After=docker.service
Before=nginx.service
[Service]
Type=simple
User=workadventure
Group=workadventure
Restart=always
TimeoutStartSec=1200
WorkingDirectory=/opt/workadventure/source/
# Make sure no old containers are running
ExecStartPre=/usr/bin/docker-compose down -v
# Compose up
ExecStart=/usr/bin/docker-compose up
# Compose down, remove containers and volumes
ExecStop=/usr/bin/docker-compose down -v
[Install]
WantedBy=multi-user.target