-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
46 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 |
---|---|---|
@@ -1,20 +1,24 @@ | ||
FROM python:2.7 | ||
|
||
FROM python:3.6 | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV DEBIAN_FRONTEND=noninteractive TERM=linux | ||
|
||
EXPOSE 8801 | ||
VOLUME ["/config", "/var/airnotifier", "/var/log/airnotifier"] | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git ca-certificates && \ | ||
mkdir -p /var/airnotifier/pemdir | ||
apt-get install -y --no-install-recommends git ca-certificates | ||
|
||
RUN pip3 install pipenv | ||
|
||
RUN git clone https://github.com/airnotifier/airnotifier.git /airnotifier | ||
RUN git clone -b 2.x https://github.com/airnotifier/airnotifier.git /airnotifier | ||
RUN mkdir -p /var/airnotifier/pemdir && \ | ||
mkdir -p /var/log/airnotifier | ||
|
||
VOLUME ["/airnotifier", "/var/log/airnotifier", "/var/airnotifier/pemdir"] | ||
WORKDIR /airnotifier | ||
|
||
RUN pip install -r requirements.txt | ||
RUN sed -i 's/https = True/https = False/g' airnotifier.conf-sample | ||
RUN pipenv install --deploy | ||
|
||
ADD start.sh /airnotifier | ||
RUN chmod a+x /airnotifier/start.sh | ||
ENTRYPOINT /airnotifier/start.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
# After staring container, don't forget to install db : | ||
# docker exec -it airnotifier python /airnotifier/install.py | ||
|
||
airnotifier: | ||
image: anthodingo/airnotifier:latest | ||
container_name: airnotifier | ||
volumes: | ||
- ./config:/config | ||
- ./certs:/var/airnotifier/pemdir | ||
- ./logs:/var/log/airnotifier | ||
ports: | ||
- 8801:8801 | ||
- 27017:27017 | ||
links: | ||
- mongodb | ||
# optionnal | ||
environment: | ||
- MONGO_SERVER=mongodb | ||
- MONGO_PORT=27017 | ||
|
||
mongodb: | ||
image: mongo:2.6 | ||
container_name: mongodb | ||
volumes: | ||
- ./db:/data/db | ||
version: "3" | ||
services: | ||
mongodb: | ||
image: mongo:latest | ||
container_name: mongodb | ||
ports: | ||
- 27017:27017 | ||
environment: | ||
- MONGO_DATA_DIR=/data/db | ||
- MONGO_LOG_DIR=/dev/null | ||
volumes: | ||
- ./db:/data/db | ||
command: mongod --logpath=/dev/null # --quiet | ||
airnotifier: | ||
links: | ||
- mongodb | ||
depends_on: | ||
- mongodb | ||
build: . | ||
container_name: airnotifier | ||
volumes: | ||
- ./certs:/var/airnotifier/pemdir | ||
- ./logs:/var/log/airnotifier | ||
ports: | ||
- 8801:8801 | ||
environment: | ||
- MONGO_SERVER=mongodb | ||
- MONGO_PORT=27017 |
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 |
---|---|---|
@@ -1,29 +1,36 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ ! -f "/config/airnotifier.conf" ]; then | ||
cp /airnotifier/airnotifier.conf-sample /config/airnotifier.conf | ||
fi | ||
if [ ! -f "/config/logging.ini" ]; then | ||
cp /airnotifier/logging.ini-sample /config/logging.ini | ||
fi | ||
export LOGDIR=/var/log/airnotifier | ||
export LOGFILE=$LOGDIR/airnotifier.log | ||
export LOGFILE_ERR=$LOGDIR/airnotifier.err | ||
|
||
if [ -f "airnotifier.conf" ]; then | ||
rm airnotifier.conf | ||
if [ ! -f "/config/config.py" ]; then | ||
cp config.py-sample config.py | ||
fi | ||
ln -s /config/airnotifier.conf | ||
|
||
if [ -f "logging.ini" ]; then | ||
rm logging.ini | ||
sed -i 's/https = True/https = False/g' ./config.py | ||
|
||
if [ ! -f "/config/logging.ini" ]; then | ||
cp logging.ini-sample logging.ini | ||
fi | ||
ln -s /config/logging.ini | ||
|
||
if [ -n "$MONGO_SERVER" ]; then | ||
sed -i "s/mongohost = \"localhost\"/mongohost = \"$MONGO_SERVER\"/g" /config/airnotifier.conf | ||
sed -i "s/mongohost = \"localhost\"/mongohost = \"$MONGO_SERVER\"/g" ./config.py | ||
fi | ||
if [ -n "$MONGO_PORT" ]; then | ||
sed -i "s/mongoport = 27017/mongoport = $MONGO_PORT/g" /config/airnotifier.conf | ||
sed -i "s/mongoport = 27017/mongoport = $MONGO_PORT/g" ./config.py | ||
fi | ||
|
||
if [ ! -f "$LOGFILE" ]; then | ||
touch "$LOGFILE" | ||
fi | ||
|
||
if [ ! -f "$LOGFILE_ERR" ]; then | ||
touch "$LOGFILE_ERR" | ||
fi | ||
|
||
echo "Starting Airnotifier ..." | ||
python airnotifier.py >> /var/log/airnotifier/airnotifier.log 2>> /var/log/airnotifier/airnotifier.err | ||
echo "Installing AirNotifier ..." | ||
pipenv run ./install.py | ||
echo "Starting AirNotifier ..." | ||
pipenv run ./app.py >> "$LOGFILE" 2>> "$LOGFILE_ERR" |