Skip to content

CooperMist/gallery-gateway

 
 

Repository files navigation

Gallery Gateway

Gallery Gateway Logo

About

Motivation

The RIT School of Photographic Arts and Sciences (SPAS) holds an annual art exhibition highlighting the top works of RIT student artists. Students can submit works for consideration during an open call, and a panel of RIT faculty jurors vote on which art will be displayed in the gallery at this show. Currently, SPAS has been paying for and using a software as a service product, CaFÉ, to facilitate this process; however, frustrations with CaFÉ’s difficult-to-use interface and poor user-experience for both administrative and student workflows has led them to seek custom replacement software which better fits their use case and work process.

Gallery Gateway is this custom replacement software.

In addition to it's use for art showcases, Gallery Gateway has also been employed to facilitate in the scholarship selection process. In the current process, scholarship applications are reviewed by judges manually inspecting art pieces, which must be printed out by the students themselves. Gallery Gateway will facilitate this process by condensing all of the scholarship pieces into a single place, allowing for easier judging while also saving students the cost of printing.

Team

Gallery Gateway was built as a Senior Project for RIT's Software Engineering Undergraduate Program.

This iteration of the project was forked from the original Gallery Gateway Repository, built by Team A B S T R A C T I O N during the Fall 2017 and Spring 2018 semesters.

The second iteration of the project was built during the Fall 2019 and Spring 2020 semesters by The Curators under supervision of sponsor Nanette Salvaggio and faculty coach Mohamed Wiem Mkaouer

Iterations

Architecture

Both the frontend and backend are written in JavaScript.

Frontend:

Backend:

See each of their package.json files for the other tools we used (eg. transpiling, linting, testing).

New to React, Redux, & GraphQL?

Here are some useful resources on these tools and our architecture:

React

Redux

GraphQL

Development

You'll need to be running both the frontend and backend for development. Check out each of their README's for further instructions.

Deployment

These are instructions for deployment to a production environment, which is assumed to be hosted at http://gallerygateway.rit.edu/. For more information on deploying for testing and development, see the README files gound in gallerygateway/backend and gallerygateway/frontend

We deploy our application on Ubuntu 16.04.

NOTE: Since this repository is a fork of the original github repository used to deploy gallery gateway, it needs to be pulled into the gallery gateway server as a fork

git pull https://github.com/johnbyrne727rit/gallery-gateway.git master

Prequisites

Install Node (10.x LTS) & NPM (>= 5.6)

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

Install Yarn (>= 1.6)

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn

Install MySQL

sudo apt-get update
sudo apt-get install mysql-server

To configure password and other settings run

sudo mysql_secure_installation utility

To start MySQL run

sudo systemctl start mysql

Install Nginx

sudo apt update
sudo apt install nginx

Then start Nginx with

sudo systemctl start nginx

Install Supervisor

sudo apt-get install supervisor

Supervisor should automatically be running after installation, but you can double check by running

service supervisor restart

Additionally, setup HTTPS

This can be done using Let's Encrypt.

Deployment Setup

  1. There must be a user in the sql database named 'gallerygateway'

    1. To create a new user, start a mysql session with

      sudo /usr/bin/mysql -u root -p
    2. You can then check if the user already exists with

      SELECT User, Host FROM mysql.user;
    3. Create a new user in the database named gallerygateway (if one does not already exist)

      CREATE USER 'gallerygateway' IDENTIFIED BY '<password>';

      Replacing <password> with your user password

  2. In the top level directory, you must add a file called mysql_password.txt containing, on the first line, the password for the gallerygateway sql user that was just created

  3. Provide the MySQL database password, RSA keys used for JWT authentication (see below)

    cd /opt/node/gallerygateway/keys
    sudo openssl genrsa -out private.key 4096
    sudo openssl rsa -in private.key -outform PEM -pubout -out public.key
  4. Add the the Identity Provider Certificate (idp_cert.pem) to /opt/node/gallerygateway/keys. Instructions on creating a self signed certificate can be found here

Deploy the App

Run the deploy script from the top level directory

deploy/deploy.sh <git url>

where <git url> is the url link to the zip download of the target git repository. If left blank, this will default to https://github.com/abstractionhq/gallery-gateway/archive/master.zip

The script will:

  • Create a MySQL database if one does not exist (and set the character encoding to UTF-8)
  • Download this project's source from GitHub
  • Install and build the frontend
  • Install and build the backend
  • Migrate the database tables
  • Start the backend using Supervisor

If the backend fails to start, the script will still complete, you can check if it is running by entering the command

sudo supervisorctl status all

Troubleshooting Common Errors

/usr/bin/mysql -u root -p gives command not found error

This may mean that mysql has already been added to the path. In this case, try the command.

mysql -u root -p

The shell deploy script will still function properly in this case.

If this does not work, mysql may be installed somewhere else, or may not be installed at all.

The Supervisor backend is not running

You are likely missing one of the required keys. You can check the supervisor logs found in /opt/node/gallerygateway/log.txt for more information

Maintenance

Because the JavaScript community tends to move faster than other language communities, this app will require regular maintenance to make sure it can run on the current LTS Node.js runtime. Additionally, npm packages this app depends on should be periodically monitored, including updating to their latest stable versions (possibly even switching packages if the current maintainer abandons support).

Package dependencies will generally only need to be updated if packages contain security vulnerabilities or you will be developing additional features or upgrading Node versions. When running npm install or yarn install, you generally will be warned of deprecated package versions. It is recommended to also install npm-check-updates and run ncu to check which packages are out-of-date. Then, read through the CHANGELOGs of each out-dated package (they're usually found on the package's npm page or GitHub repo) to see if there are any breaking changes. If there are, update any of this project's code impacted by the breaking changes and update the version of the package in the corresponding package.json file. Double check that the upgrade is compatible by making sure that all existing tests pass (Note: frontend updates that impact styling will likely need to be manually tested).

Determining the health of a package is subjective but usually involves identifying when its most recent commits were, how active the maintainers are in responding to Issues and Pull Requests, and the number of Issues and Pull Requests the project has. Additionally, new packages may be developed which offer similar features to a package we use, but because of non-functional characteristics (e.g. performance, user experience), the JavaScript community may collectively favor this new package over the old and recommend switching. A word of caution; though, beware of hype-driven development – it plagues the JavaScript community.

Node.js LTS releases are cut every year in April. Upgrading Node versions involves updating any uses of deprecated Node API calls and making sure that all npm dependencies are compatible with the new Node version.

Changes to ECMAScript are generally backwards compatible, so it is unlikely that the language syntax will need maintenance. However, since we currently rely on Babel to transpile down to what's supported in major browsers and Node, Babel may need to be periodically updated. Ideally, Babel could be removed when the language features we're using are supported natively in all major browsers and Node.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Other 1.2%