Skip to content

Instantly share code, notes, and snippets.

@zachlatta
Last active May 4, 2021 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlatta/a21f0272a85daa91f63590cd813d0b88 to your computer and use it in GitHub Desktop.
Save zachlatta/a21f0272a85daa91f63590cd813d0b88 to your computer and use it in GitHub Desktop.

As of 2021-05-04, the repository for Hack as a Service is still private. See below for the project's README and the internal progress updates written by Hack Clubbers for a glimpse into what they're working on.

Hack as a Service (HaaS)

Run your own backend applications for just 5hn/app/month!

>> Check out our progress reports here! (see files below) <<

Development

Contributions to the project are welcome! The backend is mostly Go, and on the frontend we use Next.js with Theme UI + Hack Club Theme for styling. Make sure to discuss changes with other contributors in a GitHub issue or on Slack before beginning development on new features or bugfixes. Please assign yourself to issues you're working on, to help everyone know what still needs to be done, and keep everyone on the same page.

Local Development

Before starting local development make sure you have docker and docker-compose installed as well as an empty .env file created at the top of the project. You can then run docker-compose up to run a local instance of Dokku and the bot. Any edits you save should make the bot restart automatically. The file watcher appears to be broken on Windows for currently unknown reasons - we recommend the use of Windows Subsystem for Linux (WSL) for development on Windows systems.

To open a shell in a container, run docker exec -it hack-as-a-service_bot_1 bash or docker exec -it hack-as-a-service_dokku_1 bash

File Guide

  • main.go - main entrypoint for the built binary, contains web server
  • assets/ - contains static assets including images which are served by the backend
  • dokkud/ - daemon that connects to Dokku. this should remain relatively stagnant
  • frontend/ - the Next.js frontend for the app. Note that if a new page is added here, you will need to create a new route in pkg/frontend/routes.go.
  • pkg/ - contains most of the backend code, including API, routing for frontend, and DB interactions
    • api - this package contains API routes and most of the application's business logic
    • biller - this package manages real-time billing based on resource usage
    • db - this package manages all interactions with the database
    • dokku - this package connects to Dokku via our Dokku daemon
    • frontend - this package only contains routes for serving the frontend - the Next.js app is located in the frontend folder at the root of the repo
  • dokku_data/ - data folder used for running Dokku in development (ignore)
  • dokku_deploy/ - holds files which are automatically deployed to the server, including Nginx config and custom Dokku error pages
  • dokku_plugin/ - Dokku plugin that provides a variety of HaaS-specific commands.

Deployment

Dokku recommends Debian for its installation, so we will assume a Debian-based system is being used. To start a fresh deployment, make sure to set up dokkud by building it (cd into dokkud and run go build -o dokkud .), moving the binary to /opt/dokkud/, placing the service file at /etc/systemd/system and enabling it (systemctl enable --now dokkud). Then follow the installation directions for Dokku, as the HaaS bot is managed by it, and create a new app which deploys from the Dockerfile at the root of this repo.

On our installation, the bot and frontend should auto-deploy once CI passes on master. Other files, including those in dokku_deploy and dokkud must be manually updated by someone with direct access to the server.

HaaS Progress Report - April 23, 2021

πŸ§‘β€πŸ’» Hello hackers! This week has been a big one for HaaS, so this post will get you up to speed with the amazing development milestones we've hit recently.

❓ To recap, what exactly is HaaS? Hack as a Service (or HaaS) is an HN-powered PaaS for Hack Clubbers (think Heroku, but better) that aims to be inexpensive, powerful, and easy to get started with.

Recap

In the past two weeks we've hit a number of milestones, including:

Looking forward

Next week, we'll be focused on app provisioning and billing. @rishiosaur will be working on rishiosaur/hn#10, which will open up the ability for fractional billing based on resources used.


A huge thanks to everyone who's contributed in the past few days! We're always looking for new people to help out with the backend, frontend, and documentation, so don't hesitate to post in #hack-as-a-service if you'd like to lend a hand βœ‹!

- @Caleb and the rest of the HaaS team

HaaS Progress Report - May 2, 2021

Welcome back hackers! We have hit even more milestones recently with HaaS, so let's go over all of them in detail.

To recap, what exactly is HaaS? Hack as a Service (or HaaS) is an HN-powered PaaS for Hack Clubbers (think Heroku, but better) that aims to be inexpensive, powerful, and easy to get started with.

Recap

15 issues were closed in the last week.

37 pull requests were merged in the last week.

Here are some of the notable changes:

New contributors!

Let's also take some time to shout to some of our brand new, first-time contributors:

  • @Matt-Gleich refactored folder structure (#33) making the codebase much easier to maintain πŸ™Œ as well as adding a few docs (#71)
  • @sarthaktexas allowed the frontend app to work better for development πŸ’– (#73)
  • @faisalsayed10 added a slick landing page 😜 (#74)
  • @cfanoulis fixed a few bugs in the frontend πŸ› (#92, #96)
  • @bellesea added an awesome dark mode toggle 😎 (#76)

Looking forward

Well, that's all we have for this progress report! We've made a lot of progress, but stay tuned for next week where we plan to have support for GitHub webhooks and a more full-featured UI!

- @anirudhb and the rest of the HaaS team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment