Skip to content

Commit

Permalink
Make irssi vps multi-user.
Browse files Browse the repository at this point in the history
It was very pippijn-specific. Now we can have any number of users with
their own irssi vps.
  • Loading branch information
pippijn committed Nov 4, 2023
1 parent d84278e commit a8b9dc9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
7 changes: 4 additions & 3 deletions code/kubes/vps/irssi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
netcat \
openssh-server \
rsync \
screen \
vim \
&& apt-get clean
Expand All @@ -18,8 +19,8 @@ RUN groupadd -r -g 1000 irssi \

WORKDIR /home/irssi
COPY init.sh /
COPY etc /etc
RUN echo 'AuthorizedKeysFile .ssh/authorized_keys /etc/ssh/authorized_keys' >> /etc/ssh/sshd_config \
&& chmod 644 /etc/screenrc \
COPY etc /etc/
COPY home /home/
RUN chmod 644 /etc/screenrc \
&& mkdir /etc/ssh_keys
ENTRYPOINT ["/init.sh"]
10 changes: 10 additions & 0 deletions code/kubes/vps/irssi/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ fi
ln -sf /etc/ssh_keys/* /etc/ssh/
touch /etc/ssh_keys/.stamp

# Make "irssi" user accessible for the VPS owner. Run this command as the
# irssi user, otherwise root may change file ownership.
if [ ! -f .ssh/authorized_keys ]; then
echo "Copying initial home for $IRSSI_USER"
su - irssi -c "rsync -avrP /home/$IRSSI_USER/ /home/irssi"
fi

# Start screen for "irssi" user. It's up to the user what that does exactly,
# but the default /etc/screenrc launches irssi.
su - irssi -c 'screen -d -m'

while true; do
echo "Starting health endpoint"
# TODO: implement actual health check
Expand Down
3 changes: 3 additions & 0 deletions code/kubes/vps/irssi/irssi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
- name: irssi
image: xinutec/irssi:latest
imagePullPolicy: Always
env:
- name: IRSSI_USER
value: pippijn
ports:
- containerPort: 22
resources:
Expand Down
11 changes: 11 additions & 0 deletions code/kubes/vps/irssi/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -eux

docker build -t xinutec/irssi:test .
docker run \
--name irssi-test \
--rm \
-p 2345:22 \
--env IRSSI_USER=pippijn \
-it xinutec/irssi:test

0 comments on commit a8b9dc9

Please sign in to comment.