Skip to content

Commit 8a1f07e

Browse files
localnet, volumes
1 parent 01095a1 commit 8a1f07e

File tree

5 files changed

+57
-18
lines changed

5 files changed

+57
-18
lines changed

docker/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ RUN set -eux; \
1616
chown mysql:mysql /var/run/mysqld;
1717

1818
WORKDIR /app
19+
VOLUME ["/var/lib/mysql/", "/app/login", "/app/game" ]
1920
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

docker/prepare

+18-15
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,31 @@
33
# wait for mysql
44
sleep 3
55

6-
#shell
7-
mv /app/game/config/default-ipconfig.xml /app/game/config/ipconfig.xml
6+
# rename if exist default-ipconfig.xml
7+
[ -f /app/game/config/default-ipconfig.xml ] && mv /app/game/config/default-ipconfig.xml /app/game/config/ipconfig.xml || true
88

9+
10+
if [ ! -d /var/lib/mysql/l2jmobiusessence/ ]; then
911
# db
10-
mysql -uroot -hlocalhost -e "CREATE DATABASE IF NOT EXISTS \`l2jmobiusessence\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
11-
mysql -uroot -hlocalhost -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '';"
12+
mysql -uroot -hlocalhost -e "CREATE DATABASE IF NOT EXISTS \`l2jmobiusessence\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
13+
mysql -uroot -hlocalhost -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '';"
1214

1315
# login
14-
for sql_file in /app/db_installer/sql/login/*.sql; do
15-
if [ -f "$sql_file" ]; then
16-
mysql -uroot l2jmobiusessence < "$sql_file"
17-
fi
18-
done
16+
for sql_file in /app/db_installer/sql/login/*.sql; do
17+
if [ -f "$sql_file" ]; then
18+
mysql -uroot l2jmobiusessence < "$sql_file"
19+
fi
20+
done
1921

2022
# game
21-
for sql_file in /app/db_installer/sql/game/*.sql; do
22-
if [ -f "$sql_file" ]; then
23-
mysql -uroot l2jmobiusessence < "$sql_file"
24-
fi
25-
done
23+
for sql_file in /app/db_installer/sql/game/*.sql; do
24+
if [ -f "$sql_file" ]; then
25+
mysql -uroot l2jmobiusessence < "$sql_file"
26+
fi
27+
done
2628

27-
mysql -uroot -hlocalhost l2jmobiusessence -e "truncate announcements;"
29+
mysql -uroot -hlocalhost l2jmobiusessence -e "truncate announcements;"
30+
fi
2831

2932
# ready
3033
touch /app/ready

docker/supervisor/conf.d/mariadb.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ autorestart=true
99
startsecs = 4
1010
stdout_logfile = /dev/stdout
1111
stdout_logfile_maxbytes = 0
12-
stderr_logfile = /dev/stderr
12+
# stderr_logfile = /dev/stderr
1313
stderr_logfile_maxbytes = 0
1414
user=mysql
1515
group=mysql

docker-compose.yml renamed to localhost.docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ services:
33
game:
44
image: "ghcr.io/rootshell-coder/l2-game-server:latest"
55
ports:
6-
- "127.0.0.1:7777:7777"
7-
- "127.0.0.1:2106:2106"
6+
- "7777:7777"
7+
- "2106:2106"
88
restart: "unless-stopped"
99
deploy:
1010
resources:

localnet.docker-compose.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# prepare run `sudo mkdir -p /srv/l2-essence/mysql /srv/l2-essence/login /srv/l2-essence/game`
3+
4+
networks:
5+
l2-net:
6+
attachable: true
7+
8+
volumes:
9+
mysql:
10+
driver_opts:
11+
type: local
12+
device: '/srv/l2-essence/mysql'
13+
o: bind
14+
login:
15+
driver_opts:
16+
type: local
17+
device: '/srv/l2-essence//login'
18+
o: bind
19+
game:
20+
driver_opts:
21+
type: local
22+
device: '/srv/l2-essence/game'
23+
o: bind
24+
25+
services:
26+
game:
27+
image: "ghcr.io/rootshell-coder/l2-game-server:latest"
28+
ports:
29+
- "7777:7777"
30+
- "2106:2106"
31+
volumes:
32+
- "mysql:/var/lib/mysql/"
33+
- "login:/app/login"
34+
- "game:/app/game"
35+
restart: "always"

0 commit comments

Comments
 (0)