diff --git a/.gitignore b/.gitignore index 29f312c6..7886a425 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ exception.log # Pycharm .idea/ +deploy.sh +DOCKER.md +traefik.toml diff --git a/.gitmodules b/.gitmodules index 489c0de4..7173b11e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "osmtm/static/js/lib/colorselector"] path = osmtm/static/js/lib/colorselector url = https://github.com/flaute/bootstrap-colorselector.git +[submodule "tasking-manager-stats"] + path = tasking-manager-stats + url = https://github.com/AmericanRedCross/tasking-manager-stats diff --git a/Dockerfile.app b/Dockerfile.app new file mode 100644 index 00000000..8a839a90 --- /dev/null +++ b/Dockerfile.app @@ -0,0 +1,46 @@ +FROM python:2.7.12 + +RUN apt-get update \ + && apt-get install -y \ + --no-install-recommends \ + libgeos-dev \ + software-properties-common \ + python-software-properties \ + transifex-client \ + wget \ + && apt-get clean \ + && apt-get autoremove \ + && rm -r /var/lib/apt/lists/* + +RUN add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN apt-get update \ + && apt-get install -y \ + --no-install-recommends \ + postgresql-client-common \ + postgresql-client-9.6 \ + && apt-get clean \ + && apt-get autoremove \ + && rm -r /var/lib/apt/lists/* + +ADD requirements.txt /opt/app/requirements.txt +ADD setup.py /opt/app/setup.py +ADD setup.cfg /opt/app/setup.cfg +ADD README.md /opt/app/README.md +ADD CHANGELOG.md /opt/app/CHANGELOG.md + +WORKDIR /opt/app + +RUN easy_install virtualenv +RUN virtualenv --no-site-packages env +RUN ./env/bin/pip install -r requirements.txt + +ADD . /opt/app + +RUN ./env/bin/python setup.py extract_messages +RUN ./env/bin/python setup.py init_catalog -l en +RUN ./env/bin/python setup.py compile_catalog + +CMD ./env/bin/pserve --reload development.ini + +EXPOSE 6543 diff --git a/Dockerfile.db b/Dockerfile.db new file mode 100644 index 00000000..b43737d3 --- /dev/null +++ b/Dockerfile.db @@ -0,0 +1,22 @@ +FROM library/postgres:9.6 + +RUN apt-get update \ + && apt-get install -y \ + --no-install-recommends \ + postgis \ + postgresql-9.6-postgis-2.3 \ + postgresql-contrib-9.6 \ + postgresql-9.6-postgis-scripts \ + postgresql-server-dev-9.6 \ + pgtop \ + && apt-get clean \ + && apt-get autoremove \ + && rm -r /var/lib/apt/lists/* + +COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d + +RUN dpkg-query -l postgis + +RUN ls -lAh /usr/share/postgresql/9.6/extension/postgis* + +RUN echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf diff --git a/Dockerfile.static b/Dockerfile.static new file mode 100644 index 00000000..8dac03ad --- /dev/null +++ b/Dockerfile.static @@ -0,0 +1,7 @@ +FROM nginx:alpine + +RUN rm -v /etc/nginx/nginx.conf + +ADD nginx.conf /etc/nginx/ + +CMD ["nginx", "-g", "daemon off;"] diff --git a/Dockerfile.stats b/Dockerfile.stats new file mode 100644 index 00000000..48ca3f22 --- /dev/null +++ b/Dockerfile.stats @@ -0,0 +1,20 @@ +FROM python:2.7.12 + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get clean \ + && apt-get autoremove \ + && rm -r /var/lib/apt/lists/* + +ADD tasking-manager-stats/requirements.txt /opt/app/requirements.txt + +WORKDIR /opt/app + +RUN easy_install virtualenv +RUN virtualenv --no-site-packages env +RUN ./env/bin/pip install -r requirements.txt + +ADD tasking-manager-stats /opt/app + +# CMD ./env/bin/python taskingDbEndpoint.py +CMD ./run_stats.sh diff --git a/Dockerfile.web b/Dockerfile.web new file mode 100644 index 00000000..11ddde73 --- /dev/null +++ b/Dockerfile.web @@ -0,0 +1,5 @@ +FROM traefik:camembert +ADD traefik.toml . +EXPOSE 80 +EXPOSE 8080 +EXPOSE 443 diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..47ab8f4b --- /dev/null +++ b/Makefile @@ -0,0 +1,153 @@ +export SHELL := /bin/bash +.DEFAULT_GOAL := help + +# Platform-specific variables +# --------------------------- +PLATFORM_INFO:= $(shell python -m platform) +ifeq ($(findstring Ubuntu,$(PLATFORM_INFO)),Ubuntu) + PLATFORM:= ubuntu + ENV?= $(shell pwd | sed -n 's/.*osm-tasking-manager2-staging/staging/p; s/.*osm-tasking-manager2-production/production/p') +endif +ifeq ($(findstring Darwin,$(PLATFORM_INFO)),Darwin) + PLATFORM:= darwin + ENV?= development + APP_LIVE:= app + AWS_PROFILE:= hotosm +endif + +ENVS = development staging production +## Check ENV +ifeq ($(filter $(ENV),$(ENVS)),) +$(error Valid ENV values include: $(ENVS)) +endif + +# PHONY (non-file) Targets +# ------------------------ +.PHONY: build env check up destroy ps logs restart exec-app exec-db backup restore help + +## Docker + +BUILD_DB := docker build -t hotosm/taskmanager-db:$(ENV) -f ./Dockerfile.db . +BUILD_APP := docker build -t hotosm/taskmanager-app:$(ENV) -f ./Dockerfile.app . +BUILD_WEB := docker build -t hotosm/taskmanager-web:$(ENV) -f ./Dockerfile.web . +BUILD_STATS := docker build -t hotosm/taskmanager-stats:$(ENV) -f ./Dockerfile.stats . +BUILD_STATIC := docker build -t hotosm/taskmanager-static:$(ENV) -f ./Dockerfile.static . + +build: ## build containers + @$(BUILD_DB) + @$(BUILD_APP) + @$(BUILD_STATS) + @$(BUILD_STATIC) +ifeq ($(ENV),development) + @$(BUILD_WEB) +endif + +## Docker Compose + +DOCKER_COMPOSE_CLI := docker-compose -f docker-compose.yml -f docker-compose.$(ENV).yml + +ifneq ($(ENV),development) + LIVE_COLOR:=$(shell $(DOCKER_COMPOSE_CLI) ps | sed -n 's/.*blue.*Up*/blue/p; s/.*green.*Up*/green/p' | awk '{print $$1}') + APP_LIVE:= app_$(LIVE_COLOR) +endif + +ifeq ($(APP_LIVE),app_green) + APP_DEPLOY=app_blue +else + APP_DEPLOY=app_green +endif + +env: ## check live color + echo $(APP_LIVE) + +up: ## start TM2 or update current services after making compose changes +ifeq ($(ENV),development) + @$(DOCKER_COMPOSE_CLI) up -d +else ifeq ($(APP_LIVE),app_blue) + @$(DOCKER_COMPOSE_CLI) up -d db stats static app_blue +else + @$(DOCKER_COMPOSE_CLI) up -d db stats static app_green +endif + +deploy1: ## deploy + @$(BUILD_APP) + +deploy2: + @$(DOCKER_COMPOSE_CLI) up -d --force-recreate $(APP_DEPLOY) + +deploy3: + @$(DOCKER_COMPOSE_CLI) stop $(APP_LIVE) + +deploy: deploy1 deploy2 deploy3 + +destroy: ## destroy TM2 + @$(DOCKER_COMPOSE_CLI) down -v + +ps: ## ps TM2 + @$(DOCKER_COMPOSE_CLI) ps + +logs: ## logs TM2 + @$(DOCKER_COMPOSE_CLI) logs -f + +restart: ## logs confluence + @$(DOCKER_COMPOSE_CLI) restart + +stats-run: ## bash app + @$(DOCKER_COMPOSE_CLI) run stats ./env/bin/python taskingDbEndpoint.py + +stats-exec: ## bash app + @$(DOCKER_COMPOSE_CLI) run stats bash + +stats-logs: ## bash app + @$(DOCKER_COMPOSE_CLI) logs -f stats + +app-exec: ## bash app + @$(DOCKER_COMPOSE_CLI) exec $(APP_LIVE) bash + +db-exec: ## bash db + @$(DOCKER_COMPOSE_CLI) exec db bash + +static-exec: ## bash static + @$(DOCKER_COMPOSE_CLI) exec static sh + +static-logs: ## bash static + @$(DOCKER_COMPOSE_CLI) logs -f static + +psql: ## connect to database + @$(DOCKER_COMPOSE_CLI) exec db su -c "psql -h localhost -p 5432 -U postgres -d osmtm" + +migrations: + @$(DOCKER_COMPOSE_CLI) exec $(APP_LIVE) su -c "./env/bin/alembic upgrade head" + +BACKUP_BUCKET:=s3://hotosm-backups/osm-tasking-managerv2 + +backup: ## dump tm2 db and post to S3 + @$(DOCKER_COMPOSE_CLI) exec db su -c "time pg_dump -v -Fc -f /srv/osmtm2.dmp -h localhost -U postgres osmtm" + @aws s3 cp /tmp/osmtm2.dmp $(BACKUP_BUCKET)/osmtm2_$(ENV)_$(shell date +'%Y%m%d_%H%M%S').dmp + +LASTEST_BACKUP = $(shell aws s3 ls $(BACKUP_BUCKET)/ | grep -v staging | sort | tail -n 1 | awk '{print $$4}') +download-backup-s3: + @echo $(LASTEST_BACKUP) + @aws s3 cp $(BACKUP_BUCKET)/$(LASTEST_BACKUP) /tmp/osmtm2.dmp + +restore-remote: download-backup-s3 restore + +fresh-db: env + @$(DOCKER_COMPOSE_CLI) exec $(APP_LIVE) su -c "./wait-for-postgres.sh db" + @$(DOCKER_COMPOSE_CLI) stop db + @$(DOCKER_COMPOSE_CLI) rm -v -f db + @$(DOCKER_COMPOSE_CLI) up -d db + @$(DOCKER_COMPOSE_CLI) exec $(APP_LIVE) su -c "./wait-for-postgres.sh db" + +populate-db: env fresh-db + @$(DOCKER_COMPOSE_CLI) exec db su -c "psql -h localhost -U postgres -d osmtm -c 'CREATE EXTENSION postgis;'" + @echo "beginning db initialization" + @$(DOCKER_COMPOSE_CLI) exec $(APP_LIVE) su -c "./env/bin/initialize_osmtm_db" + +restore: env fresh-db ## restore latest backup from S3 + @$(DOCKER_COMPOSE_CLI) exec db su -c "pg_restore -v -h localhost -p 5432 -U postgres -d osmtm /srv/osmtm2.dmp" + +# `make help` - see http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +# ------------------------------------------------------------------------------------ +help: ## Show this help + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 00000000..f11e57c3 --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,81 @@ +version: '2' + +services: + + db: + image: hotosm/taskmanager-db:development + cpu_shares: 2 + cpuset: 0-1 + expose: + - 5432 + ports: + - "5432:5432" + networks: + - database_network + volumes: + - postgres-db-volume:/data/postgres + + app: + image: hotosm/taskmanager-app:development + labels: + - traefik.enable=true + - traefik.port=80 + - traefik.frontend.rule=Host:tasks.dev + - traefik.docker.network=traefik_net + ports: + - "6543:6543" + volumes: + - postgres-db-volume:/data/postgres + networks: + - traefik_net + - database_network + + web: + image: hotosm/taskmanager-web:development + command: -c /dev/null --web --docker --docker.domain=docker.localhost --logLevel=DEBUG + ports: + - "80:80" + - "443:443" + - "8080:8080" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./local:/tls + networks: + - traefik_net + cap_drop: + - all + cap_add: + - net_bind_service + + stats: + image: hotosm/taskmanager-stats:development + volumes: + - stats-volume:/opt/app/user_data + networks: + - database_network + + static: + image: hotosm/taskmanager-static:development + volumes: + - stats-volume:/var/www/static + expose: + - 80 + ports: + - "8081:80" + networks: + - traefik_net + labels: + - traefik.enable=true + - traefik.port=80 + - traefik.frontend.rule=Path:/user_data/ + - traefik.docker.network=traefik_net + +networks: + database_network: + driver: bridge + traefik_net: + driver: bridge + +volumes: + postgres-db-volume: + stats-volume: diff --git a/docker-compose.new.yml b/docker-compose.new.yml new file mode 100644 index 00000000..2ab15053 --- /dev/null +++ b/docker-compose.new.yml @@ -0,0 +1,91 @@ +version: '3' + +services: + + swarm-listener: + image: vfarcic/docker-flow-swarm-listener + networks: + - proxy + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - DF_NOTIF_CREATE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/reconfigure + - DF_NOTIF_REMOVE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/remove + deploy: + placement: + constraints: + - node.role == manager + + proxy: + image: vfarcic/docker-flow-proxy + ports: + - "80:80" + - "443:443" + - "8080:8080" + networks: + - proxy + environment: + - LISTENER_ADDRESS=swarm-listener + - MODE=swarm + - TIMEOUT_HTTP_REQUEST=60 + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + + db: + restart: always + image: hotosm/taskmanager-db:staging + networks: + - database_network_staging + volumes: + - postgres-db-volume-staging:/data/postgres + + stats: + image: hotosm/taskmanager-stats:staging + networks: + - database_network_staging + volumes: + - user-data-volume-staging:/opt/app/user_data + restart: always + + static: + image: hotosm/taskmanager-static:staging + networks: + - traefik_net + volumes: + - user-data-volume-staging:/var/www/static/ + labels: + - traefik.backend=static + - traefik.enable=true + - traefik.port=80 + - traefik.frontend.rule=Host:tasks.posm.hotosm.org + - traefik.frontend.rule=Path:/static/ + - traefik.docker.network=proxy_traefik_net + restart: always + + app: + image: hotosm/taskmanager-app:staging + restart: always + command: ["./wait-for-postgres.sh", "db", "./env/bin/gunicorn --paste production.ini"] + labels: + - traefik.enable=true + - traefik.frontend.rule=Host:tasks.hotosm.org + - traefik.docker.network=proxy_traefik_net + networks: + - traefik_net + - database_network_staging + extends: + service: app + +networks: + database_network_staging: + driver: bridge + traefik_net: + external: + name: proxy_traefik_net + +volumes: + postgres-db-volume-staging: + user-data-volume-staging: diff --git a/docker-compose.production.yml b/docker-compose.production.yml new file mode 100644 index 00000000..4be1e047 --- /dev/null +++ b/docker-compose.production.yml @@ -0,0 +1,49 @@ +version: '2' + +services: + + db: + restart: always + image: hotosm/taskmanager-db:production + cpu_shares: 4 + cpuset: 0-4 + networks: + - database_network_production + volumes: + - postgres-db-volume-staging:/data/postgres + + app: + restart: always + command: ["true"] + labels: + - traefik.enable=true + - traefik.docker.network=proxy_traefik_net + networks: + - traefik_net + - database_network_production + + app_green: + image: hotosm/taskmanager-app:production + command: ["./wait-for-postgres.sh", "db", "./env/bin/gunicorn --paste production.ini"] + labels: + - traefik.frontend.rule=Host:tasks.hotosm.org,tasks-green.hotosm.org + extends: + service: app + + app_blue: + image: hotosm/taskmanager-app:production + command: ["./wait-for-postgres.sh", "db", "./env/bin/gunicorn --paste production.ini"] + labels: + - traefik.frontend.rule=Host:tasks.hotosm.org,tasks-blue.hotosm.org + extends: + service: app + +networks: + database_network_production: + driver: bridge + traefik_net: + external: + name: proxy_traefik_net + +volumes: + postgres-db-volume-production: diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml new file mode 100644 index 00000000..8c936c3e --- /dev/null +++ b/docker-compose.staging.yml @@ -0,0 +1,109 @@ +version: '2' + +services: + + swarm-listener: + image: vfarcic/docker-flow-swarm-listener + networks: + - proxy + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - DF_NOTIF_CREATE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/reconfigure + - DF_NOTIF_REMOVE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/remove + deploy: + placement: + constraints: + - node.role == manager + + proxy: + image: vfarcic/docker-flow-proxy + ports: + - "80:80" + - "443:443" + - "8080:8080" + networks: + - proxy + environment: + - LISTENER_ADDRESS=swarm-listener + - MODE=swarm + - TIMEOUT_HTTP_REQUEST=60 + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + + db: + restart: always + image: hotosm/taskmanager-db:staging + networks: + - database_network_staging + volumes: + - postgres-db-volume-staging:/data/postgres + + app: + image: hotosm/taskmanager-app:staging + restart: always + command: ["true"] + + stats: + image: hotosm/taskmanager-stats:staging + networks: + - database_network_staging + volumes: + - user-data-volume-staging:/opt/app/user_data + restart: always + + static: + image: hotosm/taskmanager-static:staging + networks: + - traefik_net + volumes: + - user-data-volume-staging:/var/www/static/ + labels: + - traefik.backend=static + - traefik.enable=true + - traefik.port=80 + - traefik.frontend.rule=Host:tasks.posm.hotosm.org + # - "traefik.frontend.rule=PathPrefix:/static/" + - traefik.frontend.rule=Path:/static/ + - traefik.docker.network=proxy_traefik_net + restart: always + + app_green: + image: hotosm/taskmanager-app:staging + command: ["./wait-for-postgres.sh", "db", "./env/bin/gunicorn --paste production.ini"] + labels: + - traefik.enable=true + - traefik.frontend.rule=Host:tasks.posm.hotosm.org,tasks-green.posm.hotosm.org + - traefik.docker.network=proxy_traefik_net + networks: + - traefik_net + - database_network_staging + extends: + service: app + + app_blue: + image: hotosm/taskmanager-app:staging + command: ["./wait-for-postgres.sh", "db", "./env/bin/gunicorn --paste production.ini"] + labels: + - traefik.enable=true + - traefik.frontend.rule=Host:tasks.posm.hotosm.org,tasks-blue.posm.hotosm.org + - traefik.docker.network=proxy_traefik_net + networks: + - traefik_net + - database_network_staging + extends: + service: app + +networks: + database_network_staging: + driver: bridge + traefik_net: + external: + name: proxy_traefik_net + +volumes: + postgres-db-volume-staging: + user-data-volume-staging: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..489a3470 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' + +services: + + db: + volumes: + - /tmp:/srv + + app: + command: ["./wait-for-postgres.sh", "db", "./env/bin/pserve --reload development.ini"] + labels: + - traefik.backend=app + - traefik.port=6543 diff --git a/docker-entrypoint-initdb.d/setup.sql b/docker-entrypoint-initdb.d/setup.sql new file mode 100644 index 00000000..7533ba2c --- /dev/null +++ b/docker-entrypoint-initdb.d/setup.sql @@ -0,0 +1,7 @@ +CREATE USER "taskmanv2" WITH PASSWORD 'password'; +-- ALTER USER "taskmanv2" WITH NOSUPERUSER NOCREATEROLE NOCREATEDB; +ALTER USER "taskmanv2" WITH SUPERUSER; +CREATE DATABASE osmtm OWNER "taskmanv2" ENCODING 'UTF8' TEMPLATE template0; +\connect osmtm +-- CREATE EXTENSION postgis; +-- SELECT postgis_full_version(); diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..75c8b65f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,28 @@ +worker_processes 1; + +events { worker_connections 1024; } + +http { + sendfile on; + keepalive_timeout 65; + + gzip on; + gzip_http_version 1.0; + gzip_proxied any; + gzip_min_length 500; + gzip_disable "MSIE [1-6]\."; + gzip_types text/plain text/xml text/css + text/comma-separated-values + text/javascript + application/x-javascript + application/atom+xml; + + server { + listen 80; + location /user_data/ { + alias /var/www/static/; + autoindex on; + } + rewrite ^(.*[^/])$ $1/ permanent; + } +} diff --git a/osmtm/static/bootstrap b/osmtm/static/bootstrap index 81df608a..9b7d1406 160000 --- a/osmtm/static/bootstrap +++ b/osmtm/static/bootstrap @@ -1 +1 @@ -Subproject commit 81df608a40bf0629a1dc08e584849bb1e43e0b7a +Subproject commit 9b7d1406b922300c5d01e99026e4fffc67445185 diff --git a/osmtm/static/js/lib/Leaflet.draw b/osmtm/static/js/lib/Leaflet.draw index 8f4fb773..818af15d 160000 --- a/osmtm/static/js/lib/Leaflet.draw +++ b/osmtm/static/js/lib/Leaflet.draw @@ -1 +1 @@ -Subproject commit 8f4fb773483ded40cec3eef0b32665243e5182d2 +Subproject commit 818af15d667dcb86d3cc42ad548b24a7358af3d4 diff --git a/osmtm/static/js/lib/bootstrap-datepicker.js b/osmtm/static/js/lib/bootstrap-datepicker.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/d3.v3.js b/osmtm/static/js/lib/d3.v3.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/leaflet-control-osm-geocoder b/osmtm/static/js/lib/leaflet-control-osm-geocoder index f8335000..4a886e27 160000 --- a/osmtm/static/js/lib/leaflet-control-osm-geocoder +++ b/osmtm/static/js/lib/leaflet-control-osm-geocoder @@ -1 +1 @@ -Subproject commit f833500063e165506503ee8aae997928052c3c4a +Subproject commit 4a886e2725c6af998338f4866671f39e323aa6b8 diff --git a/osmtm/static/js/lib/leaflet.css b/osmtm/static/js/lib/leaflet.css old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/leaflet.js b/osmtm/static/js/lib/leaflet.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ar.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ar.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.az.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.az.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.bg.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.bg.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.bs.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.bs.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ca.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ca.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.cs.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.cs.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.cy.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.cy.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.da.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.da.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.de.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.de.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.el.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.el.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.en-GB.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.en-GB.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js deleted file mode 120000 index 15f14b64..00000000 --- a/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js +++ /dev/null @@ -1 +0,0 @@ -bootstrap-datepicker.en-GB.js \ No newline at end of file diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js new file mode 100644 index 00000000..a4a68cf0 --- /dev/null +++ b/osmtm/static/js/lib/locales/bootstrap-datepicker.en.js @@ -0,0 +1,17 @@ +/** + * British English translation for bootstrap-datepicker + * Xavier Dutreilh + */ +;(function($){ + $.fn.datepicker.dates['en-GB'] = { + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + today: "Today", + clear: "Clear", + weekStart: 1, + format: "dd/mm/yyyy" + }; +}(jQuery)); diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.es.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.es.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.et.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.et.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.eu.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.eu.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.fa.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.fa.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.fi.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.fi.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.fo.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.fo.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.fr-CH.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.fr-CH.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.fr.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.fr.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.gl.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.gl.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.he.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.he.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.hr.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.hr.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.hu.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.hu.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.hy.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.hy.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.id.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.id.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.is.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.is.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.it-CH.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.it-CH.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.it.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.it.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ja.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ja.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ka.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ka.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.kh.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.kh.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.kk.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.kk.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.kr.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.kr.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.lt.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.lt.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.lv.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.lv.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.mk.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.mk.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ms.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ms.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.nb.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.nb.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.nl-BE.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.nl-BE.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.nl.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.nl.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.no.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.no.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.pl.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.pl.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.pt-BR.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.pt-BR.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.pt.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.pt.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ro.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ro.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.rs-latin.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.rs-latin.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.rs.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.rs.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.ru.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.ru.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sk.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sk.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sl.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sl.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sq.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sq.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sr-latin.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sr-latin.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sr.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sr.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sv.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sv.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.sw.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.sw.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.th.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.th.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.tr.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.tr.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.uk.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.uk.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.vi.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.vi.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.zh-CN.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.zh-CN.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/locales/bootstrap-datepicker.zh-TW.js b/osmtm/static/js/lib/locales/bootstrap-datepicker.zh-TW.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/lib/shapefile-js b/osmtm/static/js/lib/shapefile-js index 12b2995e..4cf29431 160000 --- a/osmtm/static/js/lib/shapefile-js +++ b/osmtm/static/js/lib/shapefile-js @@ -1 +1 @@ -Subproject commit 12b2995e6dc7d7e728113e7f6613c421fbeab565 +Subproject commit 4cf2943147d0cbd1572e0952718b66dee7d44115 diff --git a/osmtm/static/js/lib/typeahead.bundle.js b/osmtm/static/js/lib/typeahead.bundle.js old mode 100755 new mode 100644 diff --git a/osmtm/static/js/project.js b/osmtm/static/js/project.js index 2468cd65..57bf9cf0 100644 --- a/osmtm/static/js/project.js +++ b/osmtm/static/js/project.js @@ -488,7 +488,7 @@ osmtm.project = (function() { break; } url = getLink({ - base: 'http://www.openstreetmap.org/edit?editor=id&', + base: 'http://osm.posm.hotosm.org/edit?editor=id&', bounds: task_bounds, centroid: task_centroid, protocol: 'id' diff --git a/osmtm/templates/about.mako b/osmtm/templates/about.mako index 61841737..93ae7503 100644 --- a/osmtm/templates/about.mako +++ b/osmtm/templates/about.mako @@ -14,7 +14,7 @@

${_('Sponsorship and Funding')}

${_('OSM Tasking Manager was designed and built for the Humanitarian OpenStreetMap Team.') |n} - +

${_('With the invaluable help from:') | n}

- - - - - + + + + +

@@ -61,10 +61,18 @@ ${_('Lead developer: Pierre GIRAUD (Camptocamp)')|n} ${_('with the help of other contributors.') |n}

-

${_('Version')}

-

- ${request.registry.settings['version']} -

+<% + from gitversion import determine_git_version + + try: + ver = determine_git_version('.') + url = 'https://github.com/hotosm/osm-tasking-manager2/commit/' + ver.rsplit('.',1)[1] + txt = '%s' % (url, ver) + vertxt = '

' + _('Version') + '

' + txt + '

' + except: + vertxt = '' +%> + ${vertxt |n}
diff --git a/osmtm/templates/base.mako b/osmtm/templates/base.mako index 0cc715e9..ce84acdf 100644 --- a/osmtm/templates/base.mako +++ b/osmtm/templates/base.mako @@ -5,33 +5,33 @@ ${custom.instance_name()} - ${self.title()} - - - - - - - - - + + + + + + + + + <% moment_locale_baseurl = 'osmtm:static/js/lib/moment/locale/%s.js' try: - moment_locale = request.static_url(moment_locale_baseurl % request.locale_name.replace('_', '-')) + moment_locale = request.static_path(moment_locale_baseurl % request.locale_name.replace('_', '-')) except IOError: try: - moment_locale = request.static_url(moment_locale_baseurl % request.locale_name[:2]) + moment_locale = request.static_path(moment_locale_baseurl % request.locale_name[:2]) except: moment_locale = None %> % if moment_locale: % endif - - - - - + + + + + <% from osmtm.models import DBSession, TaskComment diff --git a/osmtm/templates/home.mako b/osmtm/templates/home.mako index 21c08d88..30d22dfa 100644 --- a/osmtm/templates/home.mako +++ b/osmtm/templates/home.mako @@ -49,7 +49,7 @@ priorities = [_('urgent'), _('high'), _('medium'), _('low')] qs.pop('my_projects') %> ${_('Your projects')} × + href="${request.current_route_path('home', _query=qs.items())}">${_('Your projects')} × % endif @@ -59,7 +59,7 @@ priorities = [_('urgent'), _('high'), _('medium'), _('low')] qs.pop('show_archived') %> ${_('Include archived projects')} × + href="${request.route_path('home', _query=qs.items())}">${_('Include archived projects')} × % endif
diff --git a/osmtm/templates/label.edit.mako b/osmtm/templates/label.edit.mako index d8c7a332..ce1c01d9 100644 --- a/osmtm/templates/label.edit.mako +++ b/osmtm/templates/label.edit.mako @@ -72,6 +72,6 @@ <%block name="extrascripts"> - - + + diff --git a/osmtm/templates/markdown_ref.mako b/osmtm/templates/markdown_ref.mako index 63c0389b..84f7863d 100644 --- a/osmtm/templates/markdown_ref.mako +++ b/osmtm/templates/markdown_ref.mako @@ -112,7 +112,7 @@ ${_('Paragraphs are separated
by a blank line.')|n}
![${_('alternate text')}](http://hotosm.org/logo.png)
- ${_('alternate + ${_('alternate
diff --git a/osmtm/templates/project.description.mako b/osmtm/templates/project.description.mako index 892ba2cf..ecf60080 100644 --- a/osmtm/templates/project.description.mako +++ b/osmtm/templates/project.description.mako @@ -8,7 +8,7 @@ from osmtm.mako_filters import markdown_filter % if project.status == project.status_draft: ${_('This project is not published yet.')} % if user and user.is_project_manager: - + ${_('Publish')} % endif diff --git a/osmtm/templates/project.edit.mako b/osmtm/templates/project.edit.mako index 9ebe9cce..c6f7041e 100644 --- a/osmtm/templates/project.edit.mako +++ b/osmtm/templates/project.edit.mako @@ -5,9 +5,9 @@

${project.id} - ${project.name} - ${_('Edit')}

<%block name="content"> - - - + + + @@ -15,18 +15,18 @@ <% bootstrap_locale_baseurl = 'osmtm:static/js/lib/locales/bootstrap-datepicker.%s.js' try: - bootstrap_locale = request.static_url(bootstrap_locale_baseurl % request.locale_name.replace('_', '-')) + bootstrap_locale = request.static_path(bootstrap_locale_baseurl % request.locale_name.replace('_', '-')) except IOError: try: - bootstrap_locale = request.static_url(bootstrap_locale_baseurl % request.locale_name[:2]) + bootstrap_locale = request.static_path(bootstrap_locale_baseurl % request.locale_name[:2]) except IOError: - bootstrap_locale = request.static_url(bootstrap_locale_baseurl % 'en') + bootstrap_locale = request.static_path(bootstrap_locale_baseurl % 'en') %> - - - + + + <%block name="description"> diff --git a/osmtm/templates/project.instructions.mako b/osmtm/templates/project.instructions.mako index 23ead35e..c7ac2fc4 100644 --- a/osmtm/templates/project.instructions.mako +++ b/osmtm/templates/project.instructions.mako @@ -43,7 +43,7 @@ from osmtm.mako_filters import markdown_filter % if project.josm_preset:

<% - link = '%s' % (request.route_url('project_preset', project=project.id), _('preset')) + link = '%s' % (request.route_path('project_preset', project=project.id), _('preset')) text = _('Using JOSM? Please use the dedicated ${preset_link}.', mapping={'preset_link': link} ) %> ${text|n} diff --git a/osmtm/templates/project.mako b/osmtm/templates/project.mako index 26c8d36b..4e242b7d 100644 --- a/osmtm/templates/project.mako +++ b/osmtm/templates/project.mako @@ -88,7 +88,7 @@ else:

- + - - - - - + + + + + diff --git a/osmtm/templates/project.new.import.mako b/osmtm/templates/project.new.import.mako index 208db61a..3f5569e1 100644 --- a/osmtm/templates/project.new.import.mako +++ b/osmtm/templates/project.new.import.mako @@ -15,5 +15,5 @@

- + diff --git a/osmtm/templates/project.new.mako b/osmtm/templates/project.new.mako index 9e8156d7..48f809a9 100644 --- a/osmtm/templates/project.new.mako +++ b/osmtm/templates/project.new.mako @@ -17,13 +17,13 @@ - - - - - - - + + + + + + + - + @@ -92,7 +92,7 @@ ${_('Square Grid')}
- +

${_('Area of interest is automatically split into grid cells. Each one is a task.')}

@@ -106,7 +106,7 @@ ${_('Arbitrary Geometries')}
- +

${_('Each polygon represents a task.')}

@@ -129,7 +129,7 @@ <%block name="step3_grid">