-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from lsetiawan/docker_test
Some changes to Fix URL Resolving and also added docker stuff
- Loading branch information
Showing
11 changed files
with
214 additions
and
59 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,46 @@ | ||
FROM miniconda:latest | ||
|
||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
|
||
LABEL description='Django admin app for Observation Data Model 2 (ODM2)' \ | ||
url='https://github.com/miguelcleon/ODM2-Admin' \ | ||
author='Miguel Leon' \ | ||
author_email='leonmi@sas.upenn.edu' \ | ||
development_status='5 - Production/Stable' \ | ||
environment='Console' \ | ||
intended_audience='Science/Research, Developers, Education' \ | ||
license='MIT License' \ | ||
operating_system='OS Independent' \ | ||
programming_language='Python' \ | ||
topic='Scientific/Engineering, Education' | ||
|
||
EXPOSE 8010 | ||
EXPOSE 5432 | ||
|
||
VOLUME /db | ||
|
||
# Setting up postgresql database | ||
RUN apt-get update --fix-missing && apt-get install -y postgresql postgresql-client postgresql-contrib postgis | ||
|
||
RUN git clone "https://github.com/lsetiawan/ODM2-Admin" | ||
|
||
RUN cd ODM2-Admin && latest=$(git describe --tags) && git checkout ${latest} | ||
|
||
RUN service postgresql start && su - postgres -c 'psql -U postgres -c "create database odm2_db"' | ||
|
||
# RUN service postgresql start && su - postgres -c 'psql -U postgres -c "create database odm2_db"' && \ | ||
# su - postgres -c 'pg_restore -d odm2_db -1 -v "/ODM2-Admin/ODM2AdminExamplePostgresqlDB"' && \ | ||
# su - postgres -c "psql -U postgres -d postgres -c \"alter user postgres with password 'test';\"" | ||
|
||
# creates an env with the depepencies | ||
RUN conda create --yes -n odm2adminenv -c conda-forge python=2.7 --file /ODM2-Admin/requirements.txt | ||
RUN update-rc.d postgresql enable | ||
|
||
COPY development.py /ODM2-Admin/templatesAndSettings/settings/ | ||
COPY entrypoint.sh / | ||
COPY startup.sh / | ||
|
||
RUN chmod 755 /entrypoint.sh | ||
RUN chmod 755 /startup.sh | ||
|
||
CMD ["/bin/bash", "entrypoint.sh", "startup.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ODM2Admin Docker Image Creation | ||
|
||
Requirements to run [docker image](https://hub.docker.com/r/lsetiawan/odm2admin/): | ||
|
||
1. ODM2 Database backup sql for PostgreSQL called odm2admindb.backup. | ||
2. Docker installed on Linux or MacOS, currently not working on windows. | ||
To run: | ||
$ docker run -d -p 8010:8010 -v path/to/local/db/backup/folder/:/db/ lsetiawan/odm2admin:latest |
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,70 @@ | ||
""" | ||
Development settings and globals. | ||
""" | ||
|
||
from base import * | ||
|
||
""" DEBUG CONFIGURATION """ | ||
# Disable debugging by default. | ||
DEBUG = True | ||
""" END DEBUG CONFIGURATION """ | ||
|
||
""" ALLOWED HOSTS CONFIGURATION """ | ||
ALLOWED_HOSTS = ['127.0.0.1',] | ||
""" END ALLOWED HOSTS CONFIGURATION """ | ||
|
||
|
||
""" EMAIL CONFIGURATION """ | ||
EMAIL_HOST = 'smtp.host' | ||
EMAIL_HOST_USER = 'user' | ||
EMAIL_HOST_PASSWORD = 'password' | ||
EMAIL_FROM_ADDRESS = 'do-not-reply-ODM2-Admin@cuahsi.org' | ||
RECAPTCHA_PUBLIC_KEY = 'googlerecaptchakey' | ||
RECAPTCHA_PRIVATE_KEY = 'googlerecaptchaprivatekey' | ||
EMAIL_USE_TLS = True | ||
EMAIL_PORT = 123 | ||
""" EMAIL CONFIGURATION """ | ||
|
||
|
||
""" DATABASE CONFIGURATION """ | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.contrib.gis.db.backends.postgis', | ||
'NAME': 'odm2_db', | ||
'USER': 'postgres', | ||
'PASSWORD': 'test', | ||
'HOST': 'localhost', | ||
'PORT': '5432', | ||
'OPTIONS': { | ||
'options': '-c search_path=public,admin,odm2,odm2extra' | ||
} | ||
} | ||
} | ||
""" END DATABASE CONFIGURATION """ | ||
|
||
|
||
""" MAP CONFIGURATION """ | ||
MAP_CONFIG = { | ||
"lat": 0, | ||
"lon": 0, | ||
"zoom": 2, | ||
"cluster_sites": False, | ||
"time_series_months": 3, | ||
"MapBox": { | ||
"access_token": 'mapboxAccessToken' | ||
}, | ||
"result_value_processing_levels_to_display": [1, 2, 3], | ||
"feature_types": ['Excavation', 'Field area', 'Weather station', | ||
'Ecological land classification', 'Observation well', 'Site','Stream gage','Transect', 'Profile','Specimen'] | ||
} | ||
""" END MAP CONFIGURATION """ | ||
|
||
|
||
""" DATA DISCLAIMER CONFIGURATION """ | ||
DATA_DISCLAIMER = { | ||
"text" : "Add a link discribing where your data come from", | ||
"linktext" : "The name of my site", | ||
"link" : "http://mysiteswegpage.page/" | ||
|
||
} | ||
""" END DATA DISCLAIMER CONFIGURATION """ |
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,14 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cmd="$1" | ||
|
||
service postgresql start | ||
|
||
until su - postgres -c "psql -U postgres -w -c '\l'"; do | ||
>&2 echo "Postgres is unavailable - sleeping" | ||
sleep 10 | ||
done | ||
|
||
>&2 echo "Postgres is up - executing command" | ||
exec bash $cmd |
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,11 @@ | ||
#!/bin/bash | ||
|
||
echo "Activating environment..." | ||
source activate odm2adminenv | ||
|
||
echo "Building database..." | ||
su - postgres -c 'pg_restore -d odm2_db -1 -v "/db/odm2admindb.backup"' | ||
su - postgres -c "psql -U postgres -d postgres -c \"alter user postgres with password 'test';\"" | ||
|
||
echo "Running server..." | ||
python /ODM2-Admin/manage.py runserver 0.0.0.0:8010 |
Binary file not shown.
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
Oops, something went wrong.