hotosm / osm-export-tool

Web service to download customised OSM data in various file formats
http://export.hotosm.org/
BSD 3-Clause "New" or "Revised" License
147 stars 45 forks source link

[DEVOPS] Setup fresh stage server on Azure #494

Open kshitijrajsharma opened 1 year ago

kshitijrajsharma commented 1 year ago

Stage server should be pointed to this URL : https://export-staging.hotosm.org/ , Currently it is broken and we are trying to setup fresh with raw-data-api

eternaltyro commented 1 year ago

Standard instance on Azure with the following configuration.

Instance capacity:

Root disk: 32GB (mounted on /) Data disk: 200 GB (mounted to /data)

Applications to be installed:

  1. Ubuntu 22.04 LTS
  2. PostgreSQL server (in-situ)
  3. Redis server (in-situ)
  4. Python == 3.6.10 (installed using conda or PyPy)
  5. Node.js == 16.14

Monitoring:

  1. Jumpcloud agent
  2. Newrelic infra agent

Configuration

Sensitive strings:

  1. Mailgun SMTP credentials
  2. PostgreSQL credentials
  3. OAuth1 client ID and secret

Database configuration

Configuring OAuth app

Create OAuth1 application in OSM with Read preferences in scope. Redirect URI = https://export-stage.hotosm.org/authorized

Other packages

Scheduled jobs

Building frontend

cd ui
npm run dist
cd ..
python manage.py collectstatic
eternaltyro commented 1 year ago

Added supporting systemd files and corresponding timers and env files in this PR: https://github.com/hotosm/osm-export-tool/pull/495

eternaltyro commented 1 year ago

Export tool requires a specific (and unfortunately unsupported) version of Python to function. Old Python versions can be managed using miniconda.

$ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda-setup.sh
$ chmod +x miniconda-setup.sh && ./miniconda-setup.sh
$ export PATH=$PATH:/home/user/miniconda3/bin
$ conda config --set auto_activate_base false
$ conda create --name exports python=3.6.10 rasterio gdal rtree
$ conda activate exports 
(exports) $ python --version
Python 3.6.10 :: Anaconda, Inc.
eternaltyro commented 1 year ago

Suggested changes to env vars:

Via review to PR: https://github.com/hotosm/osm-export-tool/pull/498 And by issue: https://github.com/hotosm/osm-export-tool/issues/499

eternaltyro commented 1 year ago

Discovered that data is being shipped to Sentry using an old outdated python library called Raven. Requested removal: https://github.com/hotosm/osm-export-tool/issues/500