Skip to content

Commit

Permalink
Add telemetry crontab.
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanzdosilovic committed Apr 20, 2020
1 parent 41e3813 commit ec7e90e
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Expand Up @@ -4,7 +4,6 @@ Dockerfile*
docker-compose*
judge0-api.conf*
scripts/
!scripts/entrypoint
!scripts/load-config
!scripts/run-server
!scripts/run-workers
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Expand Up @@ -14,6 +14,7 @@ ENV GEM_HOME "/opt/.gem/"

RUN apt-get update && \
apt-get install -y --no-install-recommends \
cron \
libpq-dev \
sudo && \
rm -rf /var/lib/apt/lists/* && \
Expand All @@ -28,9 +29,12 @@ WORKDIR /api
COPY Gemfile* ./
RUN RAILS_ENV=production bundle

COPY cron /etc/cron.d
RUN crontab /etc/cron.d/*

COPY . .

ENTRYPOINT ["./scripts/entrypoint"]
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["./scripts/run-server"]

ENV JUDGE0_VERSION="1.6.0"
Expand Down
Binary file modified bin/telemetry
Binary file not shown.
1 change: 1 addition & 0 deletions cron/telemetry
@@ -0,0 +1 @@
* * * * * bash -c "source /api/scripts/load-config; /api/bin/telemetry > /api/log/telemetry.log 2>&1"
3 changes: 3 additions & 0 deletions docker-entrypoint.sh
@@ -0,0 +1,3 @@
#!/bin/bash
cron
exec "$@"
3 changes: 0 additions & 3 deletions scripts/entrypoint

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/load-config
@@ -1,6 +1,6 @@
#!/bin/bash
if [[ -f judge0-api.conf ]]; then
CONFIG_FILE=judge0-api.conf
if [[ -f /api/judge0-api.conf ]]; then
CONFIG_FILE=/api/judge0-api.conf
elif [[ -f /judge0-api.conf ]]; then
CONFIG_FILE=/judge0-api.conf
fi
Expand Down
3 changes: 3 additions & 0 deletions scripts/run-server
@@ -1,4 +1,7 @@
#!/bin/bash
source ./scripts/load-config

[[ -f tmp/pids/server.pid ]] && rm -f tmp/pids/server.pid

rails db:create db:migrate db:seed
rails s -b 0.0.0.0
2 changes: 2 additions & 0 deletions scripts/run-workers
@@ -1,4 +1,6 @@
#!/bin/bash
source ./scripts/load-config

run_resque=1
resque_pid=0

Expand Down

0 comments on commit ec7e90e

Please sign in to comment.