Skip to content
forked from webuildsg/webuild

📝 Robot-handpicked list of open events and open source for designers, developers and makers in Singapore

License

Notifications You must be signed in to change notification settings

shiraz1/webuild

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

We Build SG

Dependency Status Build Status Code Climate Coverage Status Gitter

We Build SG automatically curates a list of free public developer / design events from Facebook / Meetup / Eventbrite / ICS url / manual and open source projects from Github for the curious folks who love to make things in a particular city.

This repository is an example for Singapore.

Quick start

  1. clone this project and install dependancies:

    git clone git@github.com:webuildsg/webuild.git && cd webuild
    gem install foreman thor tmuxinator
    gem install dotenv -v 0.11.1
    gem install dotenv-deployment -v 0.0.2
    npm install -g bower grunt-cli
    npm i && bower install
  2. Setup environment variables. Refer Environment Variables section for more details.

    cp .env.sample .env
  3. Start the website locally with ./run.sh

Background

Repositories curated automatically every hour:

  1. Github repositories
    • user location contains Singapore
    • repos with more than 50 watchers
    • repos pushed date less than 3 months ago

Events curated automatically every hour:

  1. Facebook selected groups
  2. Meetup.com / Eventbrite event category Technology, free, has a valid location
  3. ICS url
  4. Manually added events

API endpoints

The events, repositories and podcasts data feeds are available in public as JSON format. Please refer to the list of API endpoints

Archived data

A daily snapshot of the repos and events API V1 endpoints are stored in the archives for data analysis at data.webuild.sg.

Deploy

You can deploy this app to 3 different platforms:

  1. Open Shift
  2. Heroku
  3. Bluemix

Deploy to Open Shift

We are using Open Shift for production.

These are the steps for deploying:

  1. create an application with folder .openshift with various Open Shift related configurations

  2. install client tools with gem install rhc

  3. setup the app with rhc setup

  4. create an app using cartridge - note the GIT_REMOTE_URL

  5. to ssh into your gear, use rhc ssh {APP_NAME}

  6. add the cron cartridge with rhc cartridge add cron -a {APP_NAME}

  7. set environment variables with

    rhc env-set BOT_TOKEN={secret} EVENTBRITE_TOKEN={secret} GITHUB_CLIENT_ID={secret} GITHUB_CLIENT_SECRET={secret} MEETUP_API_KEY={secret} NODE_ENV={APP_NAME} TZ=Asia/Singapore WEBUILD_API_SECRET={secret} WEBUILD_AUTH0_CLIENT_ID={secret} WEBUILD_AUTH0_CLIENT_SECRET={secret} --app {APP_NAME}
  8. add a git remote to the git config, so you can push your code to the gear

    [remote "{APP_NAME}"]
        url = {GIT_REMOTE_URL}
        fetch = +refs/heads/*:refs/remotes/{APP_NAME}/*
  9. create a build file in path .openshift/action_hooks/build for your app (if you're forking webuildsg, this is already inside the repo)

  10. make sure the build file permissions for is executable chmod +x .openshift/action_hooks/build

  11. push the app git push {APP_NAME} master --force

  12. check if the app website is up

  13. if you need to restart the app use rhc app-restart {APP_NAME}

  14. to see app info use rhc app-show {APP_NAME} -v

  15. to check out the logs from the app use rhc tail {APP_NAME}

Deploy to Heroku

These are the steps for deploying:

  1. Install Heroku command line

  2. Create new Heroku app for NodeJS

  3. Setup the following environment variables under the Heroku app settings:

    BOT_TOKEN=secret
    EVENTBRITE_TOKEN=secret
    GITHUB_CLIENT_ID=secret
    GITHUB_CLIENT_SECRET=secret
    MEETUP_API_KEY=secret
    NODE_ENV=production
    TZ=Asia/Singapore
    WEBUILD_API_SECRET=secret
    WEBUILD_AUTH0_CLIENT_ID=secret
    WEBUILD_AUTH0_CLIENT_SECRET=secret
  4. Get Heroku Scheduler add on and add 2 tasks with an hourly frequency:

    • update events every hour

       curl -X POST --data "secret=<WEBUILD_API_SECRET>" <your_production_url>/api/v1/events/update
    • update repos every hour

       curl -X POST --data "secret=<WEBUILD_API_SECRET>" <your_production_url>/api/v1/repos/update
    • store to archives repos and events every day

       curl -X POST --data "secret=<WEBUILD_API_SECRET>" <your_production_url>/api/v1/archives/update

Deploy to Bluemix

These are the steps for deploying:

  1. Install Cloud Foundry CLI

  2. Create the manifest.yml file in the root directory. Modify the name, host and env for your application:

    ---
    applications:
    - name: webuild
      host: webuild
      domain: mybluemix.net
      buildpack: sdk-for-nodejs
      command: node app.js
      path: .
      memory: 512M
      stack: cflinuxfs2
      env:
      	BOT_TOKEN: secret
        EVENTBRITE_TOKEN: secret
        GITHUB_CLIENT_ID: secret
        GITHUB_CLIENT_SECRET: secret
        MEETUP_API_KEY: secret
        NODE_ENV: production
        TZ: Asia/Singapore
        WEBUILD_API_SECRET: secret
        WEBUILD_AUTH0_CLIENT_ID: secret
        WEBUILD_AUTH0_CLIENT_SECRET: secret
  3. Create the app on Bluemix

    cf push
  4. Setup the cron job with OpenWhisk (experimental): TODO

Environment variables

Set the following environment variables on your system:

  • WEBUILD_API_SECRET (required) Used as a password when remotely refreshing the feeds.
  • MEETUP_API_KEY (required) Used to list available meetup events in Singapore.
  • EVENTBRITE_TOKEN (required) Used to list available eventbrite events in Singapore.
  • WEBUILD_AUTH0_CLIENT_ID (required): Used to retrive facebook events in Singapore. Auth0 takes care of OAuth2 social logins.
  • WEBUILD_AUTH0_CLIENT_SECRET (required): Same as above.
  • PORT (optional, default: 4000) Configures the port used by the web server.
  • LOCATION (optional, default: Singapore) The GitHub feed shows only repositories owned by developers in this area. Matches the GitHub "Location" property in user profiles.
  • MAX_USERS (optional, default: 1000) Show only repositories belonging to developers in this ranking. Only the last updated repository of a user is shown.
  • MAX_REPOS (optional, default: 50) Show up to this many total repositories.
  • GITHUB_CLIENT_ID (optional) App OAuth client ID for GitHub.
  • GITHUB_CLIENT_SECRET (optional) App OAuth client secret for GitHub.
  • NODE_ENV Environment variable. By default it is staging and for production it is production
  • BOT_TOKEN This token is used by the We Build SG Bot to store the api endpoint responses for repos and events to the archives every day. Generate a token for the Github user We Build SG Bot.

Use an external "web cron" service to periodically refresh the GitHub data feed. Keep in mind that due to GitHub API rate limiting it may take >15 minutes to retrieve the entire feed. Register a GitHub OAuth application and configure the GITHUB_CLIENT_* environment variables (see above) to increase the rate limit. Do not refresh the feed too often or the rate limit will cause it to take longer.

Create an Auth0 account (you get one free app) and a Facebook app and link them with these instructions. Configure the WEBUILD_AUTH0_CLIENT_* environment variables (see above) and add your callback url in auth0. Run the app and if all is configured well, add your fb aceess token by logging in at <localhost>/admin

Firebase related environment variables

  1. Open a Firebase account
  2. Create a new app for this project
  3. Under Login & Auth > Registered Users > Add User
  4. Note the email, password, user uid and firebase unique app url for the following variables:
    • FIREBASE_EMAIL (required): .
    • FIREBASE_PASSWORD (required)
    • FIREBASE_UID (required)
    • FIREBASE_URL (required)

Editing events list

  • Add events:
    1. Add manual events in file config/whitelistEvents.json
    • Add a Facebook groups with Facebook group ID in file config/facebookGroups.json
    • Add an *.ics format URL in file config/icsGroups.json
  • Remove events:
    • Remove paid / duplicate events in file config/blacklistEvents.json
    • Remove Meetup.com group by adding the group_id in file config/meetupBlacklistGroups.json
  • Cleanup old events manually in files events/whitelistEvents.json and events/blacklistEvents.json with grunt cleanup

Contribute

Please see CONTRIBUTING.md for details.

Versioning

Every production code has a version following the Semantic Versioning guidelines. Run the grunt bump, grunt bump:minor or grunt bump:major command to bump the version accordingly and then push to production with git push production master.

License

We Build is released under the MIT License.

About

📝 Robot-handpicked list of open events and open source for designers, developers and makers in Singapore

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 66.6%
  • HTML 31.3%
  • Shell 2.1%