diff --git a/.github/workflows/osmit-build.yml b/.github/workflows/osmit-build.yml new file mode 100644 index 0000000000..119b826e43 --- /dev/null +++ b/.github/workflows/osmit-build.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: + - osm-ita + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: 'Build Backend Image' + run: | + docker build . -f ./scripts/docker/Dockerfile.backend --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$GITHUB_SHA --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:latest + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$GITHUB_SHA + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:latest + - name: 'Build Frontend Image' + run: | + cp osmit-frontend.env tasking-manager.env + docker build . -f ./scripts/docker/Dockerfile.frontend --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$GITHUB_SHA --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:latest + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$GITHUB_SHA + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:latest + + \ No newline at end of file diff --git a/backend/__init__.py b/backend/__init__.py index 2fc585d103..adc4051bd5 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -1,3 +1,6 @@ +import gevent.monkey +gevent.monkey.patch_ssl() + import logging import os from logging.handlers import RotatingFileHandler diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 86f7d7ce89..8e4a84267a 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -12,6 +12,9 @@ services: <<: *backend volumes: - .:/usr/src/app + labels: + - traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api/`) + - traefik.http.services.backend.loadbalancer.server.port=5000 # Migration service migration: diff --git a/docker-compose.yml b/docker-compose.yml index 1032c4b914..a945866df7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.4" x-backend-config: &backend - image: hotosm-tasking-manager:backend + image: ghcr.io/gisdevio/osmit-tm-backend:latest env_file: ${ENV_FILE:-tasking-manager.env} depends_on: - postgresql @@ -18,7 +18,7 @@ services: container_name: backend restart: always labels: - - traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api/`) + - traefik.http.routers.backend.rule=Host(`osmit-tm4.wmcloud.org`) && PathPrefix(`/api/`) - traefik.http.services.backend.loadbalancer.server.port=5000 migration: @@ -28,12 +28,12 @@ services: command: python manage.py db upgrade frontend: - image: hotosm-tasking-manager:frontend + image: ghcr.io/gisdevio/osmit-tm-frontend:latest restart: always networks: - tm-web labels: - - traefik.http.routers.frontend.rule=Host(`localhost`) + - traefik.http.routers.frontend.rule=Host(`osmit-tm4.wmcloud.org`) - traefik.http.services.frontend.loadbalancer.server.port=80 postgresql: @@ -43,6 +43,8 @@ services: env_file: ${ENV_FILE:-tasking-manager.env} networks: - tm-web + volumes: + - /srv/postgresql:/var/lib/postgresql/data traefik: image: traefik:v2.3 diff --git a/frontend/package.json b/frontend/package.json index ddf6ad9b94..93d36082f9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,7 +28,7 @@ "@turf/truncate": "^6.5.0", "@uiw/react-md-editor": "^3.20.2", "RapiD": "facebookincubator/rapid#rapid-v1.1.9-tm.1", - "axios": "^0.27.2", + "axios": "^1.4.0", "chart.js": "^3.7.1", "chartjs-adapter-date-fns": "^2.0.0", "date-fns": "^2.29.3", diff --git a/frontend/public/assets/high.jpeg b/frontend/public/assets/high.jpeg new file mode 100644 index 0000000000..c626ded593 Binary files /dev/null and b/frontend/public/assets/high.jpeg differ diff --git a/frontend/public/assets/logo.svg b/frontend/public/assets/logo.svg new file mode 100644 index 0000000000..5f3b5c18b5 --- /dev/null +++ b/frontend/public/assets/logo.svg @@ -0,0 +1,2309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Aury88 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 010110010011010110010011 + 010110010011010110010011 + + + + + diff --git a/frontend/src/assets/img/footer.jpg b/frontend/src/assets/img/footer.jpg index 6d66eaa0dd..6dca9a3ec4 100644 Binary files a/frontend/src/assets/img/footer.jpg and b/frontend/src/assets/img/footer.jpg differ diff --git a/frontend/src/assets/styles/_extra.scss b/frontend/src/assets/styles/_extra.scss index ef5718148d..7ff6d8ea1f 100644 --- a/frontend/src/assets/styles/_extra.scss +++ b/frontend/src/assets/styles/_extra.scss @@ -89,7 +89,7 @@ html { @media screen and (min-width: 60em) { .bg-split-blue-white { - background: linear-gradient(to right, $blue-dark, $blue-dark 80%, $white 20%, $white); + background: linear-gradient(to right, $red-light, $red-light 80%, $white 20%, $white); } .f-4rem-l { @@ -112,7 +112,7 @@ html { } .bg-split-blue-white { - background: linear-gradient(to bottom, $blue-dark, $blue-dark 80%, $white 20%, $white); + background: linear-gradient(to bottom, $red-light, $red-light 80%, $white 20%, $white); } } diff --git a/frontend/src/assets/styles/_variables.scss b/frontend/src/assets/styles/_variables.scss index 5253d90567..627e995166 100644 --- a/frontend/src/assets/styles/_variables.scss +++ b/frontend/src/assets/styles/_variables.scss @@ -1,8 +1,8 @@ /* Color palette */ -$red: #d73f3f; -$red-light: #ffeded; -$orange: #faa71e; -$blue-dark: #2c3038; +$red: #990000; +$red-light: #006699; +$orange: #7ebc6f; +$blue-dark: #006699; $blue-light: #929db3; $blue-grey: #68707f; $washed-blue: rgba(146, 157, 179, 0.1); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 813473ea2d..49f30d5a6b 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -4747,13 +4747,14 @@ axe-core@^4.0.2: resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz" integrity sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ== -axios@^0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== +axios@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" + integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== dependencies: - follow-redirects "^1.14.9" + follow-redirects "^1.15.0" form-data "^4.0.0" + proxy-from-env "^1.1.0" axobject-query@^2.2.0: version "2.2.0" @@ -7941,10 +7942,10 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" -follow-redirects@^1.0.0, follow-redirects@^1.14.9: - version "1.15.1" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" - integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA== +follow-redirects@^1.0.0, follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== for-each@^0.3.3: version "0.3.3" @@ -13139,6 +13140,11 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + prr@~1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz" diff --git a/osmit-frontend.env b/osmit-frontend.env new file mode 100644 index 0000000000..2f2eec2a88 --- /dev/null +++ b/osmit-frontend.env @@ -0,0 +1,61 @@ +# Tasking Manager configuration file + +# Copy to `example.env` and adjust to make it work! +# + +# The TM_APP_BASE_URL defines the URL of the frontend and is used by the backend +# to configure links on emails and some authentication callbacks. +# On development instances it should be 127.0.0.1:3000 or localhost:3000 +# On production instances, use the public URL of your frontend +TM_APP_BASE_URL=https://osmit-tm4.wmcloud.org + +# The TM_APP_API_URL defines the URL of your backend server. It will be used by +# both the backend and by the frontend +# On development instances it should be 127.0.0.1:5000 or localhost:5000 +# On production instances, use the public URL of your backend +TM_APP_API_URL=$TM_APP_BASE_URL/api/ + +# Defines the version of the API and will be used after /api/ on the url +TM_APP_API_VERSION=v2 + +# Information about the hosting organization +# +TM_ORG_NAME="Wikimedia Italia" +TM_ORG_CODE=WMI +# Don't use http or https on the following two variables +TM_ORG_URL=www.wikimedia.it/wikimedia-per-la-conoscenza-libera/wikimedia-per-open-mapping/ +TM_ORG_PRIVACY_POLICY_URL=www.wikimedia.it/privacy-tasking-manager/ +TM_ORG_TWITTER=https://twitter.com/WikimediaItalia +TM_ORG_FB=https://www.facebook.com/Wikimedia.Italia +TM_ORG_INSTAGRAM=https://www.instagram.com/wikimediaitalia/ +TM_ORG_YOUTUBE=https://www.youtube.com/user/wikimediaitalia + +TM_HOMEPAGE_IMG_HIGH=/assets/high.jpeg +TM_HOMEPAGE_IMG_LOW=/assets/high.jpeg +TM_ORG_LOGO=/assets/logo.svg + +# Information about the OSM server - Customize your server here +# By default, it's the public OpenStreetMap.org server +OSM_SERVER_URL=https://www.openstreetmap.org +OSM_NOMINATIM_SERVER_URL=https://nominatim.openstreetmap.org +OSM_REGISTER_URL=https://www.openstreetmap.org/user/new +TM_USER_STATS_API_URL=https://osm-stats-production-api.azurewebsites.net/users/ +TM_HOMEPAGE_STATS_API_URL=https://osmstats-api.hotosm.org/wildcard?key=hotosm-project-* +TM_DEFAULT_CHANGESET_COMMENT="#osmitaly" + +# Old Keys +# TM_CLIENT_ID=6F2cnsll1f09q0zZGave7fUUFsK0IvI3pkdMZn44 +# TM_CLIENT_SECRET=ybSCy2L9W2memiTidp3XCawKIZkeRX8OcdjN1Uun + +# OSM OAUTH2 +TM_CLIENT_ID=8rtzjOMHNke9-FSmv_9BDusWvuhEOB6SNAQnq2JEG34 +TM_CLIENT_SECRET=pnHE1IJwHvF_Dp-JgQyGxDqaI9w3bi4ivAwMTAsFt10 + +# Redirect uri registered while creating OAuth2 application (required) +TM_REDIRECT_URI=https://osmit-tm4.wmcloud.org/authorized + +# Scope of TM defined while creating OAuth2 application (required) +TM_SCOPE=read_prefs write_api + +TM_IMPORT_MAX_FILESIZE=1000000 +TM_MAX_AOI_AREA=5000 diff --git a/scripts/docker/Dockerfile.frontend b/scripts/docker/Dockerfile.frontend index cd702e697b..1aac471dbe 100644 --- a/scripts/docker/Dockerfile.frontend +++ b/scripts/docker/Dockerfile.frontend @@ -1,4 +1,4 @@ -FROM tiangolo/node-frontend:10 as build +FROM node:16 as build WORKDIR /usr/src/app/frontend COPY frontend . @@ -12,7 +12,7 @@ RUN npm run build FROM nginx:stable-alpine COPY --from=build /usr/src/app/frontend/build /usr/share/nginx/html -COPY --from=build /nginx.conf /etc/nginx/conf.d/default.conf +COPY scripts/docker/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/scripts/docker/nginx.conf b/scripts/docker/nginx.conf new file mode 100644 index 0000000000..ed11d3aa19 --- /dev/null +++ b/scripts/docker/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } + + include /etc/nginx/extra-conf.d/*.conf; +}