Getting started¶
Note
These instructions assume familiarity with Docker and Docker Compose.
Development & Production Version¶
The Project comes with 2 different Docker-Compose files wich are for development local.yml
and
production production.yml
.
The development version start the website in debug mode and bind the local path ./
to the flask
docker contaiers path /app
.
For the production version, the docker container is build with the code inside of the container. Also the production version use redis as caching backend.
Quick install (Development Version)¶
Build the docker container.
$ docker-compose -f local.yml build
Migrate all models into Elasticsearch
$ docker-compose -f local.yml run flask flask migrate_models
Load the Meetup Sandbox Group with all events.
$ docker-compose -f local.yml run flask flask get_group --sandbox True
Start the website.
$ docker-compose -f local.yml up
Now the server is listen on http://localhost:5000 for any REST API requests.
Quick install (Production Version)¶
Settings¶
At first create the directory ./.envs/.production
$ mkdir ./.envs/.production`
For flask container create a file ./.envs/.production/.flask
wich should look like:
To fill the section # Meetup.com OAuth
you need an API account from Meetup.com.
When setting up the meetup oauth account add https://you-domain.com/callback
as your
callback url & with https://you-domain.com/login
you can log in with your meetup account.
To read how to handle a boundingbox in the section # Meetup.com groups region
go to
load_zip_codes.
For Elasticsearch container create a file ./.envs/.production/.elasticsearch
wich should look
like below. For further information how to setup Elasticsearch with enviroment vars got to
https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html
Add Users¶
Frontend & backend has the same endpoint for user authentification. Both use Basic Auth from
traefik. To add a user, use htpasswd
and store the user data into compose/production/traefik/basic-auth-usersfile
. Example use in
Linux:
$ sudo apt install apache2-utils # install htpasswd
$ htpasswd -c compose/production/traefik/basic-auth-usersfile username
Setup¶
Build the docker container.
$ docker-compose -f production.yml build
Create the elasticsearch indexes.
$ docker-compose -f production.yml run flask flask migrate_models
Load Meetuup zip codes for a country.
$ docker-compose -f production.yml run flask flask load_zip_codes 47.2701114 55.099161 5.8663153 15.0418087 # germany
$ docker-compose -f production.yml run flask flask load_zip_codes 45.817995 47.8084648 5.9559113 10.4922941 # switzerland
$ docker-compose -f production.yml run flask flask load_zip_codes 46.3722761 49.0205305 9.5307487 17.160776 # austria
Load Meetuup zip codes for a country.
$ docker-compose -f production.yml run flask flask load_zip_codes 47.2701114 55.099161 5.8663153 15.0418087 # germany
$ docker-compose -f production.yml run flask flask load_zip_codes 45.817995 47.8084648 5.9559113 10.4922941 # switzerland
$ docker-compose -f production.yml run flask flask load_zip_codes 46.3722761 49.0205305 9.5307487 17.160776 # austria
Start the website.
$ docker-compose -f production.yml up -d
Conjob¶
Add a cronjob to run every week. So that every 4
weeks the elasticsearch index should be
resetet. If you want a another periode change the 4
with your periode time. But don’t use a
persiod over 30 days! It is forbidden by meetup.com!!:
0 3 * * 6 docker-compose -f production.yml run flask flask reset_index --reset_periode 4
Description what does this command do, is under reset_index.