From 8ba8c6fd1ff1ecae68d023dc453c244b8f132f71 Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Tue, 5 Jan 2021 21:07:49 -0600 Subject: [PATCH] Default docker config changes and startup improvements Altered the default configuration to be more compatible with parallel installations out-of-the-box. Added a SQL script that runs when the database is first created to add a pair of default users. --- gemp-lotr/docker/docker-compose.yml | 22 +++++++++++----------- gemp-lotr/docker/gemp.env | 1 - gemp-lotr/docker/gemp_db.Dockerfile | 2 +- gemp-lotr/docker/initial_user_setup.sql | 17 +++++++++++++++++ gemp-lotr/docker/readme.txt | 4 ++-- 5 files changed, 31 insertions(+), 15 deletions(-) delete mode 100644 gemp-lotr/docker/gemp.env create mode 100644 gemp-lotr/docker/initial_user_setup.sql diff --git a/gemp-lotr/docker/docker-compose.yml b/gemp-lotr/docker/docker-compose.yml index 171b755ff..5359eb1a9 100644 --- a/gemp-lotr/docker/docker-compose.yml +++ b/gemp-lotr/docker/docker-compose.yml @@ -4,7 +4,7 @@ services: build: - container_name: gemp_app + container_name: gemp_app_1 build: context: . dockerfile: gemp_app.Dockerfile @@ -17,7 +17,7 @@ services: # target means in the container - target: 80 # published is what's on the host machine - published: 1337 + published: 17001 volumes: - type: bind source: ../gemp-lotr-async/src/main/web @@ -29,14 +29,14 @@ services: source: ../gemp-lotr-async/src/main/web target: /var/www/localhost/htdocs/gemp-lotr #/etc/apache2/htdocs/gemp-lotr networks: - gemp_net: - ipv4_address: 172.28.1.1 + gemp_net_1: + ipv4_address: 172.28.1.2 tty: true - command: nohup java -jar /etc/gemp-lotr/gemp-lotr-async/target/web.jar & + #command: nohup java -jar /etc/gemp-lotr/gemp-lotr-async/target/web.jar & db: - container_name: gemp_db + container_name: gemp_db_1 build: context: .. dockerfile: docker/gemp_db.Dockerfile @@ -45,15 +45,15 @@ services: # target means in the container - target: 3306 # published is what's on the host machine - published: 3307 + published: 35001 restart: always volumes: - type: bind source: ../../database target: /var/lib/mysql networks: - gemp_net: - ipv4_address: 172.28.1.2 + gemp_net_1: + ipv4_address: 172.28.1.3 environment: MYSQL_ROOT_PASSWORD: rootpass MYSQL_DATABASE: gemp_db @@ -62,8 +62,8 @@ services: networks: - gemp_net: + gemp_net_1: ipam: driver: default config: - - subnet: 172.28.0.0/16 \ No newline at end of file + - subnet: 172.28.1.0/16 \ No newline at end of file diff --git a/gemp-lotr/docker/gemp.env b/gemp-lotr/docker/gemp.env deleted file mode 100644 index aa185ea04..000000000 --- a/gemp-lotr/docker/gemp.env +++ /dev/null @@ -1 +0,0 @@ -COMPOSE_PROJECT_NAME=gemp-lotr-sandbox \ No newline at end of file diff --git a/gemp-lotr/docker/gemp_db.Dockerfile b/gemp-lotr/docker/gemp_db.Dockerfile index b18d1f928..9693eb717 100644 --- a/gemp-lotr/docker/gemp_db.Dockerfile +++ b/gemp-lotr/docker/gemp_db.Dockerfile @@ -1,4 +1,4 @@ FROM mariadb AS MariaDB -#COPY ./database_script.sql /etc/gemp/database_script.sql COPY ./database_script.sql /docker-entrypoint-initdb.d +COPY ./docker/initial_user_setup.sql /docker-entrypoint-initdb.d diff --git a/gemp-lotr/docker/initial_user_setup.sql b/gemp-lotr/docker/initial_user_setup.sql new file mode 100644 index 000000000..886c09954 --- /dev/null +++ b/gemp-lotr/docker/initial_user_setup.sql @@ -0,0 +1,17 @@ +INSERT INTO player (name, password, type, last_login_reward, last_ip, create_ip) +VALUES ( + 'asdf', + 'f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b', + 'aut', + '20170101', + '192.168.50.1', + '192.168.50.1' +), +( + 'qwer', + 'f6f2ea8f45d8a057c9566a33f99474da2e5c6a6604d736121650e2730c6fb0a3', + 'aut', + '20170101', + '192.168.50.1', + '192.168.50.1' +); \ No newline at end of file diff --git a/gemp-lotr/docker/readme.txt b/gemp-lotr/docker/readme.txt index d0f3373aa..76fc72e40 100644 --- a/gemp-lotr/docker/readme.txt +++ b/gemp-lotr/docker/readme.txt @@ -27,7 +27,7 @@ gemp_app is slightly more complicated. Gemp is a Java server, is built using Ma 4B- under db/environment, note all of the username/password fields. If you are hosting this for something other than personal development, be sure to change all of these to something else. - 4C- note the two "published" ports: 1337 for the app, and 3307 for the db. These are the ports that you will be accessing the site with (and the db if you connect with a database manager). If you are hosting this for something other than personal development, consider changing these to something else. DO NOT change the "target" ports. + 4C- note the two "published" ports: 17001 for the app, and 35001 for the db. These are the ports that you will be accessing the site with (and the db if you connect with a database manager). If you are hosting this for something other than personal development, consider changing these to something else. DO NOT change the "target" ports. 5- If you changed SQL credentials in step 4, navigate to gemp-lotr/gemp-lotr/gemp-lotr-commond/src/main/resources/ and open gemp-lotr.properties: @@ -64,7 +64,7 @@ You should see "Starting gemp_app....done" and "Starting gemp_db....done" at the docker-compose down docker-compose up -d -11- if all has gone as planned, you should now be able to navigate to your own personal instance of Gemp. Open your browser of choice and navigate to http://localhost:1337/gemp-lotr/ . (If you need a different port to be bound to, then repeat step 5 and edit the exposed port.) +11- if all has gone as planned, you should now be able to navigate to your own personal instance of Gemp. Open your browser of choice and navigate to http://localhost:17001/gemp-lotr/ . (If you need a different port to be bound to, then repeat step 5 and edit the exposed port.) If you're presented with the home page, register a new user and log in. It's possible for the login page to present but login itself to fail if configured incorrectly, so don't celebrate until you see the (empty) lobby. If you get that far, then congrats, you now have a working local version of Gemp.