Featuring the horrors of Node.js
- Go to https://www.csua.berkeley.edu:8080/admin/ to edit officer/sponsor/pb/event data!
- Only a few things left to update in
./static/data
- Make sure you have push access to the repo first. Email vp@csua.berkeley.edu or message someone on #root-staff on slack to get access.
- Navigate to where you want to clone the website. Clone it, get into it, make a
new branch, make changes, push that branch, and create a pull request for that
branch. For example,
git clone https://github.com/CSUA/csua-website
clones the website to your local machinecd csua-website
to navigate to the project directorygit checkout -B BRANCH_NAME
: creates a new branch named BRANCH_NAME and checks it out (switches to it)- Choose a branch name like
dev-caleb
or the name of the feature you are working on
- Choose a branch name like
- Make changes and commit them, e.g.
touch documentation.txt
git add documentation.txt
git commit -m "I added documentation."
or justgit commit
- or any other series of changes
git push --set-upstream origin BRANCH_NAME
: if you try pushing without setting upstream, it'll tell you do git gud and do this- Now create a pull request (PR) from your branch to the
dev
branch on Github- When the
dev
branch is tested and stable, a member of root staff will merge it withprod
and deploy it on the CSUA server
- When the
- Install the latest version of Node and NPM (currently Node 8)
- On Debian/Ubuntu, install NVM (Node Version Manager) as per
https://github.com/creationix/nvm#installation after which you can
nvm install node
- Or just download the latest binaries from Node's website
- On Debian/Ubuntu, install NVM (Node Version Manager) as per
https://github.com/creationix/nvm#installation after which you can
- Navigate to project directory
npm install
to install dependencieswebpack -p
ornode node_modules/webpack/bin/webpack.js
will bundle together website assets to be deployed- Adding the watch
-w
flag to that command lets you run it as a background service to regenerate thedeploy/
folder when any files are changed
- Adding the watch
node deploy/testServerBundle.js
to start the server at http://localhost:8081/
- Nonexistant
- Please write documentation here
- https://www.youtube.com/watch?v=nnsm2UBH8qE
- You probably want to edit the subfolders of
src/Pages
- Remember to include your new scss files in
src/Pages/style.scss
deploy/
- generated by running webpacknode node_modules/webpack/bin/webpack.js
serverBundle.js
- run with node for production servertestServerBundle.js
- run with node for dev server
node_modules/
- all the node dependencies https://i.redd.it/tfugj4n3l6ez.pngpublic/
- (compiled) static assets for the sitesrc/
- all the source code and logic for the appPages/
- the different pages of the React appOfficers/
- contains the jsx to render the officer page_OfficerCreator.jsx
- turns officer data into the pretty cards with officer facesOfficers.jsx
- the skeleton around the officer cards
Pages.jsx
- Routing info on how pages are displayed (What's the difference between this andstatic/structure/
)
App.jsx
- main app javascript logicClientApp.js
- nests intoindex.html
- the root of it all
static/
- configs for data on the sitedata/
- edit the files in here to change the data displayed on sitestructure/
- this contains the urls and routes for the React app
package.json
- lists all the necessary dependencies to be installed withnpm install
server.js
- connect to this server with UNIX socketssslServer.js
- isn't used anymore, but this code runs the site on HTTPStestServer.js
- gets compiled to deploy/ but edit this file to specify what port this opens the local server onwebpack.config.js
- details how webpack should compile assets
- This repo is located in
/webserver/csua-website
on production (services.csua.berkeley.edu
) - There are two systemd services that make this work, both in
/etc/systemd/system
(the files in this repo are just copies)csua-website.service
: Runs the node server as root, which binds to/run/node/node.sock
csua-website-webpack.service
: Runs webpack in watch mode, which is used to update the resources and bundle files with zero downtime (supposedly)
- Requests to
https://www.csua.berkeley.edu
are ProxyPass'ed by Apache to this server - Apache config is in
/etc/apache2/sites-available/csua-website.conf
- Check on status using some of these commands:
sudo systemctl status csua-website
sudo systemctl status csua-website-webpack
sudo journalctl -u csua-website
- Press "G" to go to the bottom
sudo journalctl -u csua-website-webpack