-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] Run openwisp-monitor in docker (#163)
- Loading branch information
Showing
7 changed files
with
99 additions
and
11 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
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,24 @@ | ||
FROM python:3.7.5-slim-buster | ||
|
||
RUN apt update && \ | ||
apt install --yes zlib1g-dev libjpeg-dev gdal-bin libproj-dev \ | ||
libgeos-dev libspatialite-dev libsqlite3-mod-spatialite \ | ||
sqlite3 libsqlite3-dev openssl libssl-dev fping && \ | ||
rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/* | ||
|
||
COPY install-dev.sh requirements-test.txt requirements.txt /opt/openwisp/ | ||
RUN pip install -r /opt/openwisp/requirements.txt && \ | ||
pip install -r /opt/openwisp/requirements-test.txt && \ | ||
sh /opt/openwisp/install-dev.sh && \ | ||
rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/* | ||
|
||
ADD . /opt/openwisp | ||
RUN pip install -U /opt/openwisp && \ | ||
rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/* | ||
WORKDIR /opt/openwisp/tests/ | ||
ENV NAME=openwisp-monitoring \ | ||
PYTHONBUFFERED=1 \ | ||
INFLUXDB_HOST=influxdb \ | ||
REDIS_HOST=redis | ||
CMD ["sh", "docker-entrypoint.sh"] | ||
EXPOSE 8000 |
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,8 @@ | ||
#!/bin/bash | ||
|
||
# TODO: removed when openwisp-controller 0.8.0 is released | ||
pip install -U https://github.com/openwisp/openwisp-controller/tarball/master | ||
# TODO: removed when openwisp-users 0.3.0 is released | ||
pip install -U https://github.com/openwisp/openwisp-users/tarball/master | ||
# TODO: remove when openwisp-notifications 0.1 is released | ||
pip install -U https://github.com/openwisp/openwisp-notifications/tarball/master |
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,23 @@ | ||
#!/bin/bash | ||
|
||
create_superuser() { | ||
local username="$1" | ||
local email="$2" | ||
local password="$3" | ||
cat <<EOF | python manage.py shell | ||
from django.contrib.auth import get_user_model | ||
User = get_user_model() | ||
if not User.objects.filter(username="$username").exists(): | ||
User.objects.create_superuser("$username", "$email", "$password") | ||
else: | ||
print('User "{}" exists already, not created'.format("$username")) | ||
EOF | ||
} | ||
|
||
python manage.py migrate --no-input | ||
create_superuser admin [email protected] admin | ||
celery -A openwisp2 worker -l info & | ||
celery -A openwisp2 beat -l info & | ||
python manage.py runserver 0.0.0.0:8000 |
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