-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to run the Hubble updater with Docker (#213)
add option to run the Hubble updater with Docker
- Loading branch information
1 parent
583e0c3
commit 323152b
Showing
4 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Run the Hubble updater with Docker | ||
|
||
FROM python:alpine | ||
|
||
# Set environment variables | ||
ENV APP_HOME /hubble-updater | ||
|
||
# Create a directory for our application | ||
# and set it as the working directory | ||
RUN mkdir $APP_HOME | ||
WORKDIR $APP_HOME | ||
|
||
# Copy over our application code | ||
ADD reports $APP_HOME/reports | ||
ADD scripts $APP_HOME/scripts | ||
ADD ./*.py $APP_HOME/ | ||
ADD ./entrypoint.sh ./*.py $APP_HOME/ | ||
|
||
# Install dependencies | ||
RUN apk add --no-cache git openssh-client | ||
|
||
# Configure job to run every 24h at at 8am. This is a bit after GHES daily | ||
# logrotate run at 6:25 and ensures we have the latest `.log.1` files available. | ||
# Attention: stderr seems not be redirect to the Docker console and I wasn't | ||
# able to make this work. | ||
RUN echo "0 8 * * * python3 $APP_HOME/update-stats.py" >/etc/crontabs/root | ||
|
||
# Run cron on container startup | ||
CMD [ "/hubble-updater/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/ash | ||
|
||
# The updater establishes a SSH connection to the GHES appliance. | ||
# Store the fingerprint of the GHES host to avoid interactive authenticity | ||
# confirmation. | ||
mkdir ~/.ssh | ||
python3 -c 'from config import *; import os; os.system("ssh-keyscan -p 122 -H " + configuration["remoteRun"]["gheHost"] + " >~/.ssh/known_hosts")' | ||
|
||
# Run the updater via cron | ||
crond -f |