• Stars
    star
    510
  • Rank 86,627 (Top 2 %)
  • Language
    Ruby
  • License
    Other
  • Created over 5 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hacktoberfest - App to manage the annual open-source challenge, used for the 2019 & 2020 seasons.

Hacktoberfest

GitHub stars GitHub issues GitHub forks GitHub language count GitHub top language
Snyk Vulnerabilities for GitHub Repo

Hacktoberfest-2020 Logo

Features

  • Static pages
  • Airtable backed events and FAQs
  • Issue discovery by language
  • Log in with GitHub
  • Multi-step registration
  • Pull request timeline
  • Challenge completion validation
  • Prize distribution

Components

There are three major components that are entirely separate from one another:

  1. Issue discovery - Fetches issues from GitHub with the label hacktoberfest and persists them in the database to be featured on the homepage based on a randomized quality filter.

  2. Content pages - Primarily static pages that are supplemented with dynamic data from Airtable.

  3. Participant management - Allows users to register to participate in Hacktoberfest, tracks user progress, and distributes prizes based on availability. The majority of the business logic is implemented with a state machine, validating that various conditions are met before a user may be transitioned to a new state and with certain actions being triggered on successful state transitions.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Ensure your os is the latest MacOS

  • Have brew installed (Run the following command in a mac os terminal to install):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Application Setup

  1. Install and Setup
  2. Local Setup With Docker
  3. Setup Oauth Token
  4. Configure remaining environment variables
  5. Create first user
  6. Import Projects

Installing

Clone the repo:

git clone https://github.com/digitalocean/hacktoberfest

In your local repository, run script/setup, which will install all necessary dependencies for you:

script/setup

Local Setup With Docker

If you would like to use Docker to work with the application, first make sure that you have Docker and Docker Compose on your local machine.

Next clone the repo as described in Step 1.

From there, create a local .env file, and add fill out the following values, using steps 3 and 4 to guide you:

HACKTOBERFEST_DATABASE_HOST=database
HACKTOBERFEST_DATABASE_USERNAME=hacktoberfest
HACKTOBERFEST_DATABASE_PASSWORD=sekret
HACKTOBERFEST_API_KEY=sekret
REDIS_HOST=redis
REDIS_PORT=6379
DALLI_SERVER=memcached
GITHUB_CLIENT_ID=<fill-in-for-dev-setup>
GITHUB_CLIENT_SECRET=<fill-in-for-dev-setup>
START_DATE=<fill-in-for-dev-setup>
RULES_DATE=<fill-in-for-dev-setup-same-as-start>
END_DATE=<fill-in-for-dev-setup>
AIRTABLE_API_KEY=<fill-in-for-dev-setup>
AIRTABLE_APP_ID=<fill-in-for-dev-setup>
SEGMENT_WRITE_KEY=<leave-blank>
TEST_USER_GITHUB_TOKEN=<leave-blank>

Note: Use the following values when setting up your Oauth token:

> Homepage URL: `http://localhost`\
> Authorization callback URL: `http://localhost/auth/github/callback`

The local Docker setup uses a webserver, in the same way that the application does in staging and production, so it will be reachable on port 80.

Run the startup script, ./script/docker-startup.sh to start your services.

Note: You do not need to use the other startup scripts in the repo if you are using Docker to run the application locally. When using Docker, follow the steps in this section of the README.

Inspecting and Troubleshooting

You can inspect whether or not your services have started successfully by running the check script: ./script/check.sh. You will see the following output if the services are all running:

         Name                         Command               State           Ports         
-------------------------------------------------------------------------------------------
hacktoberfest_app_1         ./script/docker-entrypoint.sh    Up      3000/tcp              
hacktoberfest_database_1    docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp
hacktoberfest_redis_1       docker-entrypoint.sh redis ...   Up      6379/tcp              
hacktoberfest_sidekiq_1     ./script/sidekiq-entrypoint.sh   Up      3000/tcp              
hacktoberfest_webserver_1   nginx -g daemon off;             Up      0.0.0.0:80->80/tcp    

In cases where you need to investigate an exit status, you can get the logs of the service with docker-compose logs <service-name>.

To check that the application is ready to accept traffic, run docker-compose logs app. You should see the following output:

app_1        | ==> Hacktoberfest is now ready to go!
app_1        | => Booting Puma
app_1        | => Rails 5.2.3 application starting in development 
app_1        | => Run `rails server -h` for more startup options
app_1        | Puma starting in single mode...
app_1        | * Version 4.1.1 (ruby 2.5.8-p224), codename: Fourth and One
app_1        | * Min threads: 5, max threads: 5
app_1        | * Environment: development
app_1        | * Listening on tcp://0.0.0.0:3000
app_1        | Use Ctrl-C to stop

Once the app is running, you can connect to it by navigating to localhost. Please note that trying to connect to the app at localhost before it is ready will result in 502 Bad Gateway error, so be sure to check the logs first.

Testing

If you would like to run commands against your app service, you can do that with the following command (using rubocop as an example):

./script/test-command.sh bundle exec rubocop app config db lib spec --safe-auto-correct

Or to run a particular spec:

./script/test-command.sh bundle exec rspec <your-spec-file>

Running migrations

In cases where you want to create a migration in the context of your current development, you can use the following command:

docker-compose exec app rails g migration <your migration>

To run the migration, type:

docker-compose exec app bundle exec rake db:migrate

In both cases, the relevant files and changes will be available on your host, as well as on your container.

If the app is currently stopped and you need to run migrations, you can use the restart-app script, which will restart the app and run any pending migrations. See the explanation below for more detail.

Reloading the server

There are cases where you will need to stop and restart the Rails server, in order for things like configuration changes to take effect.

To do this, run the following script to stop and restart the app: ./script/restart-app.sh.

This will restart the app and run any pending migrations.

Adding a new gem to the project

Another task you may need to accomplish is adding a new gem to the project. Because this local Docker setup depends on a gem volume (to speed up development and boot times), you need to both stop the application and remove this volume for your changes to take effect.

To do this, run the following script: ./script/rebuild-app.sh.

Taking the setup down

To stop your services and remove the network, you can run docker-compose down.

Or, if you would like to remove your build cache and volumes, you can use the stop-and-clean script: ./script/stop-and-clean.sh.

Setup Oauth Token

Hacktoberfest uses GITHUB_CLIENT_ID & GITHUB_CLIENT_SECRET variables to configure OmniAuth.

This allows users to be authorized for Hacktoberfest via Github.

For this, you will have to create a Github OAuth App (https://developer.github.com/apps/building-oauth-apps)

Be sure your OAuth app is configured with the following URLs

Oauth Config

Homepage URL: http://localhost:3000
Authorization callback URL: http://localhost:3000/auth/github/callback

The Client ID and Client Secret are right above this configuration. Use them to set the following ENV variables:

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

ENV Variables

Start Date & End Date

Hacktoberfest is officially active from October 1st - October 31st (in any timezone)

The app can be in three different states:

  • Pre-launch
    • Users can sign up and all pages are reachable, but the profile page is not yet tracking pull requests
  • Active
    • All pages are active and the profile is tracking PRs
  • Finished
    • Hacktoberfest has declared its winners

So your dates can look something like this if you're developing in October 2019 and you want the app in the Active state.

 START_DATE="2019-09-30 10:00:00 UTC"
 END_DATE="2019-11-01 12:00:00 UTC"

(These timestamps account for the furthest positive UTC offset (+14 in Kiribati), where they’ll see 1st Oct 00:00 on 30th Sept 10:00 UTC and the furthest negative UTC offset (-12 in the US Outlying Islands), where they’ll see 1st Nov 00:00 on 1st Nov 12:00 UTC).

If you want to work on the app in the Pre-Launch state, set the start date to a future date. If you want to work on the app in the Finished state, set the end date to a past date.

Airtable API Key & Airtable App ID

Hacktoberfest uses Airtable as a CMS to hold useful data such as:

  • Events
  • FAQ
  • Spam Repositories

For your convenience we have created two options:

Create an Airtable Database:

We created a read-only copy of what the Airtable database should look like.

With this you can create your own schema by following this format: (https://airtable.com/shrqM142bVC1Gj2t8)

After you’ve created and configured the schema of an Airtable base from the graphical interface,

your Airtable base will provide its own API to create, read, update, and destroy records.

You should update these variables accordingly in your .env

Use Placeholder Airtable Service

If configuring your own Airtable schema does not sound like your cup of tea - don't fret.

We have created placeholder service objects that will render test data if your Airtable keys are not set.

This service will be used as default.

You can find this service in app/services/airtable_placeholder_service.rb

Create First User

  1. Spin up the server by running script/server

  2. Now, open your browser of choice and visit localhost:3000

  3. Click START HACKING on the top right of the navigation bar

start hacking

  1. Log in with your github account

  2. Agree to the terms and conditions and continue

Import Projects

This task imports repositories to the hacktoberfest app(these are displayed on the homepage). If you don't run the task, there simply won't be any repositories on the homepage aside from the hard-coded climate change repos.

  1. Spin up sidekiq:
script/sidekiq
  1. In a separate terminal window, run the import script:
bin/rails github:fetch_popular_languages_projects

Running the project

There are two commands you will need for running the project.

First, spin up the rails server locally:

script/server

If you will be running any background jobs through sidekiq, run the following command in a separate terminal window from script/server which will spin up both redis and sidekiq:

script/sidekiq

Contributing

Hacktoberfest is open source and we welcome contributions. See CONTRIBUTING.md for more info.

Code of Conduct

This project uses the Contributor Covenant Code of Conduct. See CODE_OF_CONDUCT.md for more info.

Credits

The Hacktoberfest app is built and maintained for DigitalOcean by developers from Raise.dev.

License

Licensed under the MIT License. The full license text is available in LICENSE.md.

More Repositories

1

nginxconfig.io

⚙️ NGINX config generator on steroids 💉
JavaScript
27,244
star
2

doctl

The official command line interface for the DigitalOcean API.
Go
3,155
star
3

godo

DigitalOcean Go API client
Go
1,328
star
4

go-libvirt

Package libvirt provides a pure Go interface for interacting with Libvirt. Apache 2.0 Licensed.
Go
815
star
5

do_user_scripts

Shell
804
star
6

Kubernetes-Starter-Kit-Developers

Hands-on tutorial and Automation stack for an operations-ready DigitalOcean Kubernetes (DOKS) cluster.
HCL
748
star
7

go-qemu

Go packages to interact with QEMU using the QEMU Machine Protocol (QMP). Apache 2.0 Licensed.
Go
719
star
8

do-agent

Collects system metrics from DigitalOcean Droplets
Go
586
star
9

csi-digitalocean

A Container Storage Interface (CSI) Driver for DigitalOcean Block Storage
Go
572
star
10

clusterlint

A best practices checker for Kubernetes clusters. 🤠
Go
544
star
11

vulcan

Vulcan extends Prometheus adding horizontal scalability and long-term storage
Go
531
star
12

digitalocean-cloud-controller-manager

Kubernetes cloud-controller-manager for DigitalOcean (beta)
Go
520
star
13

droplet_kit

DropletKit is the official DigitalOcean API client for Ruby.
Ruby
507
star
14

terraform-provider-digitalocean

Terraform DigitalOcean provider
Go
492
star
15

action-doctl

GitHub Actions for DigitalOcean - doctl
JavaScript
454
star
16

ceph_exporter

Prometheus exporter that scrapes meta information about a ceph cluster.
Go
396
star
17

engineering-code-of-conduct

Code of Conduct for DigitalOcean's Engineering Team
289
star
18

go-openvswitch

Go packages which enable interacting with Open vSwitch and related tools. Apache 2.0 Licensed.
Go
282
star
19

kubernetes-sample-apps

Example DigitalOcean Kubernetes workload with service exposed through a DO load-balancer.
Python
252
star
20

marketplace-partners

Image validation, automation, and other tools for DigitalOcean Marketplace Vendors and Custom Image users
Shell
193
star
21

gta

gta: do transitive analysis to find packages whose dependencies have changed
Go
182
star
22

heartbot

A shot of love for your favorite chat client.
CoffeeScript
178
star
23

marketplace-kubernetes

This repository contains the source code and deployment scripts for Kubernetes-based applications listed in the DigitalOcean Marketplace.
Shell
159
star
24

prometheus-client-c

A Prometheus Client in C
C
154
star
25

go-smbios

Package smbios provides detection and access to System Management BIOS (SMBIOS) and Desktop Management Interface (DMI) data and structures. Apache 2.0 Licensed.
Go
152
star
26

kartograph

Kartograph makes it easy to generate and convert JSON. It's intention is to be used for API clients.
Ruby
147
star
27

OpenVPN-Pihole

https://marketplace.digitalocean.com/apps/openvpn-pihole
Shell
146
star
28

captainslog

A Syslog Protocol Parser
Go
136
star
29

resource_kit

Resource Kit provides tools to aid in making API Clients. Such as URL resolving, Request / Response layer, and more.
Ruby
134
star
30

go-workers2

better-go-workers
Go
131
star
31

supabase-on-do

HCL
129
star
32

droplet-1-clicks

Packer build scripts for DigitalOcean Marketplace 1-clicks.
Shell
114
star
33

doks-debug

A Docker image with Kubernetes manifests for investigation and troubleshooting.
Dockerfile
109
star
34

openapi

The OpenAPI v3 specification for DigitalOcean's public API.
JavaScript
104
star
35

sample-dockerfile

⛵ App Platform sample Docker application.
Go
92
star
36

container-blueprints

DigitalOcean Kubernetes(DOKS) Solution Blueprints
HCL
92
star
37

app_action

Deploy to DigitalOcean Container Registry and App Platform
Go
90
star
38

DOKS

Managed Kubernetes designed for simple and cost effective container orchestration.
80
star
39

pydo

Official DigitalOcean Python Client based on the DO OpenAPIv3 specification
Python
78
star
40

do-markdownit

Markdown-It plugin for the DigitalOcean Community.
JavaScript
77
star
41

do-operator

The Kubernetes Operator for DigitalOcean
Go
76
star
42

navigators-guide

Book and code examples that help to build infrastructure on DigitalOcean
Shell
76
star
43

sample-django

Django sample app for DigitalOcean App Platform
Python
76
star
44

logtalez

logtalez is a minimal command line client (and API) for retrieving log streams from the rsyslog logging daemon over zeromq.
Go
73
star
45

databases

66
star
46

sample-nodejs

⛵ App Platform sample Node.js application.
JavaScript
65
star
47

sample-nextjs

⛵ App Platform sample Next.js application.
JavaScript
61
star
48

debian-sys-maint-roll-passwd

Script to update password for MySQL user "debian-sys-maint"
Shell
58
star
49

sample-python

⛵ App Platform sample Python application.
Python
57
star
50

vmtop

Real-time monitoring of KVM/Qemu VMs
Python
54
star
51

kubecon-2022-doks-workshop

HCL
48
star
52

k8s-staticroute-operator

Create static routes for your k8s nodes using CRDs.
Python
48
star
53

sample-flask

Sample Flask Application to be deployed on DigitalOcean's App Platform
HTML
48
star
54

pgremapper

CLI tool for manipulating Ceph's upmap exception table.
Go
46
star
55

sample-laravel

⛵ App Platform sample Laravel application.
PHP
45
star
56

sample-golang

⛵ App Platform sample Golang application.
Go
40
star
57

sample-functions-nodejs-qrcode

HTML
39
star
58

sample-monorepo

Sample mono repo app (with multiple components) on the DigitalOcean App Platform.
Go
38
star
59

tos

DigitalOcean's Terms of Service agreement
37
star
60

droplet-agent

Droplet Agent is the daemon that runs on customer droplets to enable some features such as web console access.
Go
37
star
61

ansible-collection

DigitalOcean Ansible Collection
Python
34
star
62

sample-php

⛵ App Platform sample PHP application.
PHP
33
star
63

openvswitch_exporter

Command openvswitch_exporter implements a Prometheus exporter for Open vSwitch.
Go
32
star
64

sample-html

⛵ App Platform sample HTML application.
HTML
31
star
65

sample-functions-nodejs-helloworld

JavaScript
31
star
66

sample-react

⛵ App Platform sample React application.
JavaScript
30
star
67

mastodon-on-kubernetes

Setting up Mastodon on DigitalOcean Kubernetes
HCL
30
star
68

sample-functions-python-jokes

Python
30
star
69

flipop

Floating IP Controller for Kubernetes
Go
29
star
70

marketplace-pi-hole-vpn

Pi-hole VPN image for Marketplace with Unbound & Wireguard
Shell
29
star
71

sample-functions-golang-helloworld

Go
29
star
72

go-metadata

Go client for the metadata API.
Go
27
star
73

github-changelog-generator

A tool to generate changelog entries from GitHub repositories.
Go
26
star
74

omniauth-digitalocean

DigitalOcean OAuth2 Strategy for OmniAuth
Ruby
26
star
75

sample-push-to-deploy-doks

Push-to-deploy example using DOCR and DOKS
Python
25
star
76

netbox-ip-controller

A Kubernetes controller to import the IP addresses and metadata of pods and services into NetBox.
Go
25
star
77

sample-functions-python-helloworld

Python
23
star
78

terraform-vault-github-oidc

Terraform module to configure Vault for GitHub OIDC authentication from Action runners.
HCL
22
star
79

terraform-provider-sendgrid

Sendgrid Terraform Provider
Go
20
star
80

sample-expressjs

⛵ App Platform sample Express.js application.
19
star
81

sample-nuxtjs

⛵ App Platform sample Nuxt.js application.
Vue
19
star
82

production-ready-kubernetes-workshop

The repository for DigitalOcean's Production Ready Kubernetes Workshop
Python
18
star
83

sample-vuejs

⛵ App Platform sample Vue.js application.
Vue
17
star
84

sample-functions-python-twilio-sms

Sending sms via Twilio
Python
16
star
85

sample-functions-php-helloworld

A PHP helloworld sample function for Cloud Functions
PHP
15
star
86

sample-rails

⛵ App Platform sample Ruby on Rails application.
Ruby
15
star
87

sample-functions-php-numberstowords

PHP
15
star
88

sample-hugo

⛵ App Platform sample Hugo application.
15
star
89

sample-functions-python-sendgrid-email

Sending emails via Sendgrid API
Python
14
star
90

github-pr-resource

Github pull request resource for Concourse
Go
13
star
91

icingaweb2-module-netboximport

Icinga2 Director integration for Netbox
PHP
12
star
92

docker-shipit-engine

Docker image for https://github.com/Shopify/shipit-engine
Ruby
11
star
93

sample-functions-golang-presigned-url

Creating a presigned url for DO's Spaces
Go
10
star
94

digitalocean-ceph-lab

Terraform and Ansible automation to provision and configure a Ceph test environment on DigitalOcean.
HCL
10
star
95

k8s-adoption-journey

Hands-on tutorial for going from Day-1 to production on DigitalOcean Kubernetes. Goes with "Kubernetes Adoption Journey" document.
Python
9
star
96

sample-laravel-api

⛵ App Platform sample Laravel API application.
PHP
9
star
97

gnulib

A mirror of the gnulib portability and testing suite for internal builds that use it as a submodule
C
8
star
98

serverless-jamstack

Contains sample code for a serverless Jamstack tutorial published on docs.digitalocean.com
JavaScript
8
star
99

golang-slackbot

Composed slackbot golang function with 3 sample functions
Go
8
star
100

marketplace-blueprints

HCL
8
star