CloudClub-uoft / cloud-club-website

Club Website
https://cloudclub.ca
4 stars 3 forks source link

CloudClub Website

Website for the UofT CloudClub.

Development

General Notes

Requirements

Installation and Startup

Important: to follow this section first ensure you've installed all requirements in the previous section - git, Node, VS Code, and XAMPP

  1. Either clone this repository using GitHub Desktop (or related software), download as a ZIP and extract, or run git clone https://github.com/CloudClub-uoft/cloud-club-website using the terminal and enter your credentials.
    • we recommend using the command line argument git clone https://github.com/CloudClub-uoft/cloud-club-website
      1. if you need further guidance for this, go to the Troubleshooting section below
  2. Go back to VS Code where you have this project opened. Open up a terminal by clicking on the Terminal tab at the top, then New Terminal
  3. Install Node.JS by typing npm install in the terminal, then hit enter. This will install all the necessary packages to make our website run
  4. Launch MySQL instance using XAMPP. (Jump to the database setup section for help with this section. Come back here after you've launched XAMPP)
  5. Go back to VS Code
  6. Create an empty file called .env at the root of the cloned repository (the cloud-club-website folder). The file should be named exactly as .env (pronounced dotenv) and paste in it the environment variables shared by the project administrator (Qingyuan). To make a new file in VS Code, hover over the left panel displaying the open files and hit the new file button near the top right of the panel. Make sure the file is in the cloud-club-website folder, not another folder!
  7. Start the server by executing node . in the terminal at the root of the repository.
  8. View the webpage by navigating to localhost:PORT in your browser. Here PORT is a placeholder for the port number specified by the "PORT" variable in the .env file. The default is 4000.
    • if you see the CloudClub website - same one as what you see when you navigate to cloudclub.ca, then congrats! Your setup is complete
    • Now you can make changes locally and see your changes at localhost:PORT
      • for example, in VS Code, go to the file views/index.ejs
      • change the line What is CloudClub? to Hello World, type Ctrl + S (Windows) or Cmd + S (Mac) to save
      • go to the terminal (recall, it's at the bottom of VS Code) and type Ctrl + C (Windows and Mac) to exit
      • use the type node . again or use the up-arrow key to restart the server
      • again, navigate to localhost:PORT, but observe this time that the front page heading is changed to Hello World
      • follow these steps to undo the changes you made
    • However, can you spot some differences between your local site and the actual cloudclub.ca website?

Database setup

Click Here

Contributing

Note: The sections below will not be necessary for a first-time setup. They will come into play after you start making changes to the website

Making a Change

Other Useful git Commands

Frontend Testing

The Selenium framework for Python is required for frontend testing. During tests a properly configured MySQL instance should be accessible by the website server.

python -m pip install selenium

NOTE: A Selenium webdriver must be accessible via the PATH variable. Documentation.

All frontend tests are stored under the test/frontend directory. A test can be invoked by executing the test script inside one of the test directories.

python test_forum.py

Development

Linting and Coding Standards

Review Code Formatting and Standards Document. Link

Setup VSCode workspace for linting and formatting. Link (Slide 12)

API Documentation

Archived Readmes

Click here

Troubleshooting

  1. After running node ., I'm getting this redis error:
Redis connection failed: Error: Redis connection to redis-17266.c8.us-east-1-2.ec2.cloud.redislabs.com:17266 failed - getaddrinfo ENOTFOUND redis-17266.c8.us-east-1-2.ec2.cloud.redislabs.com
  1. Where do I run git clone command?

    • For both windows and Mac, we run commands in the Terminal (for windows this is sometimes called the Command Prompt)
    • For windows:
      1. navigate to the directory you wish to put this repository in
      2. right click a blank space in the directory and click Open in Terminal
      3. run the git clone command
      4. if you have VS Code (you should), open it to the folder of the cloud-club-website project that you just cloned
    • For Mac:
      1. open the terminal (type command + space bar and search for terminal, click enter)
      2. navigate to the directory you wish to put this repository in by using cd <directory>. For example, if you wish to put it in the Documents directory you would type cd Documents
      3. run the git clone command
      4. if you have VS Code (you should), open it to the folder of the cloud-club-website project that you just cloned
  2. This error:

C:\Users\qingy\OneDrive\Documents\webDev\cloud-club-website\config\sql-db.js:16
        if (err) throw err
                 ^

Error: connect ENOENT 3306
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1148:16) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'connect',
  address: '3306,
  fatal: true
}

Make sure XAMPP is enabled!