mirror of
https://github.com/Quackster/Havana.git
synced 2025-07-02 04:37:47 +00:00
Add Docker support
This commit is contained in:
parent
5d49fd998f
commit
e61b3a9d90
7 changed files with 140 additions and 1 deletions
16
Dockerfile-Server
Normal file
16
Dockerfile-Server
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM eclipse-temurin:17-jdk AS builder
|
||||
|
||||
WORKDIR /sources
|
||||
COPY . /sources
|
||||
|
||||
RUN ./gradlew build
|
||||
RUN cd Havana-Server/build/distributions && tar xf Havana-Server.tar
|
||||
RUN cd Havana-Server/build/distributions/Havana-Server/bin && ./Havana-Server
|
||||
|
||||
FROM eclipse-temurin:17-jre
|
||||
COPY --from=builder /sources/Havana-Server/build/distributions/Havana-Server /havana-server
|
||||
COPY --from=builder /sources/figuredata.xml /havana-server/bin
|
||||
COPY --from=builder /sources/tools/docker/server-entrypoint.sh /havana-server/bin/run.sh
|
||||
WORKDIR /havana-server/bin
|
||||
RUN chmod +x run.sh
|
||||
ENTRYPOINT ["/havana-server/bin/run.sh"]
|
16
Dockerfile-Web
Normal file
16
Dockerfile-Web
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM eclipse-temurin:17-jdk AS builder
|
||||
|
||||
WORKDIR /sources
|
||||
COPY . /sources
|
||||
|
||||
RUN ./gradlew build
|
||||
RUN cd Havana-Web/build/distributions && tar xf Havana-Web.tar
|
||||
RUN cd Havana-Web/build/distributions/Havana-Web/bin && ./Havana-Web
|
||||
|
||||
FROM eclipse-temurin:17-jre
|
||||
COPY --from=builder /sources/Havana-Web/build/distributions/Havana-Web /havana-web
|
||||
COPY --from=builder /sources/figuredata.xml /havana-web/bin
|
||||
COPY --from=builder /sources/tools/docker/web-entrypoint.sh /havana-web/bin/run.sh
|
||||
WORKDIR /havana-web/bin
|
||||
RUN chmod +x run.sh
|
||||
ENTRYPOINT ["/havana-web/bin/run.sh"]
|
16
README.md
16
README.md
|
@ -221,6 +221,22 @@ Install the font manager, to enable the captcha to work on the website.
|
|||
apt-get install font-manager
|
||||
```
|
||||
|
||||
# Quick start using Docker
|
||||
|
||||
Install Docker, update ``docker-compose.yaml`` to use strong passwords for MariaDB.
|
||||
|
||||
❗ Variables values between ``x-mariadb-variables`` and ``x-havana-variables`` must match if you edit usernames and passwords.
|
||||
|
||||
Download the [havana_www_28_07_2024.zip](https://www.mediafire.com/file/6kn4ghtb37lfc1p/havana_www_28_07_2024.zip/file) file, and then extract it to tools/www/ this directory is located in the repository you just cloned.
|
||||
|
||||
Start the stack using ``docker-compose up``
|
||||
|
||||
You can access the MariaDB instance that is running in Docker on ``localhost:3306``
|
||||
|
||||
You can access Havana that is running in Docker on ``localhost:80``
|
||||
|
||||
Follow the instructions above for setting yourself as an admin.
|
||||
|
||||
## License
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
|
58
docker-compose.yaml
Normal file
58
docker-compose.yaml
Normal file
|
@ -0,0 +1,58 @@
|
|||
x-mariadb-variables: &mariadb-variables
|
||||
MARIADB_USER: havana
|
||||
MARIADB_PASSWORD: goldfish
|
||||
MARIADB_ROOT_PASSWORD: yourstrongpassword
|
||||
MARIADB_DATABASE: havana
|
||||
|
||||
x-havana-variables: &havana-variables
|
||||
MYSQL_USERNAME: havana
|
||||
MYSQL_PASSWORD: goldfish
|
||||
MYSQL_DATABASE: havana
|
||||
|
||||
services:
|
||||
havana-server:
|
||||
depends_on:
|
||||
mariadb:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-Server
|
||||
ports:
|
||||
- "12321:12321"
|
||||
- "12309:12309"
|
||||
- "12322:12322"
|
||||
environment:
|
||||
<<: *havana-variables
|
||||
restart: on-failure
|
||||
havana-web:
|
||||
depends_on:
|
||||
mariadb:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-Web
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./tools:/havana-web/bin/tools
|
||||
environment:
|
||||
<<: *havana-variables
|
||||
restart: on-failure
|
||||
mariadb:
|
||||
image: "mariadb:latest"
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
<<: *mariadb-variables
|
||||
volumes:
|
||||
- data:/var/lib/mysql
|
||||
- ./tools/havana.sql:/docker-entrypoint-initdb.d/havana.sql
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
start_period: 10s
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
restart: on-failure
|
||||
volumes:
|
||||
data:
|
16
tools/docker/server-entrypoint.sh
Normal file
16
tools/docker/server-entrypoint.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
MYSQL_HOSTNAME="${MYSQL_HOSTNAME:-mariadb}"
|
||||
MYSQL_PORT="${MYSQL_PORT:-3306}"
|
||||
MYSQL_USERNAME="${MYSQL_USERNAME:-root}"
|
||||
MYSQL_PASSWORD="${MYSQL_PASSWORD:-goldfish}"
|
||||
MYSQL_DATABASE="${MYSQL_DATABASE:-havana}"
|
||||
|
||||
sed -i -E "s/(mysql.hostname=)(.*)/\1$MYSQL_HOSTNAME/g" server.ini
|
||||
sed -i -E "s/(mysql.port=)(.*)/\1$MYSQL_PORT/g" server.ini
|
||||
sed -i -E "s/(mysql.username=)(.*)/\1$MYSQL_USERNAME/g" server.ini
|
||||
sed -i -E "s/(mysql.password=)(.*)/\1$MYSQL_PASSWORD/g" server.ini
|
||||
sed -i -E "s/(mysql.database=)(.*)/\1$MYSQL_DATABASE/g" server.ini
|
||||
sed -i -E "s/(rcon.bind=)(.*)/\10.0.0.0/g" server.ini
|
||||
|
||||
./Havana-Server
|
17
tools/docker/web-entrypoint.sh
Normal file
17
tools/docker/web-entrypoint.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
RCON_IP="${RCON_IP:-havana-server}"
|
||||
MYSQL_HOSTNAME="${MYSQL_HOSTNAME:-mariadb}"
|
||||
MYSQL_PORT="${MYSQL_PORT:-3306}"
|
||||
MYSQL_USERNAME="${MYSQL_USERNAME:-root}"
|
||||
MYSQL_PASSWORD="${MYSQL_PASSWORD:-goldfish}"
|
||||
MYSQL_DATABASE="${MYSQL_DATABASE:-havana}"
|
||||
|
||||
sed -i -E "s/(mysql.hostname=)(.*)/\1$MYSQL_HOSTNAME/g" webserver-config.ini
|
||||
sed -i -E "s/(mysql.port=)(.*)/\1$MYSQL_PORT/g" webserver-config.ini
|
||||
sed -i -E "s/(mysql.username=)(.*)/\1$MYSQL_USERNAME/g" webserver-config.ini
|
||||
sed -i -E "s/(mysql.password=)(.*)/\1$MYSQL_PASSWORD/g" webserver-config.ini
|
||||
sed -i -E "s/(mysql.database=)(.*)/\1$MYSQL_DATABASE/g" webserver-config.ini
|
||||
sed -i -E "s/(rcon.ip=)(.*)/\1$RCON_IP/g" webserver-config.ini
|
||||
|
||||
./Havana-Web
|
|
@ -88,7 +88,7 @@
|
|||
{% for player in players %}
|
||||
<tr>
|
||||
<td>{{ player.id }}</td>
|
||||
<td><a href="{{ site.sitePath }}/{{ site.housekeepingPath }}/users/edit?id={{ player.id }}">{{ player.name }}</a> - <a href="{{ site.sitePath }}/{{ site.housekeepingPath }}/transaction/lookup?searchQuery={{ player.getName() }}">Transactons</a></td>
|
||||
<td><a href="{{ site.sitePath }}/{{ site.housekeepingPath }}/users/edit?id={{ player.id }}">{{ player.name }}</a> - <a href="{{ site.sitePath }}/{{ site.housekeepingPath }}/transaction/lookup?searchQuery={{ player.getName() }}">Transactions</a></td>
|
||||
<td>{{ player.email }}</td>
|
||||
<td><img src="{{ site.sitePath }}/habbo-imaging/avatarimage?figure={{ player.figure }}&size=s"></td>
|
||||
{% autoescape 'html' %}
|
||||
|
|
Loading…
Add table
Reference in a new issue