Skip to content

Commit

Permalink
Merge pull request #30 from Team5599/production
Browse files Browse the repository at this point in the history
Production
  • Loading branch information
DeveloperBlue authored Dec 13, 2024
2 parents 9bf780c + 5ae868d commit 3340875
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [main, heroku]
branches: [main, production]

# Runs on any open or reopened pull request
pull_request:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Production Deployment [NextJS]

on:
pull_request:
branches: [production]
types : [closed]

push:
branches: [production]

workflow_dispatch:

jobs:
deploy:
if: (github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- name: Deploy using ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: 22
script: |
cd ${{ vars.REPOSITORY_DIRECTORY }}
echo "Fetching latest version from the production branch"
git fetch --all
git reset --hard origin/production
git status
echo "Installing updates"
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm ci
echo "Building project"
npm build
echo "Restarting PM2 Process ${{ vars.PM2_PROCESS }}"
PM2_HOME=/root/.pm2 pm2 restart ${{ vars.PM2_PROCESS }}
run: |
echo Pull request merged and deployed to Production
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ESLint

on:
pull_request:
branches: [main, heroku]
branches: [main, production]
push:
branches: [main]
workflow_dispatch:
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/update.yml

This file was deleted.

16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BNCHS Sentinels Website v5.0 <!-- omit in toc -->
![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) ![Redux](https://img.shields.io/badge/redux-%23593d88.svg?style=for-the-badge&logo=redux&logoColor=white) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white) ![Heroku](https://img.shields.io/badge/heroku-%23430098.svg?style=for-the-badge&logo=heroku&logoColor=white)
![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)

[![Build](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/build.yml/badge.svg)](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/build.yml) [![ESLint](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/lint.yml/badge.svg)](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/lint.yml)

Expand Down Expand Up @@ -53,19 +53,9 @@ To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - Learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - An interactive Next.js tutorial.

To learn more about Redux, take a look at the following resources:
- [Redux Fundamentals](https://redux.js.org/tutorials/fundamentals/part-1-overview) - Learn the core concepts, principles, and patterns of Redux
- [Redux Tutorials](https://redux.js.org/tutorials/index) - More resources for learning Redux
## Deploying to Production

## Deploying to Heroku

The ``heroku`` branch is responsible for deploying to our live production server Heroku.

You cannot push directly to the ``heroku`` branch. You must create a pull request to merge your branch into the ``heroku`` branch. When you create a pull request, an ESLint check is run against your changes.

The ESLint check is responsible for catching breaking bugs and unoptimizations before being deployed to Heroku.

Once the ESLint check is successful, the pull request can be merged. When merging is complete, GitHub Actions runs our "Heroku Deploy action", uploading the changes to our Heroku host.
The ``production`` branch is responsible for deploying to our VPS. To make changes to the website, create a pull request to merge your changes into the ``production`` branch.

## API

Expand Down
2 changes: 1 addition & 1 deletion app/Calendar/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const CALENDAR_DATA = [
requiresAuthentication : false
},
{
label : 'Programming Calendar',
label : 'Programming Calendar',
calendarID : '[email protected]',
color : '#ffff00',
enabledByDefault : true,
Expand Down
4 changes: 2 additions & 2 deletions docs/Other Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ Until we have a proper storage solution, backups are currently scattered and har
## Cloudflare

While the project is hosted on Heroku, Cloudflare is responsible for handlign a variety of services:
While the project is hosted on Hetzner, Cloudflare is responsible for handling a variety of services:
- Caching
- Auto minificiation
- DNS Management
- This includes handling the beta and delta subdomains and redirection to the blog subdomain, as well as email forwarding for @team5599.com emails.
- Analytics
- DDOS Protection

Our SSL certificates are handled by Heroku.
Our SSL certificates are handled by Cloudflare.

> ℹ️ Did you know we average about 1.29k requests through Cloudflare a day?
Expand Down

0 comments on commit 3340875

Please sign in to comment.