Compare commits
8 Commits
889d87dbde
...
master
Author | SHA1 | Date | |
---|---|---|---|
bc48b2e6ce | |||
7a8971b50f | |||
b5e8641a24 | |||
01235b465e | |||
adbcc3492a | |||
2c1f147c67 | |||
0c39107be0 | |||
de90fcdc2a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.DS_Store
|
||||
testdata
|
15
Dockerfile
15
Dockerfile
@ -37,14 +37,17 @@ FROM eressea-base as eressea
|
||||
ARG eressea_branch
|
||||
COPY docker-assets/backup-eressea.patch /eressea/
|
||||
COPY docker-assets/create-orders.patch /eressea/
|
||||
COPY docker-assets/run-eressea.cron.patch /eressea/
|
||||
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
|
||||
cmake luarocks libxml2-dev liblua5.2-dev libtolua-dev libncurses5-dev libsqlite3-dev \
|
||||
libexpat1-dev && \
|
||||
libiniparser-dev libcjson-dev libexpat1-dev && \
|
||||
cd /eressea && \
|
||||
git clone -b $eressea_branch https://github.com/eressea/server.git git.eressea && \
|
||||
cd git.eressea && \
|
||||
git submodule update --init && \
|
||||
patch process/backup-eressea < /eressea/backup-eressea.patch && \
|
||||
patch process/create-orders < /eressea/create-orders.patch && \
|
||||
patch process/cron/run-eressea.cron < /eressea/run-eressea.cron.patch && \
|
||||
s/cmake-init && \
|
||||
s/build && \
|
||||
ln -sf conf/eressea.ini && \
|
||||
@ -66,7 +69,7 @@ ENV PATH="${PATH}:/usr/games"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y liblua5.2-0 libsqlite3-0 libncurses5 libreadline7 libexpat1 python python-pip mutt nano \
|
||||
logrotate pwgen zip luarocks fetchmail procmail php7.3 gettext php7.3-sqlite && \
|
||||
logrotate pwgen zip luarocks fetchmail procmail php7.3 gettext php7.3-sqlite libiniparser1 libcjson1 && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
pip install bcrypt j2cli && \
|
||||
@ -77,11 +80,16 @@ RUN apt-get update && \
|
||||
|
||||
COPY docker-assets/template-config/ /eressea/template-config/
|
||||
COPY docker-assets/lua-scripts/ /eressea/lua-scripts/
|
||||
COPY docker-assets/run-eressea.sh /eressea/run-eressea.sh
|
||||
COPY docker-assets/start.sh /eressea/start.sh
|
||||
COPY --from=eressea /eressea/server/ /eressea/server/
|
||||
COPY --from=eressea /eressea/git.eressea/build-x86_64-linux-gnu-gcc-Debug/tools/inifile /eressea/server/bin
|
||||
COPY --from=eressea /eressea/git.eressea/build-x86_64-linux-gnu-gcc-Debug/tools/gethash /eressea/server/bin
|
||||
COPY --from=eressea /eressea/git.eressea/build-x86_64-linux-gnu-gcc-Debug/tools/atoi36 /eressea/server/bin
|
||||
COPY --from=eressea /eressea/server/etc/report-mail.de.txt /eressea/template-mail/report-mail.de.txt
|
||||
COPY --from=eressea /eressea/server/etc/report-mail.en.txt /eressea/template-mail/report-mail.en.txt
|
||||
COPY --from=eressea /eressea/git.eressea/scripts/tools /eressea/server/scripts/tools
|
||||
COPY --from=eressea /eressea/git.eressea/s/preview /eressea/server/bin/
|
||||
COPY --from=eressea /eressea/git.eressea/process/cron/run-eressea.cron /eressea/run-eressea.sh
|
||||
COPY --from=eressea /usr/games/echeck /usr/games/echeck
|
||||
COPY --from=eressea /usr/share/locale/de/LC_MESSAGES/ /usr/share/locale/de/LC_MESSAGES/
|
||||
COPY --from=eressea /usr/share/games/echeck/ /usr/share/games/echeck/
|
||||
@ -91,3 +99,4 @@ VOLUME ["/data"]
|
||||
WORKDIR /data
|
||||
ENTRYPOINT ["/eressea/start.sh"]
|
||||
CMD ["help"]
|
||||
|
||||
|
34
Readme.md
34
Readme.md
@ -5,6 +5,10 @@ More details about Eressea find on
|
||||
- in [wiki](https://wiki.eressea.de/index.php/Hauptseite) you find the game rules and a lot of other information
|
||||
- and finally the source code, which is hosted on [GitHub](https://github.com/eressea)
|
||||
|
||||
The Dockerfile is available on
|
||||
* [GitHub](https://github.com/jacsid/eressea_docker)
|
||||
* [Private Repository](https://git.jacs-home.eu/juergen/eressea-docker)
|
||||
|
||||
## Volumes
|
||||
By default, the image expects a single volume, located at `/data`. It will hold
|
||||
* configuration files
|
||||
@ -103,3 +107,33 @@ docker run -it --rm \
|
||||
-v /path/to/my/local/eressea/folder:/data \
|
||||
jacsid/eressea run
|
||||
```
|
||||
|
||||
## Update Docker image
|
||||
It's easy to update to the newest Docker image. Execute following command:
|
||||
|
||||
```
|
||||
docker image pull jacsid/eressea:latest
|
||||
```
|
||||
|
||||
Afterwards start the above described commands as usual.
|
||||
|
||||
## Correction of game data
|
||||
Sometimes there are bugs in the server program where you have to correct game data manually.
|
||||
Find next some samples how to archive this.
|
||||
### Sample session
|
||||
Set hebs which can be found by units of a region where a specific unit is, to h2.
|
||||
|
||||
```
|
||||
sudo docker run -it --rm -v /path/to/my/local/eressea/folder:/data jacsid/eressea bash
|
||||
|
||||
./eressea
|
||||
|
||||
require 'config'
|
||||
eressea.read_game('18.dat')
|
||||
u = get_unit('xdyv')
|
||||
r = u.region
|
||||
r.herb = "h2"
|
||||
eressea.write_game('18.dat')
|
||||
|
||||
print(u:show())
|
||||
```
|
14
docker-assets/create-orders.patch
Normal file
14
docker-assets/create-orders.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- create-orders 2020-12-26 10:04:52.000000000 +0100
|
||||
+++ create-orders copy 2020-12-26 10:06:56.000000000 +0100
|
||||
@@ -14,9 +14,10 @@
|
||||
echo "orders.dir.$TURN already exists"
|
||||
exit
|
||||
fi
|
||||
+mv orders.dir orders.dir.$TURN
|
||||
rm -f "orders.$TURN"
|
||||
|
||||
-cd orders.dir || exit
|
||||
+cd orders.dir.$TURN || exit
|
||||
|
||||
php ../../orders-php/cli.php -d "orders.db" export | tr -d '\r' > "../orders.$TURN"
|
||||
|
27
docker-assets/run-eressea.cron.patch
Normal file
27
docker-assets/run-eressea.cron.patch
Normal file
@ -0,0 +1,27 @@
|
||||
--- ../git.eressea/process/cron/run-eressea.cron 2021-04-18 14:51:46.000000000 +0200
|
||||
+++ run-eressea.cron 2021-04-18 15:26:24.000000000 +0200
|
||||
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
+# this script is based on run-eressea.cron
|
||||
+# differences to original
|
||||
+# it is possible to run a turn with empty orders
|
||||
+
|
||||
GAME=$1
|
||||
+ENABLE_EMPTY_ORDERS=$2
|
||||
(
|
||||
[ "$ENABLED" == "no" ] && exit
|
||||
[ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea"
|
||||
@@ -28,8 +33,10 @@
|
||||
|
||||
"$BIN/create-orders" "$GAME" "$TURN"
|
||||
if [ ! -s "$ERESSEA/game-$GAME/orders.$TURN" ]; then
|
||||
- echo "server did not create orders for turn $TURN in game $GAME"
|
||||
- exit 2
|
||||
+ if [ "$ENABLE_EMPTY_ORDERS" != "yes" ]; then
|
||||
+ echo "server did not create orders for turn $TURN in game $GAME"
|
||||
+ exit 2
|
||||
+ fi
|
||||
fi
|
||||
|
||||
"$BIN/backup-eressea" "$GAME" "$TURN"
|
@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script is based on run-eressea.cron
|
||||
# differences to original
|
||||
# it is possible to run a turn with empty orders
|
||||
|
||||
eval "$(luarocks path)"
|
||||
GAME=$1
|
||||
ENABLE_EMPTY_ORDERS=$2
|
||||
(
|
||||
[ "$ENABLED" == "no" ] && exit
|
||||
[ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea"
|
||||
|
||||
export ERESSEA
|
||||
BIN="$ERESSEA/server/bin"
|
||||
TURN=$(cat "$ERESSEA/game-$GAME/turn")
|
||||
if [ ! -e "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then
|
||||
echo "data file $TURN is missing, cannot run turn for game $GAME"
|
||||
exit 1
|
||||
fi
|
||||
REPORTS="$ERESSEA/game-$GAME/reports"
|
||||
if [ -d "$REPORTS" ]; then
|
||||
rm -rf "$REPORTS"
|
||||
fi
|
||||
mkdir "$REPORTS"
|
||||
|
||||
cd "$ERESSEA/game-$GAME" || exit
|
||||
|
||||
if [ -d test ]; then
|
||||
touch test/execute.lock
|
||||
fi
|
||||
|
||||
"$BIN/create-orders" "$GAME" "$TURN"
|
||||
if [ ! -s "$ERESSEA/game-$GAME/orders.$TURN" ]; then
|
||||
if [ "$ENABLE_EMPTY_ORDERS" != "yes" ]; then
|
||||
echo "server did not create orders for turn $TURN in game $GAME"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
"$BIN/backup-eressea" "$GAME" "$TURN"
|
||||
rm -f execute.lock
|
||||
"$BIN/run-turn" "$GAME" "$TURN"
|
||||
touch execute.lock
|
||||
|
||||
if [ ! -s "$REPORTS/reports.txt" ]; then
|
||||
echo "server did not create reports.txt in game $GAME"
|
||||
exit 4
|
||||
fi
|
||||
"$BIN/backup-eressea" "$GAME" "$TURN"
|
||||
let TURN=$TURN+1
|
||||
if [ ! -s "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then
|
||||
echo "server did not create data for turn $TURN in game $GAME"
|
||||
exit 3
|
||||
fi
|
||||
echo "sending reports for game $GAME, turn $TURN"
|
||||
"$BIN/compress.sh" "$GAME" "$TURN"
|
||||
"$BIN/sendreports.sh" "$GAME"
|
||||
"$BIN/backup-eressea" "$GAME" "$TURN"
|
||||
rm -f test/execute.lock
|
||||
) | tee -a "$HOME/log/eressea.cron.log"
|
||||
|
@ -61,7 +61,7 @@ cmd_bash() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o hn -- "$@")
|
||||
args=$(getopt --name bash -o hn -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -93,7 +93,7 @@ cmd_startup() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o h -- "$@")
|
||||
args=$(getopt --name startup -o h -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -120,12 +120,24 @@ cmd_startup() {
|
||||
|
||||
mkdir -p /data/game-1
|
||||
mkdir -p /data/game-1/backup
|
||||
ln -sf /data/server/scripts/config.lua /data/game-1/config.lua
|
||||
ln -sf /data/server/bin/eressea /data/game-1/eressea
|
||||
ln -sf /data/server/scripts/reports.lua /data/game-1/reports.lua
|
||||
ln -sf /data/server/scripts/run-turn.lua /data/game-1/run-turn.lua
|
||||
ln -sf /eressea/server/scripts/config.lua /data/game-1/config.lua
|
||||
ln -sf /eressea/server/bin/eressea /data/game-1/eressea
|
||||
ln -sf /eressea/server/scripts/reports.lua /data/game-1/reports.lua
|
||||
ln -sf /eressea/server/scripts/run-turn.lua /data/game-1/run-turn.lua
|
||||
|
||||
mkdir -p /eressea/server/etc
|
||||
[ -e /eressea/server/etc/report-mail.de.txt ] && rm -f /eressea/server/etc/report-mail.de.txt
|
||||
[ -e /eressea/server/etc/report-mail.en.txt ] && rm -f /eressea/server/etc/report-mail.en.txt
|
||||
[ -e /eressea/server/etc/report-mail.txt ] && rm -f /eressea/server/etc/report-mail.txt
|
||||
ln -sf /data/config/report-mail.de.txt /eressea/server/etc/report-mail.de.txt
|
||||
ln -sf /data/config/report-mail.en.txt /eressea/server/etc/report-mail.en.txt
|
||||
ln -sf /data/config/report-mail.de.txt /eressea/server/etc/report-mail.txt
|
||||
|
||||
cd /data/game-1
|
||||
|
||||
eval `luarocks path`
|
||||
export LUA_PATH="$LUA_PATH;/eressea/server/scripts/?.lua;./?/init.lua"
|
||||
|
||||
echo "Eressea environment setup complete"
|
||||
}
|
||||
|
||||
@ -314,19 +326,25 @@ cmd_generate() {
|
||||
cat /data/game-1/eressea.ini > $tmpfile
|
||||
cat /data/config/mail.ini >> $tmpfile
|
||||
|
||||
[ -e /data/config/fetchmailrc ] && [ $force == 0 ] && rm -f /data/config/fetchmailrc
|
||||
[ -e /data/config/fetchmailrc ] && [ $force == 1 ] && rm -f /data/config/fetchmailrc
|
||||
[ ! -e /data/config/fetchmailrc ] && j2 -f ini /eressea/template-config/fetchmailrc $tmpfile > /data/config/fetchmailrc
|
||||
chmod 700 /data/config/fetchmailrc
|
||||
|
||||
[ -e /data/config/procmailrc ] && [ $force == 0 ] && rm -f /data/config/procmailrc
|
||||
[ -e /data/config/procmailrc ] && [ $force == 1 ] && rm -f /data/config/procmailrc
|
||||
[ ! -e /data/config/procmailrc ] && j2 -f ini /eressea/template-config/procmailrc $tmpfile > /data/config/procmailrc
|
||||
|
||||
[ -e /data/config/muttrc ] && [ $force == 0 ] && rm -f /data/config/muttrc
|
||||
[ -e /data/config/muttrc ] && [ $force == 1 ] && rm -f /data/config/muttrc
|
||||
[ ! -e /data/config/muttrc ] && j2 -f ini /eressea/template-config/muttrc $tmpfile > /data/config/muttrc
|
||||
|
||||
[ -e /data/config/logrotate ] && [ $force == 0 ] && rm -f /data/config/logrotate
|
||||
[ -e /data/config/logrotate ] && [ $force == 1 ] && rm -f /data/config/logrotate
|
||||
[ ! -e /data/config/logrotate ] && cp /eressea/template-config/logrotate /data/config/logrotate
|
||||
|
||||
[ -e /data/config/report-mail.de.txt ] && [ $force == 1 ] && rm -f /data/config/report-mail.de.txt
|
||||
[ ! -e /data/config/report-mail.de.txt ] && cp /eressea/template-mail/report-mail.de.txt /data/config/report-mail.de.txt
|
||||
|
||||
[ -e /data/config/report-mail.en.txt ] && [ $force == 1 ] && rm -f /data/config/report-mail.en.txt
|
||||
[ ! -e /data/config/report-mail.en.txt ] && cp /eressea/template-mail/report-mail.en.txt /data/config/report-mail.en.txt
|
||||
|
||||
rm -f $tmpfile
|
||||
|
||||
mkdir -p /data/mail/cache
|
||||
@ -363,7 +381,7 @@ cmd_map() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o hnw:e:t:s -- "$@")
|
||||
args=$(getopt --name map -o hnw:e:t:s -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -419,7 +437,7 @@ cmd_addpwd() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o hf -- "$@")
|
||||
args=$(getopt --name addpwd -o hf -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -471,7 +489,7 @@ cmd_mail() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o hcf -- "$@")
|
||||
args=$(getopt --name mail -o hcf -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -518,7 +536,7 @@ cmd_run() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
args=$(getopt --name shutdown -o h -- "$@")
|
||||
args=$(getopt --name run -o h -- "$@")
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@ -542,7 +560,7 @@ cmd_run() {
|
||||
get_turn
|
||||
enable_empty_orders="no"
|
||||
[ "$turn" == "0" ] && enable_empty_orders="yes"
|
||||
/eressea/run-eressea.sh 1
|
||||
/eressea/run-eressea.sh 1 $enable_empty_orders
|
||||
|
||||
cmd_shutdown
|
||||
}
|
||||
|
@ -17,9 +17,17 @@ ERESSEA=/data
|
||||
* ^Subject:.*{{game.mailcmd}} BEFEHLE
|
||||
| grep -v '>From' | /data/server/bin/orders-accept 1 de
|
||||
|
||||
:0:server.lock
|
||||
* ^Subject:.*{{game.mailcmd}} 1 BEFEHLE
|
||||
| grep -v '>From' | /data/server/bin/orders-accept 1 de
|
||||
|
||||
:0:server.lock
|
||||
* ^Subject:.*{{game.mailcmd}} ORDERS
|
||||
| grep -v '>From' | /data/server/bin/orders-accept 1 en
|
||||
|
||||
:0:server.lock
|
||||
* ^Subject:.*{{game.mailcmd}} 1 ORDERS
|
||||
| grep -v '>From' | /data/server/bin/orders-accept 1 en
|
||||
|
||||
:0:
|
||||
$MAILDIR/inbox/
|
||||
|
Reference in New Issue
Block a user