-
Notifications
You must be signed in to change notification settings - Fork 2
Hosting
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.
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 |
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:
-
admineris used to edit the database, see Backend -
api-stuyactivitiesis the backend -
applicationsis applications.stuysu.org -
devis an (unused?) ngrok tunnel. -
miniois our own self-hosted min.io server. It operates like a self-hosted AWS S3 object storage. -
image-proxyis 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 -
sophomoreis 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) -
mailis a poste.io server that handles the mail for StuyActivities -
mongois a mongodb database, it's used for the valentines site as well as the applications.stuysu.org site -
mysql-dbis the database for stuyactivities and other applications (such asapplications) -
phpmyadminis similar toadminer. -
stagingwas a staging deployment for a new stuysu.org site that was discontinued, and is not functioning. -
valentineis an nginx server redirecting tovalentines -
valentinesis the valentines letter-sending thing deployed from the valentines.stuysu.org repo
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:
- (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
Failedand that are marked withProduction, 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 markedDeploy Preview. - (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 onClear cache and deploy site. Give it a few minutes. - (If you know that the issue isn't coming from the backend, you can skip this step) Go onto caprover. Go to the
api-stuyactivitiesapp (Appson the left first) and then go to theDeploymenttab. If you see recent deploys that failed (if the deploy on the top doesn't have a green checkmark in theStatecolumn), then the issue is in the backend. To diagnose the issue, scroll down to where it saysMethod 3: Deploy from Github/Bitbucket/Gitlab, and click the button that saysForce 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. - (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 reverton it. - 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 -hto inspect disk usage, as a full disk will lead to a multitude of issues.