forked from Misterblue/vircadia-domain-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Add docker-compose.yml file to start and stop the services.
1. Add 'vircadia-mongo' to split the DB from metaverser server. 2. Start and stop domain-server, ice-server, metaverse server, and mongo db. TODO: There is still an error from metaverse server that needs to be fixed. However, this commit resolves most common mongodb related errors.
- Loading branch information
Showing
9 changed files
with
735 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
version: '3.4' | ||
|
||
services: | ||
vircadia-mongodb: | ||
image: vircadia-mongodb:4.4 | ||
container_name: vircadia-mongodb | ||
restart: unless-stopped | ||
ports: | ||
- 27017:27017 | ||
- 28017:28017 | ||
volumes: | ||
- ./persist-data/vircadia-mongo/data/db:/data/db | ||
- ./persist-data/vircadia-mongo/data/log:/var/log/mongodb | ||
networks: | ||
- vircadia | ||
|
||
vircadia-metaverse: | ||
image: metaverseserver | ||
container_name: vircadia-metaverse-server | ||
restart: unless-stopped | ||
environment: | ||
- IAMUS_CONFIG_FILE=/home/cadia/config/iamus.json | ||
volumes: | ||
- ./files/metaverse/iamus.json:/home/cadia/config/iamus.json | ||
- ./persist-data/vircadia-metaverse/iamus/logs:/home/cadia/Iamus/logs | ||
- ./persist-data/vircadia-metaverse/iamus/Logs:/home/cadia/Iamus/Logs | ||
ports: | ||
- 9400:9400 | ||
links: | ||
- vircadia-mongodb | ||
networks: | ||
- vircadia | ||
depends_on: | ||
- vircadia-mongo | ||
|
||
vircadia-ice-server: | ||
image: vircadia-domain-server | ||
container_name: vircadia-ice-server | ||
restart: unless-stopped | ||
ports: | ||
- 7337:7337 | ||
- 7337:7337/udp | ||
environment: | ||
- METAVERSE_URL=vircadia-metaverse:9400 | ||
entrypoint: /home/cadia/start-ice-server.sh | ||
volumes: | ||
- ./persist-data/vircadia-ice-server/server-dotlocal/testmeteverse:/home/cadia/.local | ||
- ./persist-data/vircadia-ice-server/server-logs/testmeteverse:/home/cadia/logs | ||
networks: | ||
- vircadia | ||
depends_on: | ||
- vircadia-metaverse | ||
|
||
vircadia-domain-server: | ||
image: vircadia-domain-server | ||
container_name: vircadia-domain-server | ||
restart: unless-stopped | ||
ports: | ||
- 40100-40102:40100-40102 | ||
- 40100-40102:40100-40102/udp | ||
- 48000-48009:48000-48009/udp | ||
environment: | ||
- METAVERSE_URL=vircadia-metaverse:9400 | ||
- ICE_SERVER=vircadia-ice-server:7337 | ||
- CLEANNAME=vircadia-metaverse | ||
- INSTANCE=0 | ||
volumes: | ||
- ./persist-data/vircadia-domain-server/server-dotlocal/testmeteverse:/home/cadia/.local | ||
- ./persist-data/vircadia-domain-server/server-logs/testmeteverse:/home/cadia/logs | ||
networks: | ||
- vircadia | ||
depends_on: | ||
- vircadia-ice-server | ||
|
||
networks: | ||
vircadia: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"metaverse": { | ||
"metaverse-name": "TestMetaverse", | ||
"metaverse-nick-name": "TestMetaverse", | ||
"metaverse-server-url": "vircadia-metaverse:9400", | ||
"default-ice-server-url": "vircadia-ice-server:7337" | ||
}, | ||
"database": { | ||
"db": "domainstore", | ||
"db-host": "vircadia-mongodb", | ||
"db-user": "cadiauser", | ||
"db-pw": "noneknowsit" | ||
}, | ||
"debug": { | ||
"loglevel": "debug" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Majority of the script is from https://github.com/docker-library/mongo | ||
# Adding vircadia related stuffs. | ||
|
||
FROM ubuntu:20.04 | ||
|
||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb | ||
|
||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
jq \ | ||
numactl \ | ||
; \ | ||
if ! command -v ps > /dev/null; then \ | ||
apt-get install -y --no-install-recommends procps; \ | ||
fi; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# grab gosu for easy step-down from root (https://github.com/tianon/gosu/releases) | ||
ENV GOSU_VERSION 1.12 | ||
# grab "js-yaml" for parsing mongod's YAML config files (https://github.com/nodeca/js-yaml/releases) | ||
ENV JSYAML_VERSION 3.13.1 | ||
|
||
RUN set -ex; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
wget \ | ||
; \ | ||
if ! command -v gpg > /dev/null; then \ | ||
apt-get install -y --no-install-recommends gnupg dirmngr; \ | ||
savedAptMark="$savedAptMark gnupg dirmngr"; \ | ||
elif gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \ | ||
# "This package provides support for HKPS keyservers." (GnuPG 1.x only) | ||
apt-get install -y --no-install-recommends gnupg-curl; \ | ||
fi; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ | ||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
command -v gpgconf && gpgconf --kill all || :; \ | ||
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
\ | ||
wget -O /js-yaml.js "https://github.com/nodeca/js-yaml/raw/${JSYAML_VERSION}/dist/js-yaml.js"; \ | ||
# TODO some sort of download verification here | ||
\ | ||
apt-mark auto '.*' > /dev/null; \ | ||
apt-mark manual $savedAptMark > /dev/null; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
\ | ||
# smoke test | ||
chmod +x /usr/local/bin/gosu; \ | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
RUN mkdir /docker-entrypoint-initdb.d | ||
|
||
RUN set -ex; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
set -- '20691EEC35216C63CAF66CE1656408E390CFB1F5'; \ | ||
for key; do \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ | ||
done; \ | ||
gpg --batch --export "$@" > /etc/apt/trusted.gpg.d/mongodb.gpg; \ | ||
command -v gpgconf && gpgconf --kill all || :; \ | ||
rm -r "$GNUPGHOME"; \ | ||
apt-key list | ||
|
||
# Allow build-time overrides (eg. to build image with MongoDB Enterprise version) | ||
# Options for MONGO_PACKAGE: mongodb-org OR mongodb-enterprise | ||
# Options for MONGO_REPO: repo.mongodb.org OR repo.mongodb.com | ||
# Example: docker build --build-arg MONGO_PACKAGE=mongodb-enterprise --build-arg MONGO_REPO=repo.mongodb.com . | ||
ARG MONGO_PACKAGE=mongodb-org | ||
ARG MONGO_REPO=repo.mongodb.org | ||
ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO} | ||
|
||
ENV MONGO_MAJOR 4.4 | ||
RUN echo "deb http://$MONGO_REPO/apt/ubuntu focal/${MONGO_PACKAGE%-unstable}/$MONGO_MAJOR multiverse" | tee "/etc/apt/sources.list.d/${MONGO_PACKAGE%-unstable}.list" | ||
|
||
# http://docs.mongodb.org/master/release-notes/4.4/ | ||
ENV MONGO_VERSION 4.4.11 | ||
# 12/28/2021, https://github.com/mongodb/mongo/tree/b7530cacde8432d2f22ed506f258ff9c3b45c5e9 | ||
|
||
RUN set -x \ | ||
# installing "mongodb-enterprise" pulls in "tzdata" which prompts for input | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
# starting with MongoDB 4.3 (and backported to 4.0 and 4.2 *and* 3.6??), the postinst for server includes an unconditional "systemctl daemon-reload" (and we don't have anything for "systemctl" to talk to leading to dbus errors and failed package installs) | ||
&& ln -s /bin/true /usr/local/bin/systemctl \ | ||
&& apt-get install -y \ | ||
${MONGO_PACKAGE}=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-server=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-shell=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-mongos=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-tools=$MONGO_VERSION \ | ||
&& rm -f /usr/local/bin/systemctl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rm -rf /var/lib/mongodb \ | ||
&& mv /etc/mongod.conf /etc/mongod.conf.orig | ||
|
||
RUN mkdir -p /data/db /data/configdb \ | ||
&& chown -R mongodb:mongodb /data/db /data/configdb | ||
VOLUME /data/db /data/configdb | ||
|
||
COPY add_db_users.js /docker-entrypoint-initdb.d/ | ||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
COPY config/mongod.conf /opt/mongod.conf | ||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | ||
|
||
EXPOSE 27017 | ||
CMD ["mongod", "-f", "/opt/mongod.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
print("Started Adding the Users."); | ||
db = db.getSiblingDB("admin"); | ||
db.createUser({ | ||
user:"adminer", | ||
pwd: "noneknowsit", | ||
roles: [ "root" ] | ||
}); | ||
db.createUser({ | ||
user:"backuper", | ||
pwd: "noneknowsit", | ||
roles: [ "backup" ] | ||
}); | ||
db.createUser({ | ||
user:"cadiauser", | ||
pwd: "noneknowsit", | ||
roles: [{ | ||
role: "readWrite", | ||
db: "domainstore" | ||
}] | ||
}); | ||
db.createUser({ | ||
user:"metaverse", | ||
pwd: "noneknowsit", | ||
roles: [{ | ||
role: "readWrite", | ||
db: "tester" | ||
}] | ||
}); | ||
print("End Adding the User Roles."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker build -t vircadia-mongodb:4.4 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# mongod.conf | ||
|
||
# for documentation of all options, see: | ||
# http://docs.mongodb.org/manual/reference/configuration-options/ | ||
|
||
# Where and how to store data. | ||
storage: | ||
dbPath: /data/db | ||
journal: | ||
enabled: true | ||
# engine: | ||
# mmapv1: | ||
# wiredTiger: | ||
|
||
# where to write logging data. | ||
systemLog: | ||
destination: file | ||
logAppend: true | ||
path: /var/log/mongodb/mongod.log | ||
|
||
# network interfaces | ||
net: | ||
port: 27017 | ||
bindIp: 127.0.0.1 | ||
|
||
# how the process runs | ||
processManagement: | ||
timeZoneInfo: /usr/share/zoneinfo | ||
|
||
security: | ||
authorization: enabled | ||
|
||
#operationProfiling: | ||
|
||
#replication: | ||
|
||
#sharding: | ||
|
||
## Enterprise-Only Options: | ||
|
||
#auditLog: | ||
|
||
#snmp: |
Oops, something went wrong.