Giter Club home page Giter Club logo

fablabs.io's Introduction

FabLabs

Build Status Code Climate Test Coverage

This is the official repository for fablabs.io platform project.

Fab labs provide widespread access to modern means for invention. They began as an outreach project from MIT’s Center for Bits and Atoms (CBA), and became into a collaborative and global network. You can find more information about Fab Labs on the Fab Foundation Website.

If you are a Fab labs entusiast and/or you would like to contribute to the project please feel free to get in touch by opening a new issue.

Getting started

Local development

  1. npm i

  2. Install ruby-bundler

  3. Install missing gems with bundle install

  4. Install and configure postgresql (arch Linux steps)

    • sudo -iu postgres
    • initdb -D /var/lib/postgres/data
    • systemctl start postgresql.service and systemctl enable postgresql.service
    • createuser --superuser unix you must do it for your username, in my case unix
  5. Install package redis and start/enable redis.service

  6. rake db:setup

  7. rails s

  8. Add this to your /etc/hosts:

    127.0.0.1 www.fablabs.local 127.0.0.1 api.fablabs.local

  9. Visit http://www.fablabs.local:3000

Tests

Run tests with:

bundle exec rake

Starting with docker-compose

  1. Add all the secrets to an .env file - Minimum example is in the env.example file

  2. Also copy cp config/application.example.yml config/application.yml

  3. Start the project:

    docker-compose up app

  4. Create database (only the first time):

    docker-compose exec app rake db:setup

    If npm does not successfully install do:

    docker-compose exec app npm i

  5. Add this to your /etc/hosts:

    127.0.0.1 www.fablabs.local

    127.0.0.1 api.fablabs.local

  6. Visit http://www.fablabs.local:3000

  7. API is served on http://api.fablabs.local:3000

  8. Add test users and data with

    docker-compose exec app rake db:seed

    This will create a normal user (email=[email protected], password=password) and an admin user (email=[email protected], password=password)

  9. Run tests with

    docker-compose exec app rake db:setup RAILS_ENV=test

    docker-compose exec app rake spec

  10. If you make changes to the code, rebuild the app and deploy the new image

    docker-compose build

    docker-compose up -d

  11. Backup your db at any time with the included script:

    ./scripts/docker-backup-db.sh
    

API Documentation

Take a look at the developer guide for information on how to integrate Fablabs.io in your application.

Check out also the API Reference, the Examples, and the fablabs.js library.

The API docs are hosted in this repo: https://github.com/fablabbcn/docs.fablabs.io

Getting an API Token

  1. Login to fablabs.io
  2. Go to the developer console (on the upper-right menu)
  3. Create a New application, or edit an existing one.
  4. Fill in the form, Redirect URI can be 'https://example.com'
  5. Submit

Copy the Personal access token

Verify the token is working with the following terminal command:

curl -X GET 'https://api.fablabs.io/0/me' -H 'Authorization: Bearer <your_personal_token>'
curl -X GET 'https://api.fablabs.io/2/labs?page=0&per_page=100'  -H 'Authorization: Bearer <your_personal_token>'

Production notes

If you are running in production:

  • you need to setup the SSL hosts and .env vars from the docker-compose.yml

  • you must define Amazon S3 env vars, all thumbnails and images depend on this:

S3_BUCKET=your_fablabs.io
S3_KEY=<amazon key>
S3_SECRET=<amazon secret>
S3_REGION=<amazon region code>
  • you need to run the assets pipeline to update public/assets

docker-compose exec app bundle exec rake tmp:clear docker-compose exec app bundle exec rake assets:precompile docker-compose restart app

Pull requests

All PRs are tested on Travis and Github Actions and Github Actions. Make sure the tests run fine.

Languages and translation

The project is now on Crowdin https://crwd.in/fablabsio

Use the i18n-tasks normalize before submitting language changes

Styleguide

There is a minimal styleguide on http://localhost:3000/styleguide

Use it and update it if you add new reusable classes

Versioning

Currently using this tool to manually handle versioning: https://github.com/gregorym/bump

Use this command to update the VERSION file + create a git tag

bump patch --tag

Then push the git tag with:

git push --tags

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL) - see the LICENSE.md file for details.

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.