Note: This repo was previously forked from wtg/ambulance, but was removed from the fork network by GitHub Support. The former repository is no longer developed, leaving this repo as the most up-to-date version.
This website is built in the MEAN stack (MongoDB, Express.js, Angular.js, and Node.js), and can be deployed using the following steps:
-
Clone this git repository by running the following command in a Git-enabled terminal:
> git clone https://github.com/rpiambulance/website.git ambulance
-
Navigate into the directory of the application:
> cd ambulance
-
If NodeJS and Bower are both installed on your computer, skip this step.
- Install NodeJS here.
- Install Bower through Node Package Manager (npm) by running:
npm install -g bower
.
-
Install all necessary dependencies by running the following commands:
> bower install
-
Install mysql and then:
- Run the sql located in the file .docker/mysql/schema.sql to create database (
ambulanc_web
) and necessary tables in the DB - [ADD INSTRUCTIONS FOR ADDING MEMBER, DEFAULT CREWS]
- Run the sql located in the file .docker/mysql/schema.sql to create database (
-
Install PHP and a webserver (Apache, Nginx) to run it
The site uses Docker to spin up three containers to ease in development which consists of:
- MySQL container
- PHP + Apache container
- phpMyAdmin container
To use this, you will need to install docker and docker-compose. For Windows and MacOS, it's recommended to install the Docker Desktop which contains everything that you need. For a Linux distro, find your OS and follow the install directions for it on this page. You may need to additionally follow the instructions this page to install docker-compose.
Next, you will need to copy a handful of files into place:
cp .env.sample .env
cp .docker/.admin_config.php .
cp .docker/.db_config.php .
cp .docker/.form_config.php .
Once that is done, you just need to run the following command anytime you want to work on the site:
docker-compose up
This starts all three containers, links them together, and makes them accessible on your localhost. The containers have the following access points on the host machine:
- Site: http://localhost:8080
- phpMyAdmin: http://localhost:8081
- MySQL: localhost:33060
This will setup the necessary .{admin,db,form}_config.php
files in your site directory. Additionally, when you first
start the MySQL container, it will create a user with the following credentials that you can use to login:
- Username: test
- Password: test
Similar to the Development, Production can also be run through docker-compose. Setup steps are largely the same, however, you will want to do:
cp .env.sample .env
cp .admin_config.example.php .admin_config.php
cp .db_config.example.php .db_config.php
cp .form_config.example.php .form_config.php
and then edit the four files to have secure values. Once you are ready to run the site, you will run:
docker-compose -f docker-compose.yml up
Where the accessing the site, phpMyAdmin, and MySQL are through the same endpoints as above, using whatever
username and password you set in the .env
file to access them.
The site is deployed live through the use of Travis-CI with all builds being available at https://travis-ci.org/rpiambulance/website. This allows keeping the live site in sync with the code in the repo automatically and without any human intervention, except to keep Travis-CI working, and to occasionally rotate the credentials listed below.
On any pushes to master, Travis-CI will kick off a deploy script which connects to the RPI VPN network, and then uses rsync to push files from the repo to the Union FTP server, where the site is hosted. To do this, it uses five secret variables that are set on Travis-CI under settings for the repo:
- RPI_FTP_USERNAME
- RPI_FTP_PASSWORD
- RPI_VPN_USERNAME
- RPI_VPN_PASSWORD
- RPI_VPN_SECRET
The first two variables are used for accessing the Union FTP server. The next three variables deal with logging into RPI's VPN network. The username and password should be the RCS credentials of a current student (preferably the current webmaster's) while the value for the secret can be found at https://afsws.rpi.edu/AFS/dept/cct/public/vpnc/ after logging in. These are then used to configure the vpnc to connect to RPI network, following a similar setup as outlined on the DotCIO Linux VPN instructions.
This project was created for the RPI Ambulance organization by the Web Technologies Group.
- Select photos are copyrighted by David Sparkman and are used with permission from the author.
- Some photos are copyrighted by Michael Cuozzo and used with permission from the author.
For more information regarding copyrighted works herein contained, please contact [email protected] or [email protected]