Skip to content

Commit

Permalink
Merge cbaa768 into 2fb3760
Browse files Browse the repository at this point in the history
  • Loading branch information
akorosov committed Sep 29, 2019
2 parents 2fb3760 + cbaa768 commit 62e9c3a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 50 deletions.
34 changes: 5 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
language: python
sudo: false

before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -f -p $HOME/miniconda
- export PATH=$HOME/miniconda/bin:$PATH

env:
#- PYTHON_VERSION=2.7 DJANGO_VERSION=1.11.7 SQLITE_VERSION=3.13
#- PYTHON_VERSION=3.6 DJANGO_VERSION=2.0.6 SQLITE_VERSION=3.16
- PYTHON_VERSION=3.6 DJANGO_VERSION=2.1.5
services:
- docker

install:
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
#- conda create -n test_env python=$PYTHON_VERSION django=$DJANGO_VERSION sqlite gdal mock nansat pythesint coveralls -c conda-forge
- conda create -n test_env python=$PYTHON_VERSION django=$DJANGO_VERSION sqlite gdal mock basemap coveralls
#- conda uninstall numpy
- conda install -n test_env -c conda-forge nansat pythesint
- conda update -n test_env --all
- source activate test_env
- if [[ "$PYTHON_VERSION" == "2.7" ]]; then
pip install https://github.com/ghaering/pysqlite/archive/2.8.1.tar.gz;
fi
- pip install django-forms-bootstrap
- pip install django-leaflet
- pip install thredds_crawler
- python setup.py install
- echo $PROJ_LIB
- ls $PROJ_LIB
- docker build . -t geospaas
- pip install coveralls

script:
- coverage run runtests.py
- docker run --rm -it -v `pwd`:/`pwd` geospaas bash -c "cd `pwd`; coverage run runtests.py"

after_success:
- coveralls
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ ENV PYTHONUNBUFFERED=1

# Install Django
RUN pip install \
coverage \
django \
django-forms-bootstrap \
django-leaflet \
thredds_crawler \
&& echo "alias ll='ls -lh'" >> /root/.bashrc

# install Geo-SPaaS into /opt/django-geo-spaas
COPY geospaas /opt/geospaas
RUN ln -s /opt/geospaas /opt/conda/lib/python3.7/site-packages/geospaas
# install Geo-SPaaS
COPY geospaas /tmp/geospaas
COPY setup.py /tmp/
WORKDIR /tmp
RUN python setup.py install

WORKDIR /src
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ From bash you can launch: `python project/manage.py shell`.
```
docker create -it --name=geospaas \
-v `pwd`:/src \
-v `pwd`/geospaas:/opt/geospaas \
-v /input/dir/on/host:/path/to/dir/in/container \
geospaas
```
And then run `docker start -i geospaas` to go into the container and have access to commands.
6. Alretrnatively you can start the container in background:
`docker start geospaas`
and then execute commands in the runnning container:
`docker exec geospaas project/manage.py shell`
`docker exec -i geospaas project/manage.py shell`

How to use Docker for running Django-Geo-SPaaS
-----------------
If you already have a project directory or if you are working on another app you can use the
existing Docker image with Django-Geo-SPaaS. The workflow can be the following:
existing Docker image with Django-Geo-SPaaS. The image is already uploaded to Docker Hub,
so no above steps are necessary. The workflow can be the following:
1. Create a containter with necessary directories mounted
2. Start container in background
3. Run Django commands from your host:
Expand All @@ -58,7 +58,7 @@ existing Docker image with Django-Geo-SPaaS. The workflow can be the following:
docker create -it --name=myapp \
-v /host/dir/myapp:/src \
-v /data/dir:/data \
geospaas
akorosov/django-geo-spaas
# start container in background
docker start myapp
Expand All @@ -67,7 +67,7 @@ docker start myapp
docker exec myapp django-admin startproject myproject
# update settings.py and urls.py to use Geo-Django (see tests/settings.py for example)
# don;t forget to set correct name of the project and add your app to the settings.py
# don't forget to set correct name of the project and add your app to the settings.py
# migrate database schema
docker exec myapp /src/myproject/manage.py migrate
Expand Down
1 change: 0 additions & 1 deletion build_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ docker rm geospaas 2> /dev/null
# build container geospaas (mount the current directory and geospass)
docker create -it --name=geospaas \
-v `pwd`:/src \
-v `pwd`/geospaas:/opt/geospaas \
geospaas
Empty file.
Empty file.
15 changes: 3 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,16 @@
from setuptools import setup, find_packages
import sys

readme_file = 'README.md'
try:
long_description = open(readme_file).read()
except IOError:
sys.stderr.write("[ERROR] Cannot find file specified as "
"``long_description`` (%s)\n" % readme_file)
sys.exit(1)

install_requires = []

setup(name='django-geo-spaas',
version=0.1,
description='Nansen Center geospatial data management application',
long_description=long_description,
description='Geo-Scientific Platform as a Service',
zip_safe=False,
author='Morten W. Hansen, Anton Korosov',
author_email='mortenh@nersc.no, antonk@nersc.no',
url='#',
download_url='#',
url='https://github.com/nansencenter/django-geo-spaas',
download_url='https://github.com/nansencenter/django-geo-spaas/archive/master.zip',
packages = find_packages(),
include_package_data=True,
install_requires = install_requires,
Expand Down

0 comments on commit 62e9c3a

Please sign in to comment.