Giter VIP home page Giter VIP logo

Build Status Financial Contributors on Open Collective

πŸ“Έ πŸ“ ✊ weg.li: 1, 2, 3 - Macht die Bahn frei!

https://www.weg.li/

weg.li: 1, 2, 3 - Macht die Bahn frei!

Installation

You can either run the application locally or via Docker.

Local setup

To run weg.li locally, you'll need:

  • Ruby
  • PostgreSQL with postgis
  • NodeJS & Yarn
  • Redis

Quick setup for Linux (Ubuntu)

See this guide which guides you through installing Ruby, Rails and PostgreSQL.

Complete the setup by installing the Redis server at the end.

apt install redis

Quick setup for Mac OS

Please follow this guide if you have not ever installed Ruby on your computer.

# global setup
brew install rbenv # ruby environemnt

brew install yarn # yarn

brew install postgresql # database
brew install postgis # GIS extension for Postgresql
createuser -s postgres # create general purpose postgres user

brew install imagemagick # image-processing

# project setup
bin/setup
# install ruby runtime
rbenv install

# run this to start the rails process
script/server

Docker setup

# build the app
docker-compose build
# start services
docker-compose up
# setup database
docker-compose exec app bundle exec rails db:setup
# generate test data
docker-compose exec app bundle exec rake dev:data

Contributing

Create admin user

After installing the dependencies and running the server, you should be able to log in via β€œemail” by visiting http://localhost:3000/sessions/email and following the prompts. No email will be sent - the generated email is opened in your browser.

Once you have successfully authenticated, make your user an admin: Start the rails console (run rails c in your project directory), then enter User.last.update(access: 'admin'), which should result in => true. Now you should be able to access the admin interface at /admin.

Importing base data

For proper functionality, you need to populate your database with districts.

To fabricate random districts, run rake dev:data. This will synthesize all the kinds of data you need to get dashboards, stats, etc. working right.

If you want to get as close as possible to a β€œproduction” system, the easiest way is to import data from the production instance. Download an export format from https://www.weg.li/districts.csv (or .json) and import it into your local database. Example using the rails console (rails c):

> districts = JSON.parse(URI.open('https://www.weg.li/districts.json').read); districts.count
=> 3377
> District.insert_all!(districts.map{ |x| x.except('personal_email').merge({'flags': x['personal_email'] ? 1 : 0}) }); District.count
=> 3377

Secrets and keys

You need to set the following environment variables to enable full functionality for weg.li:

GITHUB_CONSUMER_KEY=github-key
GITHUB_CONSUMER_SECRET=github-secret

TWITTER_CONSUMER_KEY=twitter-key
TWITTER_CONSUMER_SECRET=twitter-secret

GOOGLE_CONSUMER_KEY=google-key
GOOGLE_CONSUMER_SECRET=google-secret

These are used to let users authenticate with the different providers. Learn how to create your own keys: GitHub, Twitter, Google.

In addition, weg.li uses Google Cloud Storage for storing uploaded data and Google Cloud Vision to read license plates and determine car makes and colors. You will need to create a Google Cloud Project and set up the required API access for Google Cloud Storage and Google Cloud Vision. Be aware that you might be billed for Google Cloud usage. Please refer to the Google Cloud documentation, and set the following environment variables accordingly:

GOOGLE_CLOUD_PROJECT=google-cloud-project-id
GOOGLE_CLOUD_KEYFILE=path/to/project/keyfile/gcloud.json

For local use, you can put these variables into a .env file in the project directory, and the dotenv gem will automatically make them available to your rails app. (See .env-example.)

Contributors

Code Contributors

Dieses Projekt existiert dank aller Menschen, die dazu beitragen.

Financial Contributors

Werden Sie ein finanzieller Spender und helfen Sie uns, unsere Gemeinschaft zu erhalten. [Beitragen]

Individuals

Organizations

UnterstΓΌtzen Sie dieses Projekt mit Ihrer Organisation. Ihr Logo wird hier mit einem Link zu Ihrer Website angezeigt.[Beitragen]

License

"THE (extended) BEER-WARE LICENSE" (Revision 42.0815): phoet contributed to this project.

As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me some beers in return.

weg-li's Projects

redis icon redis

Persistent Redis as a private Docker service on Render

weg-li icon weg-li

πŸ“Έ πŸ“ ✊ weg.li: 1, 2, 3 - Macht die Bahn frei!

weg-li-android icon weg-li-android

πŸ“Έ πŸ“ ✊ weg-li: 1, 2, 3 - Macht die Bahn frei!

weg-li-imagine icon weg-li-imagine

Image-Resizing and CDN for Images from GCloud-Storage as a Cloudflare Worker

weg-li-ios icon weg-li-ios

πŸ“Έ πŸ“ βœŠπŸ“± weg-li: 1, 2, 3 - iOS Client

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.