diff --git a/.gitignore b/.gitignore index 9180cc025..8f1b01407 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ gradle.properties /bin/ *.db *.iff +mongo_data diff --git a/README.md b/README.md index 9a86391de..a980bcee1 100644 --- a/README.md +++ b/README.md @@ -25,21 +25,22 @@ by running `java -version`. The project uses submodules. Get them by running: git submodule update --init ## MongoDB ## -User information is read from a MongoDB database that can be run on any machine on your network. Default is the machine that Holocore is running on. +A MongoDB instance can be bootstrapped by running `docker-compose up -d`. -1. Create database: `use cu` -2. Create your game user: `db.users.insert({"username": "user", "password": "pass", "accessLevel": "dev", "banned": false, "characters": []})` +This will run and initialize a MongoDB instance with a default game server user. +* Username: user +* Password: pass -Enabling the Character Builder Terminals: -1. Switch to the relevant database: `use cu` -2. Enable the character builder: `db.config.insertOne({ "package": "support.data.dev", "characterBuilder": true })` +This will also run a web UI, which can be accessed in the browser at: http://localhost:8081 + +You can stop both with: `docker-compose down`. ## Running Holocore ## -Compile and run Holocores main code using Gradle: `./gradlew run` +Compile and run Holocores main code using Gradle: `./gradlew runDevelopment` ## Running automated tests ## Compile and run Holocores automated tests using Gradle: `./gradlew test --info` # Running your own server # -If you're interesting in running your own server, you should use the provided +If you're interested in running your own server, you should use the provided Docker image. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..c863ef728 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: '3.1' + +services: + + mongo: + image: mongo:5.0.14 + restart: always + ports: + - "27017:27017" + environment: + MONGO_INITDB_DATABASE: cu + volumes: + - ./mongo_data:/data/db + - ./mongo_init_scripts:/docker-entrypoint-initdb.d + + mongo-express: + image: mongo-express:0.54.0 + restart: always + depends_on: + - mongo + ports: + - "8081:8081" + environment: + ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/ diff --git a/mongo_init_scripts/blue_frog.js b/mongo_init_scripts/blue_frog.js new file mode 100644 index 000000000..22bc6e112 --- /dev/null +++ b/mongo_init_scripts/blue_frog.js @@ -0,0 +1,4 @@ +db.config.insertOne({ + package: "support.data.dev", + characterBuilder: true +}); diff --git a/mongo_init_scripts/default_user.js b/mongo_init_scripts/default_user.js new file mode 100644 index 000000000..c28885036 --- /dev/null +++ b/mongo_init_scripts/default_user.js @@ -0,0 +1,7 @@ +db.users.insert({ + username: "user", + password: "pass", + accessLevel: "dev", + banned: false, + characters: [] +});