Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Commit

Permalink
Add new location of leaftlet location filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasabideveloper committed Aug 5, 2015
2 parents 018733d + 9c10713 commit 5085f59
Show file tree
Hide file tree
Showing 152 changed files with 4,490 additions and 2,786 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ source/test_db.sqlite3

# IDE trash
.idea/*

# ln -s docker-compose.yml compose-development.yml
docker-compose.yml
osmaxx-py/src/
# ignore environment file for local production environment
.env
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "source/excerptexport/static/excerptexport/libraries/leaflet-locationfilter"]
path = source/excerptexport/static/excerptexport/libraries/leaflet-locationfilter
[submodule "osmaxx-py/osmaxx/excerptexport/static/excerptexport/libraries/leaflet-locationfilter"]
path = osmaxx-py/osmaxx/excerptexport/static/excerptexport/libraries/leaflet-locationfilter
url = https://github.com/kajic/leaflet-locationfilter.git
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM geometalab/python3-gis

ENV USER osmaxx
# ENV USERID 1000
# ENV GROUPID 1000
# RUN groupadd -g $GROUPID $USER && useradd -g $USERID --create-home --home-dir /home/$USER -g $USER $USER

ENV HOME /home/$USER

WORKDIR $HOME/source

COPY osmaxx-py $HOME/source

ENV REQS_LAST_UPDATED 22-06-2015 14:24

RUN pip3 install -Ur requirements/local.txt
92 changes: 89 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,101 @@
# Osmaxx

Short project name for "<strong>O</strong>pen<strong>S</strong>treet<strong>M</strong>ap <strong>a</strong>rbitrary e<strong>x</strong>cerpt e<strong>x</strong>port".

Cuts out OpenStreetMap data, processes it to geodata and converts it to typical GIS fileformats before being prepared for download.
Cuts out OpenStreetMap data, processes it to geodata and converts it to typical GIS fileformats before being prepared for download.

Website: http://osmaxx.hsr.ch/


## Development
See https://github.com/geometalab/osmaxx-docs for documentations and `developmentEnvironment/` for instructions.

* [Project Repository (Git)](/docs/git-repository.md)
* [Project Development Environment (Docker)](/docs/project-development-environment.md)
* [Commonly used commands for development](/docs/useful-commands.md)
* [Deployment](/docs/deployment.md)

We do not recommend to run the application local on your machine but it's possible. We recommend to use the development docker containers.

**NOTE**: to run it locally (no docker), you might want to copy the .env-dist
to .env and adapt the lines there.


## Run it locally on Linux

### Prerequisites

To run this project locally, you need docker and docker-compose installed
(https://docs.docker.com/installation/ubuntulinux/ and https://docs.docker.com/compose/install/).


### Initialization/Docker container bootstrapping

```shell
# For development:
ln -s compose-development.yml docker-compose.yml

# For production:
ln -s compose-production.yml docker-compose.yml
```

To setup all the containers and their dependencies, run

```shell
docker-compose build
```

Then initiate the project defaults by running the following command:

```shell
# For development:
docker-compose run osmaxxwebappdev /bin/bash -c 'python3 manage.py migrate && python3 manage.py createsuperuser'

# For production:
docker-compose run osmaxxwebapp /bin/bash -c 'python3 manage.py migrate && python3 manage.py createsuperuser'
```

Alternative to this command, bootstrap the container and execute the commands inside the container by hand:

# Documentation
```shell
# For development:
docker-compose run osmaxxwebappdev /bin/bash

# For production:
docker-compose run osmaxxwebapp /bin/bash
```

Inside the container:

1. Execute migrations: `$ python3 manage.py migrate`
2. (optional, recommended) setup a superuser: `$ python3 manage.py createsuperuser`


### Running the project

Start the containers using docker compose:

```shell
docker-compose up
```


### Documentation

See Wiki: https://github.com/geometalab/osmaxx/wiki


### Problems & Solutions

#### Leaflet is missing

You forgot to **pull the submodules**


#### ProgrammingError at /login/

```
relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
```

You forgot to **run the migrations**
45 changes: 45 additions & 0 deletions compose-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
osmaxxdatabasebase:
image: geometalab/postgis:9.4

osmaxxbase:
build: .
environment:
# shared data
- DJANGO_STATIC_ROOT=/data/static
- DJANGO_MEDIA_ROOT=/data/media
- DJANGO_PRIVATE_MEDIA_ROOT=/data/private_media
# --link some-rabbit:rabbit "just works"
- DJANGO_CELERY_BROKER_URL=amqp://guest@osmaxxrabbit
- DJANGO_DATABASE_URL=postgis://postgres@osmaxxdatabase/postgres
- DJANGO_EMAIL_HOST=localhost
# Settings above likely need to be changed, depending on the environment
##########################################################################
# WARNING: restarting the server changes the secret key and thus loggs out
# other users.
- DJANGO_SECRET_KEY=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c120`
- DJANGO_EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
# EMAIL
- DJANGO_DEFAULT_FROM_EMAIL='noreply osmaxx <[email protected]>'

# SECURITY
- DJANGO_ALLOWED_HOSTS='[".osmaxx.hsr.ch.",]'

# SSL
# set this to 60 seconds and then to 518400 when you can prove it works
- DJANGO_SECURE_HSTS_SECONDS=60
- DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS=true
- DJANGO_SECURE_SSL_REDIRECT=true
- DJANGO_SECURE_SSL_HOST='osmaxx.hsr.ch'
- DJANGO_SECURE_REDIRECT_EXEMPT=[]

# OTHER SECURITY SETTINGS
- DJANGO_SECURE_CONTENT_TYPE_NOSNIFF=true
- DJANGO_SECURE_BROWSER_XSS_FILTER=true
- DJANGO_SESSION_COOKIE_SECURE=true
- DJANGO_SESSION_COOKIE_HTTPONLY=true
- DJANGO_CSRF_COOKIE_SECURE=true
- DJANGO_CSRF_COOKIE_HTTPONLY=true
- DJANGO_X_FRAME_OPTIONS='DENY'

osmaxxrabbitmqbase:
image: rabbitmq:3
69 changes: 69 additions & 0 deletions compose-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
osmaxxshareddatadev:
image: buildpack-deps:jessie
command: /bin/true
volumes:
# as noted in https://docs.docker.com/userguide/dockervolumes/#mount-a-host-file-as-a-data-volume
# the parent directory should be mounted, not the directories itself
# otherwise we get OSError: Device or resource busy
- /data

osmaxxsourcedev:
build: docker/volume-mount
volumes:
- osmaxx-py:/home/osmaxx/source
- ~/.cache/pip:/home/osmaxx/.cache/pip

osmaxxwebappdev:
extends:
file: compose-common.yml
service: osmaxxbase
command: honcho start -f Procfile.django.dev
ports:
- "8000:8000"
expose:
- "8000"
volumes_from:
- osmaxxsourcedev
- osmaxxshareddatadev
links:
- osmaxxrabbitmqdev:rabbit
- osmaxxdatabasedev
- osmaxxemaildev
- osmaxxcelerydev
environment:
- DJANGO_CELERY_BROKER_URL=amqp://guest@rabbit
- DJANGO_DATABASE_URL=postgis://postgres@osmaxxdatabasedev/postgres
- DJANGO_DEBUG=true

osmaxxrabbitmqdev:
extends:
file: compose-common.yml
service: osmaxxrabbitmqbase

osmaxxcelerydev:
extends:
file: compose-common.yml
service: osmaxxbase
command: honcho start -f Procfile.celery
volumes_from:
- osmaxxsourcedev
- osmaxxshareddatadev
links:
- osmaxxrabbitmqdev:rabbit
- osmaxxdatabasedev
- osmaxxemaildev
environment:
- DJANGO_CELERY_BROKER_URL=amqp://guest@rabbit
- DJANGO_DATABASE_URL=postgis://postgres@osmaxxdatabasedev/postgres
- DJANGO_DEBUG=true

osmaxxdatabasedev:
extends:
file: compose-common.yml
service: osmaxxdatabasebase

osmaxxemaildev:
image: python:3
ports:
- 1025:1025
command: python -m smtpd -n -c DebuggingServer 0.0.0.0:1025
64 changes: 64 additions & 0 deletions compose-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
osmaxxshareddata:
image: buildpack-deps:jessie
command: /bin/true
volumes:
- /data

# TODO: this file is only a placeholder for now!
osmaxxwebapp:
extends:
file: compose-common.yml
service: osmaxxbase
ports:
- "8000:8000"
volumes_from:
- osmaxxshareddata
command: honcho start -f Procfile.django
links:
- osmaxxrabbitmq:rabbit
- osmaxxdatabase
- osmaxxemail
- osmaxxcelery
environment:
- APP_PORT=8000
- APP_HOST=0.0.0.0
- DJANGO_CELERY_BROKER_URL=amqp://guest@rabbit
- DJANGO_DATABASE_URL=postgis://postgres@osmaxxdatabase/postgres
- DJANGO_EMAIL_USE_TLS=false
- DJANGO_EMAIL_HOST=osmaxxemail
- DJANGO_EMAIL_HOST_PASSWORD=osmaxx
- DJANGO_EMAIL_HOST_USERNAME=osmaxx
- DJANGO_EMAIL_PORT=25

osmaxxrabbitmq:
extends:
file: compose-common.yml
service: osmaxxrabbitmqbase

osmaxxcelery:
extends:
file: compose-common.yml
service: osmaxxbase
volumes_from:
- osmaxxshareddata
command: honcho start -f Procfile.celery
links:
- osmaxxrabbitmq:rabbit
- osmaxxdatabase
- osmaxxemail
environment:
- DJANGO_CELERY_BROKER_URL=amqp://guest@rabbit
- DJANGO_DATABASE_URL=postgis://postgres@osmaxxdatabase/postgres

osmaxxdatabase:
extends:
file: compose-common.yml
service: osmaxxdatabasebase

osmaxxemail:
image: catatnight/postfix
environment:
- maildomain=osmaxx.hsr.ch
- smtp_user=osmaxx:osmaxx
expose:
- 25
1 change: 0 additions & 1 deletion deployment/.gitignore

This file was deleted.

Loading

0 comments on commit 5085f59

Please sign in to comment.