Skip to content

Commit

Permalink
Docker container for a complete development environment added. fix #7
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhamez committed Oct 4, 2020
1 parent 946664d commit 08b3201
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
yyyy-mm-dd

- [#9][i9] Wrong in-game route: Added small delay between requests and debug messages.
- [#7][i7] Docker container for a complete development environment added.

[i9]: https://github.com/tkhamez/eve-route/issues/9
[i7]: https://github.com/tkhamez/eve-route/issues/7

## 0.3.1

Expand Down
54 changes: 41 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ https://eve-route.herokuapp.com
* [EVE App](#eve-app)
* [Database](#database)
- [Build and Run](#build-and-run)
* [Docker](#docker)
* [Frontend](#frontend)
* [Backend](#backend)
- [Deploy to Heroku](#deploy-to-heroku)
- [Contact](#contact)
- [Donations](#donations)
- [Copyright Notice](#copyright-notice)
- [Deploy](#deploy)
* [Heroku](#heroku)
- [Final Notes](#final-notes)
* [Contact](#contact)
* [Donations](#donations)
* [Copyright Notice](#copyright-notice)

<!-- tocstop -->

Expand All @@ -42,16 +45,37 @@ Set the Callback URL to https://your.domain.tld/api/auth/login

### Database

The app needs a MongoDB, PostgreSQL, MySQL, MariaDB, SQLite or H2 (embedded mode) database.
The application needs a MongoDB, PostgreSQL, MySQL, MariaDB, SQLite or H2 (embedded mode) database.

## Build and Run

### Docker

#### Development Environment

This was only tested so far on Linux with Docker 19.03 and Docker Compose 1.17.

You can use the included docker-compose file to create a MongoDB server and provide a web-based GUI:
```shell script
docker-compose up
```

GUI: http://localhost:8081
This provides a MongoDB Server at port 27017, Mongo Express at http://localhost:8081, a container with
Gradle 6 and JDK 11 and one with Node.js 12 and Yarn.

## Build and Run
Create a shell to run commands for the frontend and backend:
```shell script
export UID && docker-compose run --service-ports node /bin/sh
export UID && docker-compose run --service-ports gradle /bin/bash
```

Set the necessary environment variables in the Gradle container:
```shell script
export EVE_ROUTE_CLIENT_ID=ab12
export EVE_ROUTE_CLIENT_SECRET=12ab
export EVE_ROUTE_CALLBACK=http://localhost:8080/api/auth/login
```

Note: Use `gradle` instead of `./gradlew`, this saves a download of ~100MB.

### Frontend

Expand All @@ -75,7 +99,7 @@ yarn build

### Backend

Requires [JDK](https://openjdk.java.net/) 11+.
Requires [JDK](https://openjdk.java.net/) 11.

Make sure the necessary environment variables are set, e.g.:
```shell script
Expand Down Expand Up @@ -156,7 +180,9 @@ cd build/libs/ && jar -xvf eve-route-0.3.1.war
cd WEB-INF && java -classpath "lib/*:classes/." io.ktor.server.netty.EngineMain
```

## Deploy to Heroku
## Deploy

### Heroku

Add build packs in this order:

Expand All @@ -165,18 +191,20 @@ heroku buildpacks:add heroku/nodejs
heroku buildpacks:add heroku/gradle
```

## Contact
## Final Notes

### Contact

If you have questions or feedback, you can join the EVE Route [Discord Server](https://discord.gg/EjzHx8p)
or contact me via [Tweetfleet Slack](https://tweetfleet.slack.com) @Tian
([invitations](https://slack.eveisesi.space/)).

## Donations
### Donations

If you like this application, you can thank me by sending ISK to the character
[Tian Khamez](https://evewho.com/character/96061222).

## Copyright Notice
### Copyright Notice

EVE Route is licensed under the [MIT license](LICENSE).

Expand Down
29 changes: 24 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,38 @@ version: '3.1'
services:

mongo:
container_name: everoute_mongo
image: mongo:4.4-bionic
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: eve-route
volumes:
- ./.mongo:/data/db
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
ports: ['27017:27017']
volumes: [ "./.mongo:/data/db", "./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro" ]
ports: [ "27017:27017" ]

mongo-express:
container_name: everoute_mongo_express
image: mongo-express
ports: ['8081:8081']
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: password
ports: [ "8081:8081" ]

node:
container_name: everoute_node
image: node:12-alpine3.12
user: ${UID}
volumes: [ ".:/opt/eve-route" ]
working_dir: /opt/eve-route/frontend
ports: [ "3000:3000" ]

gradle:
container_name: everoute_gradle
image: gradle:6.6.1-jdk11
user: ${UID}
environment:
EVE_ROUTE_DB: mongodb://eve-route:password@mongo:27017/eve-route
EVE_ROUTE_CORS_DOMAIN: localhost:3000
volumes: [ ".:/opt/eve-route", "./.gradle:/home/gradle/.gradle" ]
working_dir: /opt/eve-route
ports: [ "8080:8080" ]

0 comments on commit 08b3201

Please sign in to comment.