-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wb-docker: (27 commits) fixed celerybeat issues included missing dependencies no message include gunicorn update print for python 3 no message update to using django 3 and updated docker files no message remove django superviser removed unnecessary asynchronous task correctly install dotenv update backend inserted notes for docker insert get environmental variable method in init update settings configurations and added celery to docker reinserted backend compile front end implemented dockerfile for frontend updates to docker-compose add: editorconfig ... # Conflicts: # app/models.py # app/tasks.py # news/models.py # requirements.txt # settings/common.py # settings/dev.py # utils/log.py
- Loading branch information
Showing
25 changed files
with
310 additions
and
234 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,19 @@ | ||
# EditorConfig: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Matches multiple files with brace expansion notation | ||
# Set default charset | ||
[*.{js,ts}] | ||
charset = utf-8 | ||
|
||
# Indentation override for all JS under lib directory | ||
[**.js] | ||
indent_style = space | ||
indent_size = 2 |
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,21 @@ | ||
# pull official base image | ||
FROM python:3.6 | ||
|
||
# to the terminal with out buffering it first | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# prevents python from writing pyc files to disk | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
|
||
# create root directory for our project in the container | ||
RUN mkdir /app | ||
|
||
# Set the working directory to /app | ||
WORKDIR /app | ||
COPY . /app | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install pathlib | ||
RUN pip install -r /app/requirements.txt | ||
RUN apt-get update | ||
RUN apt-get install -y binutils libproj-dev gdal-bin |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,53 +1,10 @@ | ||
from datetime import datetime, timedelta | ||
|
||
from waterquality.celery import app | ||
from app import models | ||
from annoying.functions import get_object_or_None | ||
from utils.log import log | ||
from datetime import datetime, timedelta | ||
from utils.crawlers.remote_water_quality_monitoring_network import remote_water_quality_monitoring_network | ||
|
||
|
||
from app.const import ( | ||
_SENSOR_UNITS | ||
) | ||
|
||
@app.task | ||
def crawl_usgs_waterdata( daysago = 7): | ||
pass | ||
|
||
|
||
@app.task | ||
def remote_water_quality_monitoring_network_task(): | ||
log('Running Remote Water Quality Monitoring Network Parser','info') | ||
crawler = remote_water_quality_monitoring_network() | ||
for node in crawler.get(): | ||
station = get_object_or_None(models.node, name = node['station']) | ||
if not station: | ||
station = models.node() | ||
station.name = node['station'] | ||
station.sourcetype = 'live' | ||
station.devicealias = node['station'].replace(' ','_').lower() | ||
station.save() | ||
log('Station: %s (%s) created' % (station.name, station.devicealias),'info') | ||
|
||
# insert sensor data | ||
for sensor_type, unit in _SENSOR_UNITS.iteritems(): | ||
if sensor_type in ['orp']: | ||
continue | ||
|
||
data = models.data() | ||
data.source = station.sourcetype | ||
data.node_name = station.name | ||
data.node_alias =station.devicealias | ||
data.sensor_type = sensor_type | ||
data.sensor_units = unit | ||
data.lat = station.lat | ||
data.long = station.long | ||
|
||
if node[sensor_type]: | ||
data.value = round(float(node[sensor_type]), 2) | ||
else: | ||
data.value = 0.0 | ||
|
||
data.save() | ||
log('Station: %s data updated' % (station.name),'info') | ||
log('Done','success') |
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,74 @@ | ||
# REF: https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ | ||
# To build, and deploy | ||
# docker-compose up -d --build | ||
# remove from local system | ||
# docker system prune -a | ||
version: '3.7' | ||
|
||
services: | ||
redis: | ||
image: "redis:alpine" | ||
ports: | ||
- 6379:6379 | ||
volumes: | ||
- redis-data:/data | ||
|
||
nginx: | ||
build: ./nginx | ||
ports: | ||
- 1337:80 | ||
|
||
frontend: | ||
build: ./frontend | ||
volumes: | ||
- ./frontend:/app | ||
- node-modules:/app/node_modules | ||
ports: | ||
- 80:3000 | ||
depends_on: | ||
- backend | ||
- nginx | ||
|
||
backend: | ||
build: . | ||
command: gunicorn waterquality.wsgi:application --bind 0.0.0.0:8000 | ||
container_name: app | ||
env_file: | ||
- ./.env | ||
volumes: | ||
- static_volume:/app/static | ||
expose: | ||
- 8000 | ||
depends_on: | ||
- redis | ||
- nginx | ||
|
||
celery-worker: | ||
build: . | ||
command: celery -A waterquality worker -l info | ||
env_file: | ||
- ./.env | ||
depends_on: | ||
- redis | ||
|
||
celery-beat: | ||
build: . | ||
command: celery -A waterquality beat -l info | ||
env_file: | ||
- ./.env | ||
depends_on: | ||
- redis | ||
|
||
flower: | ||
image: mher/flower | ||
env_file: | ||
- ./.env | ||
ports: | ||
- 8888:8888 | ||
depends_on: | ||
- redis | ||
|
||
volumes: | ||
redis-data: | ||
node-modules: | ||
static_volume: |
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,3 @@ | ||
node_modules | ||
.git | ||
build |
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,18 @@ | ||
# REF: https://mherman.org/blog/dockerizing-a-react-app/ | ||
# BUILD Environment | ||
FROM node:8 | ||
|
||
WORKDIR /app | ||
|
||
# add `/app/node_modules/.bin` to $PATH | ||
ENV PATH /app/node_modules/.bin:$PATH | ||
|
||
COPY package.json /app/package.json | ||
|
||
RUN npm install | ||
RUN npm install [email protected] -g | ||
RUN npm rebuild node-sass | ||
|
||
COPY . ./ | ||
|
||
CMD ["npm", "start"] |
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
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,4 @@ | ||
FROM nginx:1.17.4-alpine | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY nginx.conf /etc/nginx/conf.d |
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,16 @@ | ||
upstream django { | ||
server web:8000; | ||
} | ||
|
||
server { | ||
|
||
listen 80; | ||
|
||
location / { | ||
proxy_pass http://django; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_redirect off; | ||
} | ||
|
||
} |
Oops, something went wrong.