Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

Hosting

David Chen edited this page Sep 24, 2022 · 5 revisions

Overview

The frontend of StuyActivities is hosted on Netlify. The backend is hosted on our own server, provided by Digital Ocean, running CapRover. That server also hosts the database (MySQL) and various other bits and bobs.

Table

This is copied from stuyactivities-credentials/services.md. If you have access to that file and view it, you will be able to see the credentials for some of these services. This table describes some of the services/programs we use and their purpose in StuyActivities.

Service Use
Digital Ocean Server host
Caprover Orchestrate Docker containers + Resource dashboard
MySQL Database
Cloudinary Image host
Cloudflare Domain name management
Google Domains Domain name registar
Sendgrid Emails
Honeybadger Error alerts
Icons8 Icons
LetsEncrypt HTTPS Certificates
Heroku Frontend Host
Netlify PR preview deploys + Freshman Caucus site
GitHub Actions PR testing (backend)
Coveralls Testing
Restyled Github bot for Prettier linter
Dependabot Auto creates PRs for library updates
Mergify Auto merges PRs from dependabot
Nginx Reverse Proxy (Built into CapRover)
Poste-IO Mail Server

Using CapRover

To get to CapRover, log into captain.stuysu.org with the password in stuyactivities-credentials/stuyactivities-env.

On the left, select Apps. These are the apps that we have installed. Here's a rundown of what we have right now:

  • adminer is used to edit the database, see Backend
  • api-stuyactivities is the backend
  • applications is applications.stuysu.org
  • dev is an (unused?) ngrok tunnel.
  • minio is our own self-hosted min.io server. It operates like a self-hosted AWS S3 object storage.
  • image-proxy is a proxy that downloads images from Cloudinary and saves them to the StuyActivities minio bucket to reduce Cloudinary bandwidth usage. It is deployed from the image-cdn.stuyactivities.org repo
  • sophomore is a proxy (currently sophomore.stuysu.org) pointing to the Sophomore Caucus website's Vercel deployment (this can also be done through cloudflare and CNAME, in case we want to change it to use that)
  • mail is a poste.io server that handles the mail for StuyActivities
  • mongo is a mongodb database, it's used for the valentines site as well as the applications.stuysu.org site
  • mysql-db is the database for stuyactivities and other applications (such as applications)
  • phpmyadmin is similar to adminer.
  • staging was a staging deployment for a new stuysu.org site that was discontinued, and is not functioning.
  • valentine is an nginx server redirecting to valentines
  • valentines is the valentines letter-sending thing deployed from the valentines.stuysu.org repo

Fixing a Crash

It is a good idea to become familiar with all parts of the StuyActivities codebase so you can better assess the error and solve the issue better, but if you need immediate relief (and there isn't anyone else available to better assess the issue), here are a few more universal/easy steps you can take:

  1. (If you know that the issue isn't coming from the frontend, you can skip this step) Go on Netlify and make sure that production deploys are working. If you see any deploys that say Failed and that are marked with Production, then the error is likely becuase of an error in building the app. Click on the entry to view the build log, where you can see the error. Fixing it and pushing to master will fix the bug. Don't worry about any failed deploys marked Deploy Preview.
  2. (If you know that the issue isn't coming from the frontend, you can skip this step) If you don't see any deploys that failed, you might still benefit from re-deploying. On the right of the screen, click the dropdown that says Trigger deploy, and then click on Clear cache and deploy site. Give it a few minutes.
  3. (If you know that the issue isn't coming from the backend, you can skip this step) Go onto caprover. Go to the api-stuyactivities app (Apps on the left first) and then go to the Deployment tab. If you see recent deploys that failed (if the deploy on the top doesn't have a green checkmark in the State column), then the issue is in the backend. To diagnose the issue, scroll down to where it says Method 3: Deploy from Github/Bitbucket/Gitlab, and click the button that says Force Build. You will then see the Build Logs for that build, at which point if it errors you can see whether or not something went wrong.
  4. (If you know that the issue isn't coming from a code change, you can skip this step) If none of the above worked, go to the repositories (stuyactivities.org and api.stuyactivities.org) and start rolling back commits. If the most recent commits are pull request merges, go to that pull request page and hit the revert button. If they are not merges but are pushes straight to master, clone the repo (if you haven't already) and run git revert on it.
  5. If even reverting does not work, and it seems that CapRover as a whole has crashed, access the DigitalOcean Droplet (via SSH or web terminal) to investigate. A good command to check is df -h to inspect disk usage, as a full disk will lead to a multitude of issues.

Clone this wiki locally