
14 changed files with 143 additions and 61 deletions
@ -0,0 +1,15 @@ |
|||||
|
# To Do |
||||
|
|
||||
|
- set up bash autocompletion for `pdm-` scripts |
||||
|
- https://stackoverflow.com/questions/11173447/how-can-i-set-up-autocompletion-for-git-commands |
||||
|
- https://askubuntu.com/questions/68175/how-to-create-script-with-auto-complete |
||||
|
- https://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion |
||||
|
- https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1 |
||||
|
- https://github.com/scop/bash-completion/blob/master/README.md |
||||
|
- make container mounts point to /srv/vol |
||||
|
- build script: separate params and build file |
||||
|
- allow overriding of install args |
||||
|
- `-o` flag? pass comma-separated list of overrides? |
||||
|
- also interactive? |
||||
|
- allow arbitrary flags for launch & build? |
||||
|
- make install script set kernel params for rootless? |
@ -1,25 +1,31 @@ |
|||||
#!/bin/sh |
#!/bin/sh |
||||
|
|
||||
|
# fail immediately if any command fails |
||||
set -e |
set -e |
||||
|
|
||||
# copy users passwd-file to /etc/dovecot and set appropriate permissions |
### Users ### |
||||
|
|
||||
|
# copy users db to dovecot config |
||||
cp /vol/db/users /etc/dovecot/users |
cp /vol/db/users /etc/dovecot/users |
||||
chown dovecot:dovecot /etc/dovecot/users |
chown dovecot:dovecot /etc/dovecot/users |
||||
|
|
||||
|
# copy users db to postfix config, but without passwords |
||||
|
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1 ./' > /etc/postfix/users |
||||
|
postmap /etc/postfix/users |
||||
|
|
||||
|
### Aliases ### |
||||
|
|
||||
# make self-referential users list |
# make self-referential users list |
||||
# this is needed for the reject_sender_login_mismatch restriction to work, |
# this is needed for the reject_sender_login_mismatch restriction to work, |
||||
# otherwise users cannot send emails as their own address |
# otherwise users cannot send emails as their own address |
||||
cd /vol/db/aliases.d |
mkdir -p /vol/db/aliases_out.d |
||||
|
cd /vol/db/aliases_out.d |
||||
echo "# This file is autogenerated by mkvirt. Don't edit it manually." > self.list |
echo "# This file is autogenerated by mkvirt. Don't edit it manually." > self.list |
||||
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1\@brbytes.org \1\n\1\@mail.brbytes.org \1/' >> self.list |
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1\@brbytes.org \1\n\1\@mail.brbytes.org \1/' >> self.list |
||||
|
|
||||
|
# copy aliases to postifx config |
||||
cd /etc/postfix |
cd /etc/postfix |
||||
|
cat /vol/db/aliases_out.d/*.list > aliases_out |
||||
# do users |
postmap aliases_out |
||||
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1 ./' > users |
cat /vol/db/aliases_in.d/*.list > aliases_in |
||||
postmap users |
postmap aliases_in |
||||
|
|
||||
# do aliases |
|
||||
cat /vol/db/aliases.d/*.list > aliases |
|
||||
postmap aliases |
|
||||
|
|
||||
|
@ -0,0 +1,12 @@ |
|||||
|
[Unit] |
||||
|
Description=Mail server virtual users startup script |
||||
|
After=network-online.target local-fs.target |
||||
|
Before=postfix.service dovecot.service |
||||
|
|
||||
|
[Service] |
||||
|
Type=oneshot |
||||
|
#RemainAfterExit=yes |
||||
|
ExecStart="/usr/local/bin/mkvirt" |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=multi-user.target |
@ -0,0 +1,77 @@ |
|||||
|
### |
||||
|
### Build Variables |
||||
|
### |
||||
|
FROM localhost/debian:latest |
||||
|
|
||||
|
# deploy options |
||||
|
# -p (port) and -v (volume) both go host:container |
||||
|
LABEL deployopts="\ |
||||
|
-p 19132:19132/udp \ |
||||
|
-p 19133:19133/udp \ |
||||
|
-v /srv/vol/minecraft_bedrock/backup:/vol/backup" |
||||
|
|
||||
|
# Build variables |
||||
|
# uid that the files owner user should have |
||||
|
ARG FILESUID=5000 |
||||
|
|
||||
|
### |
||||
|
### General Setup |
||||
|
### |
||||
|
|
||||
|
# install packages we want |
||||
|
RUN apt update -y && apt install -y libcurl4 |
||||
|
|
||||
|
# create minecraft server user with file owner UID |
||||
|
RUN addgroup --gid $FILESUID mcadmin && \ |
||||
|
adduser mcadmin --ingroup mcadmin --uid $FILESUID --disabled-password --gecos "Minecraft Server Admin" --shell /usr/sbin/nologin && \ |
||||
|
rm /home/mcadmin/.bashrc |
||||
|
|
||||
|
### |
||||
|
### Minecraft |
||||
|
### |
||||
|
|
||||
|
# download Minecraft Bedrock dedicated server |
||||
|
RUN url=$(wget -q https://www.minecraft.net/en-us/download/server/bedrock/ -O - | grep -Eo 'https://[^ ]+bin-linux/bedrock-server-[^ ]+\.zip' | head -n 1) && \ |
||||
|
wget $url && \ |
||||
|
unzip $(basename $url) && \ |
||||
|
rm $(basename $url) |
||||
|
|
||||
|
### |
||||
|
### Gitea |
||||
|
### |
||||
|
|
||||
|
# dowload gitea |
||||
|
RUN wget https://dl.gitea.io/gitea/${giteav}/gitea-${giteav}-linux-amd64 && \ |
||||
|
mv gitea /usr/local/bin/gitea && \ |
||||
|
chmod +x /usr/local/bin/gitea |
||||
|
|
||||
|
# make directories gitea needs |
||||
|
RUN mkdir -p /var/lib/gitea/ && \ |
||||
|
cd /var/lib/gitea/ && \ |
||||
|
mkdir custom data log && \ |
||||
|
chown -R gitea:gitea /var/lib/gitea/ && \ |
||||
|
chmod -R 750 /var/lib/gitea/ |
||||
|
|
||||
|
# copy gitea config template |
||||
|
COPY assets/app.ini.esh /etc/gitea/ |
||||
|
# template config file |
||||
|
RUN cd /etc/gitea/ && \ |
||||
|
esh app.ini.esh > app.ini && \ |
||||
|
rm app.ini.esh && \ |
||||
|
chmod -R +r /etc/gitea/ |
||||
|
|
||||
|
COPY assets/gitea.service /etc/systemd/system/ |
||||
|
|
||||
|
### |
||||
|
### Crontab |
||||
|
### |
||||
|
COPY assets/crontab /root/ |
||||
|
RUN crontab -u gitea /root/crontab |
||||
|
|
||||
|
### |
||||
|
### Bugfix |
||||
|
### |
||||
|
|
||||
|
# execute command to workaround bug in cron |
||||
|
COPY bugfix/cronfix /root/ |
||||
|
RUN chmod +x /root/cronfix && /root/cronfix |
@ -0,0 +1 @@ |
|||||
|
helper scripts & systemd units inspired by TapeWerm's MCscripts repo, available at https://github.com/TapeWerm/MCscripts |
Loading…
Reference in new issue