This is an aggregator for groups / events across a variety of services, which is then outputted on a website, in a JSON format, and a iCal file (which can be added/shown in a calendar).
OLD VERSION: https://github.com/Sean12697/MeetupManchesterTech
To start using this project, you will need to have the following programs installed:
Once you have NodeJS installed, run the following command at the root of the project to download all the dependencies:
npm i
If you wish to modify the project you will likely wish to modify the following aspects.
The source code that pulls in the groups/events from the various sources can be found in ~/_data/dataGather.js.
This script requires the declaration of class files specified with a getData()
function that returns a 2D array of [ [group], [event] ]
.
The Meetup class uses group IDs from ~/_data/sources/groupIds/meetup.js for now, which can be updated/replaced with ease (no other API requirements).
The EventBrite class uses organizations objects from ~/_data/sources/groupIds/eventbrite.js for now, which can be updated/replaced with ease.
Eventbrite does require an API key, which can be found on their website, although a Public key is being used in this example which works.
As of 12/12/19 there has been a "Event Search API Shut Down", which means an API Key/Token is required, which can be found on their website. This can be set under the environment variables as EVENTBRITE_TOKEN
, or set as the only parameter for the Eventbrite setup in the dataGather
.
The Google Calendar class can be found ~/_data/sources/googleCalendar.js, which can be initialized with another Calendar ID, with the example of the TechNW calendar below:
this.googleCalendar = new googleCalendar("[email protected]", "https://technw.uk/calendar", "TechNW", googleCalendarKey)
Once deployed, where npm start
is ran, there is no built in / automated way to update the website and pull new events by default. There are many solutions for this, often involving some type of cron job to rebuild the website on a daily basis, which is recommended due to events finishing and the potential of new events being added.
Within this repository there is a Github Action called main.yml, to configure the Cron job there are two main steps, changing the the repo name in the if statement and placing the build hook into the repositories secrets.
- if: github.repository == "inevitable-team/compiled-mcr-events"
name: Curl request
run: curl -X POST -d {} ${{ secrets.BUILD_HOOK }}
It must be noted that this is currently setup to work with the Repository being hosted on GitHub (to take advantage of Github Actions & Repository Secrets) and being deployed to Netlify.
If you do intend to use a different pipeline it is recommended to modify the code for this, or get in touch if you are facing any issues.
The line that includes inevitable-team/compiled-mcr-events
should be changed to match the main repo's name, this is to ensure that any forks of the project do not attempt to trigger the cron job as well.
If you visit https://app.netlify.com/sites/${ netlify_project_name }/settings/deploys#build-hooks
you will find the area to generate your build hook, this "give you a unique URL you can use to trigger a build".
If you wish to learn more about Build Hooks visit the Netlify Docs.
Once installed and configured, you can then run the following command:
npm run start
Which will then generate the website in the _site
folder, along with the following files within that folder:
- ical: ~/data/events.ical
- Events JSON: ~/data/events.json
- Groups JSON: ~/data/groups.json
If you wish to deploy this as a service, the recommended way would be to push it to Netlify, with npm start
as the build command and _site
as the build directory.
This project is part of the much greater CompiledMCR project (infrastructure below), meaning potentially only minor PR's will be accepted for refinements, feature updates and bug fixes.
If you do wish to fork it for another city, please do link back and a central Compiled website will be constructed soon.