Skip to content

Commit

Permalink
Merge pull request #58 from ImperialCollegeLondon/ssh-server
Browse files Browse the repository at this point in the history
Add ssh server support to drunc service
  • Loading branch information
cc-a authored Sep 10, 2024
2 parents 341da1d + 3b72175 commit c22308d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ services:
- sh
- -c
- |
drunc-process-manager file:///process-manager-no-kafka.json
service ssh start &&
drunc-process-manager --log-level debug file:///process-manager-no-kafka.json
expose:
- 10054
volumes:
Expand Down
13 changes: 12 additions & 1 deletion drunc_docker_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
FROM python:3.11-slim-bookworm

RUN apt-get update \
&& apt-get -y install --no-install-recommends git ssh \
&& apt-get -y install --no-install-recommends git ssh openssh-server \
&& rm -fr /var/lib/apt/lists/*

COPY requirements.txt /
RUN pip install --no-cache-dir -r /requirements.txt

COPY process-manager-no-kafka.json /

EXPOSE 22
RUN mkdir -p /root/.ssh && \
ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N "" && \
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys

RUN echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config && \
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
echo "UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config

RUN mkdir -p /usr/src/app
6 changes: 3 additions & 3 deletions scripts/talk_to_process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ async def create_session(pmd: ProcessManagerDriver) -> list[ProcessInstance]:
return [
item
async for item in pmd.dummy_boot(
user="DUMMY_USER",
user="root",
session_name="sess_name",
n_processes=1,
sleep=2,
n_sleeps=2,
sleep=5,
n_sleeps=4,
)
]

Expand Down

0 comments on commit c22308d

Please sign in to comment.