Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS] Setup fresh stage server on Azure #494

Open
kshitijrajsharma opened this issue Mar 2, 2023 · 5 comments
Open

[DEVOPS] Setup fresh stage server on Azure #494

kshitijrajsharma opened this issue Mar 2, 2023 · 5 comments

Comments

@kshitijrajsharma
Copy link
Member

kshitijrajsharma commented Mar 2, 2023

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 eternaltyro changed the title [DEVOPS] Setup Fresh stage server [DEVOPS] Setup fresh stage server on Azure Mar 3, 2023
@eternaltyro
Copy link
Collaborator

eternaltyro commented Mar 5, 2023

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

  • CREATE DATABASE exports
  • CREATE EXTENSION postgis
  • Add exports specific database user

Configuring OAuth app

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

Other packages

  • Some java packages are required for Garmin exports.
  • osmium - for updating the planet file

Scheduled jobs

  • cleanup.py and schedule.py must be running as cron services (or systemd.timer) . Configuration and schedule to be copied from production

Building frontend

cd ui
npm run dist
cd ..
python manage.py collectstatic

@eternaltyro
Copy link
Collaborator

Added supporting systemd files and corresponding timers and env files in this PR: #495

@eternaltyro
Copy link
Collaborator

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
Copy link
Collaborator

Suggested changes to env vars:

Via review to PR: #498
And by issue: #499

@eternaltyro
Copy link
Collaborator

Discovered that data is being shipped to Sentry using an old outdated python library called Raven. Requested removal: #500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants