Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ meirim Public
forked from meirim-org/meirim

The citizens for cities initialive will produce an online platform to help organization and collaboration in urban politics.

License

Notifications You must be signed in to change notification settings

florpor/meirim

 
 

Repository files navigation

Meirim.org

Codacy Badge

The goal of this project is to empower citizens to effectively organize for their quality of life in their cities and to ensure information about protests is accessible.

Getting Started

This project is under development and has three main parts - backend, frontend and crawler.

Setup instructions for development

Prerequisites

Things you need to install:

  • Git
  • Node.js (we currently support release 8.x)
  • MySQL (required only for the backend & crawler)

Once you have these you can download the code and install dependencies:

$ git clone [email protected]:meirim-org/meirim.git
$ cd meirim/
$ npm install

Instructions for backend

Connect to your MySQL instance:

$ mysql -uroot -p

Create a database for the project:

CREATE DATABASE meirim character set UTF8 collate utf8_bin;
exit;

Edit the local configuration file (located at config/local.json) and set your database connection details and email smtp settings (if needed).

Install knex globally and run all migrations:

$ npm install knex -g
$ knex migrate:latest

Finally, run the service:

$ npm run api

The service will then be available on port 3001.

Instructions for frontend

Nothing needs to be set up specifically for the frontend (however a working backend service would make it a bit more useful). It can be started using:

$ npm start

And will then be available at http://localhost:3000

Running both backend and frontend

Both the api and the frontend need to be run separately when developing for the auto-reload capabilities of webpack-dev-server. The api will run on port 3001 by default, and the frontend will run on port 3000 and proxy requests destined to the api from any path beginning with "/api" to the service at port 3001 (proxy settings live in src/setupProxy.js).

$ npm run api
$ npm start

Instructions for crawler

To run the crawler (for testing or just seeding the database with plan data) you must first install all dependencies required by Chromium (which is used by puppeteer) which vary from system to system.

If puppeteer is not working properly, check the project's troubleshooting information.

To run the crawler (can be killed at any time using Ctrl+C):

$ npm run crawl

Running in production

We use pm2 to run the service in production.

First you must build the frontend react site, then the service (serving both the backend and frontend) can be started:

$ npm run build
$ pm2 start ecosystem.config.js --env production

Set up cron to schedule two jobs - crawling for new data and emailing alerts to users:

$ crontab -e
0 0 * * *  cd /path_to_code/meirim/ && NODE_ENV='production' /usr/bin/node /path_to_code/meirim/bin/iplan >> /path_to_code/meirim/logs/combined.log 2>&1
* * * * *  cd /path_to_code/meirim/ && NODE_ENV='production' /usr/bin/node /path_to_code/meirim/bin/send_emails >> /path_to_code/meirim/logs/combined.log 2>&1

Further info

You can find more technical info about the project under the docs folder.

Contributing

We are thankful for any comments, suggestions, issue reports and pull requests anyone might wish to help with. We will do our best to acknowledge, review and reply to these contributions to the best of our abilities (we are all volunteers).

For methods of communicating with us, please see our website.

Authors

See the list of contributors who participated in this project <3.

License

This project is licensed under the MIT License - see the LICENSE.md file for details. The rest is licensed under a Creative Commons Attribution 4.0 International License.

About

The citizens for cities initialive will produce an online platform to help organization and collaboration in urban politics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 54.6%
  • JavaScript 43.1%
  • CSS 2.3%