mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-03 14:02:59 +00:00
updated Docker support
This commit is contained in:
parent
1678be25c5
commit
1a5d12a19f
@ -1,7 +1,6 @@
|
||||
FROM alpine:3.7
|
||||
RUN apk add --no-cache maven openjdk8
|
||||
FROM maven:3.5-jdk-8
|
||||
COPY /. /app/
|
||||
WORKDIR /app
|
||||
RUN mvn package \
|
||||
&& cp Server/src/main/resources/config.properties /app/
|
||||
CMD ["java", "-jar", "/app/target/server-1.2a.jar"]
|
||||
RUN mvn package
|
||||
WORKDIR /app/target
|
||||
CMD ["java", "-jar", "/app/target/server-1.4a.jar"]
|
31
README.md
31
README.md
@ -1,25 +1,18 @@
|
||||
# [Live demo](https://muchassemblyrequired.com)
|
||||
### [Official website](https://muchassemblyrequired.com)
|
||||
Program the 8086-like microprocessor of a robot in a grid-based multiplayer world. The game is web based so no installation is required.
|
||||
In its current state, players can walk around the game universe and collect Biomass blobs & Iron/copper ore using the online code editor.
|
||||
|
||||

|
||||
|
||||
Wiki: [GitHub](https://github.com/simon987/Much-Assembly-Required/wiki)
|
||||
Wiki: [GitHub](https://github.com/simon987/Much-Assembly-Required/wiki)
|
||||
Chat: [Slack](https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLTkyOTIwOTA5OGY4MDVlMGI4NzM5YzlhMWJiMGY1OWE2NjUxODQ1NWQ1YTcxMTA1NGZkYzNjYzMyM2E1ODdmNzg)
|
||||
|
||||
## VS Code Extensions
|
||||
- [Much Assembly Required (Upload on Save)](https://marketplace.visualstudio.com/items?itemName=tomhodder.much-assembly-required-upload-on-save) by tomhodder
|
||||
- [Much Assembly Required Language Support](https://marketplace.visualstudio.com/items?itemName=PJB3005.much-assembly-required-language-support) by PJB3005
|
||||
|
||||
# Deploying the server
|
||||
|
||||
Note: You can find the frontend [here](https://github.com/simon987/Much-Assembly-Required-Frontend)
|
||||
|
||||
|
||||
## Linux (Ubuntu 16.04)
|
||||
```bash
|
||||
# Install tools
|
||||
sudo apt install git maven openjdk-8-jdk
|
||||
sudo apt install git maven openjdk-8-jdk mongodb
|
||||
|
||||
# Obtain source files
|
||||
git clone https://github.com/simon987/Much-Assembly-Required.git
|
||||
@ -30,7 +23,7 @@ mvn package
|
||||
|
||||
# Run
|
||||
cd target
|
||||
java -jar server-1.2a.jar
|
||||
java -jar server-1.4a.jar
|
||||
```
|
||||
|
||||
## Windows (tested on Windows 10)
|
||||
@ -61,10 +54,8 @@ mongod
|
||||
```batch
|
||||
:: Runs the MAR server
|
||||
cd Much-Assembly-Required\target
|
||||
java -jar server-1.2a.jar
|
||||
java -jar server-1.4a.jar
|
||||
```
|
||||
3. Run the frontend, following the instructions that you can find [here](https://github.com/simon987/Much-Assembly-Required-Frontend).
|
||||
|
||||
|
||||
## Docker
|
||||
### Requirements
|
||||
@ -79,8 +70,12 @@ application's directory:
|
||||
|
||||
`docker-compose up`
|
||||
|
||||
This will start MySQL and then build and run this application. It will
|
||||
be available via http://localhost.
|
||||
Make sure to change `mongo_address` in `config.properties` to `mongodb`.
|
||||
|
||||
Note that there is currently no frontend web application serving the
|
||||
WebSocket feed served by the `Server` application!
|
||||
# Running
|
||||
|
||||
Once the server is running, you should be able to connect to `http://localhost:4567` with your browser
|
||||
|
||||
## VS Code Extensions
|
||||
- [Much Assembly Required (Upload on Save)](https://marketplace.visualstudio.com/items?itemName=tomhodder.much-assembly-required-upload-on-save) by tomhodder
|
||||
- [Much Assembly Required Language Support](https://marketplace.visualstudio.com/items?itemName=PJB3005.much-assembly-required-language-support) by PJB3005
|
||||
|
@ -50,7 +50,7 @@ public class GameServer implements Runnable {
|
||||
this.config = new ServerConfiguration("config.properties");
|
||||
|
||||
try{
|
||||
mongo = new MongoClient("localhost", 27017);
|
||||
mongo = new MongoClient(config.getString("mongo_address"), config.getInt("mongo_port"));
|
||||
DB db = mongo.getDB(config.getString("mongo_dbname"));
|
||||
|
||||
DBCollection userCollection = db.getCollection("user");
|
||||
|
@ -9,12 +9,16 @@ public class UserStats implements MongoSerialisable {
|
||||
|
||||
private BasicDBObject stats;
|
||||
|
||||
public UserStats() {
|
||||
UserStats() {
|
||||
this.stats = new BasicDBObject();
|
||||
}
|
||||
|
||||
public UserStats(BasicDBObject stats) {
|
||||
this.stats = stats;
|
||||
UserStats(BasicDBObject stats) {
|
||||
if (stats != null) {
|
||||
this.stats = stats;
|
||||
} else {
|
||||
this.stats = new BasicDBObject();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,4 +99,4 @@ public class UserStats implements MongoSerialisable {
|
||||
|
||||
return (BasicDBList) stats.get(name);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,9 @@ server_name=Official MAR server
|
||||
|
||||
#Database
|
||||
mongo_dbname=mar_beta
|
||||
#Change to 'mongodb' to use in docker
|
||||
mongo_address=mongodb
|
||||
mongo_port=27017
|
||||
#Biomass
|
||||
biomass_yield=2
|
||||
minBiomassCount=3
|
||||
|
@ -3,19 +3,25 @@ services:
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
command: sh -c "sed -i -e 's#localhost#db#' config.properties && /usr/bin/java -jar /app/target/server-1.2a.jar"
|
||||
command: sh -c "/usr/bin/java -jar /app/target/server-1.4a.jar"
|
||||
depends_on:
|
||||
db:
|
||||
mongodb:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8887:8887"
|
||||
db:
|
||||
image: mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-umar", "-pmar"]
|
||||
environment:
|
||||
MYSQL_DATABASE: mar
|
||||
MYSQL_PASSWORD: mar
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
||||
MYSQL_ROOT_PASSWORD: something-secret
|
||||
MYSQL_USER: mar
|
||||
- 4567:4567
|
||||
mongodb:
|
||||
image: mongo:latest
|
||||
container_name: "mongodb"
|
||||
environment:
|
||||
- MONGO_DATA_DIR=/data/db
|
||||
- MONGO_LOG_DIR=/dev/null
|
||||
volumes:
|
||||
- ./data/db:/data/db
|
||||
ports:
|
||||
- 27017:27017
|
||||
command: mongod --smallfiles --logpath=/dev/null --port 27017
|
||||
healthcheck:
|
||||
test: echo 'db.stats().ok' | mongo localhost:27017/mar --quiet
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 2
|
Loading…
x
Reference in New Issue
Block a user