Skip to content

OpenChurch est une plateforme d'open-data de l'église catholique visant à faciliter la création de produits et services. Les données principales sont les églises et leurs position.

License

Notifications You must be signed in to change notification settings

hozana/openchurch

Repository files navigation

openchurch

CircleCI BrowserStack Status

They help us

BrowserStack is a useful tool to test our app on different browsers, different OS and different versions. They give free access to their platform to open-source projects. Thanks to them!

A few commands

Quick start

To build and start the app:

# build docker image
cp .env.dist .env
docker-compose build
docker-compose up

# install
docker exec -it openchurch composer install
docker exec -it openchurch yarn install
docker exec -it openchurch sh -c "cd openchurch-admin && yarn install"
docker exec -it openchurch yarn run dev

# import database
mysql -uopenchurch -popenchurch -h 127.0.0.1 -P 13306 openchurch < data/20180806-openchurch.sql
docker exec -it openchurch bin/console doctrine:schema:update --force

# index data in ES
docker exec -it openchurch bin/console fos:elastica:populate

# run API
docker exec -it openchurch bin/console server:run 0.0.0.0:8000

# run backoffice
docker exec -it openchurch sh -c "cd openchurch-admin && npm start"

Check API works on http://127.0.0.1:1819. And backoffice on http://127.0.0.1:3000.

Docker

Always rebuild openchurch after modification.

Then you should have three instances:

docker ps
CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                                                NAMES
1651a84b55b9        hozana/openchurch                                     "/data/scripts/docke…"   51 seconds ago      Up 50 seconds       0.0.0.0:3000->3000/tcp, 0.0.0.0:8000->8000/tcp, 0.0.0.0:1819->80/tcp openchurch
7c9484d9ca5f        docker.elastic.co/elasticsearch/elasticsearch:6.3.2   "/usr/local/bin/dock…"   2 minutes ago       Up 51 seconds       0.0.0.0:9200->9200/tcp, 9300/tcp                                     elasticsearch
f368935297ef        mysql:latest                                          "docker-entrypoint.s…"   16 minutes ago      Up 51 seconds       33060/tcp, 0.0.0.0:13306->3306/tcp                                   db

If you need to directly hit inside our custom container:

docker exec -it openchurch bash
mysql -h 127.0.0.1 -P 13306 -u openchurch --protocol=tcp -p

To start

  • cp .env.dist .env && vim .env to setup your own environment.
  • docker exec -it openchurch bin/console doctrine:migration:migrate
  • composer install && yarn install && cd openchurch-admin && yarn install to install all dependencies.

Database

To generate our schema we first used vendor/bin/schema generate-types config/schema.yaml to have the PHP entities generated from yaml and schema.org. But as these generated entities has been modified, we could just remove the schema-generator and the schema.yaml file.

  • bin/console doctrine:schema:update --force to update database
  • or bin/console doctrine:migrations:diff to create a migration,
  • and bin/console doctrine:migrations:migrate to run the migration.

To start the API

To test the app: bin/console server:run in project root folder and then reach http://127.0.0.1:8000. There is also a GraphiQL interface to help you write down your GraphQL requests : http://localhost:8000/api/graphql.

  • To create a oAuth2 client to test the API: bin/console oauth:client:create client_credentials (or use the upcoming web interface).
  • To fill Elasticsearch: bin/console fos:elastica:populate.
  • To generate the assets yarn run dev (and yarn run watch while developing).

To start the react app

This app is provided by API Platform. It connects to the PHP API and autodiscover it.

cd openchurch-admin
npm start

Then http://localhost:3000 should be automatically opened. In openchurch-admin/src/App.js you can define the API's URL : it's the only configuration.

To synchronize the database from Wikidata

cd scripts
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
PYWIKIBOT_NO_USER_CONFIG=1 python3 synchro.py

If you need to override the MySQL configuration of your .env file:

DB_HOST=127.0.0.1 DB_PORT=13306 PYWIKIBOT_NO_USER_CONFIG=1 python3 synchro.py

For Elasticsearch

On a VM:

docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.2
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2

Deployment

Follow these guidelines to setup prod server. Lost server? Here is the process to restore db backup.

API usage example

TODO

About

OpenChurch est une plateforme d'open-data de l'église catholique visant à faciliter la création de produits et services. Les données principales sont les églises et leurs position.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published