Skip to content

Commit

Permalink
sync with production usage
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Feb 19, 2024
1 parent 5de4cba commit a01b5e4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
14 changes: 11 additions & 3 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
FROM python:3.12-slim

# Layer 1: Install system requirements
RUN apt-get update && apt-get install -y cron python3 python3-pip

# Set the working directory
WORKDIR /app

COPY ../ /app

# Layer 2: Install python requirements
COPY requirements.txt /app
RUN pip3 install --no-cache-dir -r requirements.txt

RUN chmod +x deploy/run.sh deploy/cron.sh
# Layer 3: Set execution rights for the entrypoints
COPY . /app
RUN chmod +x deploy/run.sh deploy/cron.sh && \
mkdir -p /root/.cache/log && \
touch /root/.cache/log/cron.log && \
chmod 644 /root/.cache/log/cron.log

# Set the defult entrypoint
CMD ["/app/deploy/cron.sh"]
7 changes: 5 additions & 2 deletions deploy/cron.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

printenv > /etc/environment
(echo "$INTERVAL /app/deploy/run.sh") | crontab -
set -e
touch /root/.cache/log/cron.log
printenv | crontab -
(crontab -l; echo "$INTERVAL /app/deploy/run.sh >> /root/.cache/log/cron.log 2>&1") | crontab -
echo "Setup cron timecode: $INTERVAL"
cron -f
14 changes: 6 additions & 8 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ version: '3'
services:

train45:
image: nucypher/train45:latest
image: nucypher/train45:dev
container_name: train45
platform: linux/amd64
restart: always
env_file:
- .env
build:
context: ../
dockerfile: deploy/Dockerfile
env_file:
- .env
volumes:
- /var/log/cron.log:/var/log/cron.log
- /var/log/:/var/log/
- ~/.ape/:/root/.ape
- ~/.cache/log/:/root/.cache/log/

tail:
depends_on:
Expand All @@ -24,9 +23,8 @@ services:
container_name: tail
restart: always
volumes:
- /var/log:/var/log
- /var/log/cron.log:/var/log/cron.log
command: tail -f /var/log/cron.log
- ~/.cache/log/:/root/.cache/log/
command: tail -f /root/.cache/log/cron.log

dozzle:
depends_on:
Expand Down
6 changes: 2 additions & 4 deletions deploy/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/bin/bash

echo "Running proof bot"

cd /app

ape run proof_bot \
echo "The train is leaving the station"
ape run proof_bot \
--network $NETWORK \
--account $ACCOUNT \
--fx-root-tunnel $TUNNEL \
Expand Down

0 comments on commit a01b5e4

Please sign in to comment.