Skip to content

Commit

Permalink
Add scripts for running, updating, restarting, and stopping Docker im…
Browse files Browse the repository at this point in the history
…age.

Add docker/README.md to explain the use of the Docker image scripts.
Update docs/RunningDockerImage.md with new repository location and
    updated notes on running.
  • Loading branch information
Misterblue committed Apr 24, 2021
1 parent e28c49c commit b38b693
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 13 deletions.
20 changes: 20 additions & 0 deletions docker/README.md
@@ -0,0 +1,20 @@
## Docker for Iamus Metaverse Server

The files here are for creating and running Iamus under Docker.

The `Dockerfile` is used to build the image with the `files` directory
holding the scripts that are copied into the image for its operation.
See the build action in `.github/workflows/docker-publish.yml` to see
the steps for building.

The other script files here are for starting, running, restarting, and
updating a running Iamus metaverse-server.
The naming pretty obvious.

To run Iamus with Docker,
read the information in `docs/RunningDockerImage.md`
for setup of the configuration files and MongoDB.
Then, on the server that has Docker and MongoDB installed,
clone the Iamus repository
and, from the directory with the created `config` directory,
execute `run-metaverse-server.sh` to start the server.
7 changes: 7 additions & 0 deletions docker/restart-metaverse-server.sh
@@ -0,0 +1,7 @@
echo "==== stopping metaverseserver"
docker stop metaverseserver
echo "==== removing old metaverseserver image"
docker rm metaverseserver
echo "==== starting metaverseserver"
./run-metaverse-server.sh

16 changes: 16 additions & 0 deletions docker/run-metaverse-server.sh
@@ -0,0 +1,16 @@
#! /bin/bash
# Start the metaverseserver with persistant data in local dir

BASE=$(pwd)
cd "${BASE}"

DVERSION=latest

docker run -d \
--name=metaverseserver \
--restart=unless-stopped \
-p 9400:9400 \
-e IAMUS_CONFIG_FILE=/home/cadia/config/iamus.json \
--network="host" \
--volume ${BASE}/config:/home/cadia/config \
ghcr.io/vircadia/iamus:${DVERSION}
7 changes: 7 additions & 0 deletions docker/stop-metaverse-server.sh
@@ -0,0 +1,7 @@
#! /bin/bash
# Stops the metaverse server and cleans up

echo "==== stopping metaverse-server"
docker stop metaverseserver
echo "==== removing old metaverse-server image"
docker rm metaverseserver
9 changes: 9 additions & 0 deletions docker/update-metaverse-server.sh
@@ -0,0 +1,9 @@
echo "==== fetching latest docker image for metaverseserver"
docker pull ghcr.io/vircadia/iamus:latest
echo "==== stopping metaverseserver"
docker stop metaverseserver
echo "==== removing old metaverseserver image"
docker rm metaverseserver
echo "==== starting metaverseserver"
./run-metaverse-server.sh

28 changes: 15 additions & 13 deletions docs/RunningDockerImage.md
Expand Up @@ -2,16 +2,14 @@

## Docker Image

A Docker image is made of the latest release.
As of 20200819, the Docker image is stored at
hub.docker.com with the name "misterblue/vircadia-metaverse-server".
Someday CI will be integrated with this project and then the image may move.
Iamus can be packaged and run as a Docker image.
As of 20210424, the latest Docker image is stored in the
Github Container Registry
with the name "ghcr.io/vircadia/iamus".

As of 20200819, there is an instance of the Docker image running
at `metaverse.bluestuff.org`. For a description of that instance,
refer to the [test setup] document.

To create your own Docker image, the process is:
The latest Docker image is created with Github Actions
(see `.github/workflows/docker-publish.yml`)
but, to create your own Docker image, the process is:

```sh
git clone https://github.com/vircadia/Iamus.git
Expand Down Expand Up @@ -130,13 +128,17 @@ EOFFF
```

This configuration file points the metaverse-server's storage to
the created directory and sets up logging to be verbose.
The `ConsoleLog` setting to `false` says to not log to the console
and let all logging go to the `content/Logs` directory.
the created directory.

The `THE_ADDRESS_OF_ICE_SERVER` must be replaced with the IP address
or domain name of the ice-server.

There are MANY, MANY more configuration parameters.
Refer to [https://github.com/vircadia/Iamus/blob/master/src/config.ts]
for the complete list of parameters.
What you put in `config/iamus.json` will overlay the defaults given
in that file.

## Run the Metaverse-Server Docker Image

I use a script to run the docker image:
Expand All @@ -149,7 +151,7 @@ docker run -d \
-p 9400:9400 \
-e IAMUS_CONFIG_FILE=/home/cadia/config/iamus.json \
--volume ${BASE}/config:/home/cadia/config \
misterblue/vircadia-metaverse-server
ghcr.io/vircadia/iamus:latest
```

If you change the port in the configuration file, remember to change the `-p`
Expand Down

0 comments on commit b38b693

Please sign in to comment.