🦍 🦏 🍖 🍌
This repository is a collection of smaller projects that encompass the new OHDZ nutrition system contracted as a Capstone project for UNO's Spring 2019 semester. Each smaller project has detailed installation instructions and this file will be an overview file for anyone who might need to make changes to the project.
- Linux flavor of choice
- npm
- nodejs
- mysql
- nginx
- git
- yarn
- pm2
- install required packages / libraries
- nodejs (npm should install with nodejs)
- mysql
- nginx
- yarn
- git
- pm2 via
npm install -g pm2
- create a new user with generic user perms (do not give admin rights)
- switch to that new user and create a new folder called
zooProdor something that makes sense - cd into the directory and then
git clonethis repository via something like this:git clone http://www.google.com/ .make sure to include the period to clone directly into this new folder - Run
yarnonce cloning is done. This installs all necessary packages for the API and the frontend.
- If running a blank mysql server without any previous customer data:
- create new mysql database named whatever you want it.
zoosuggested. - create a new user that will be your remote / local user
- copy these settings into the
zoo_apifolder by creating a.envfile with this inside (relevant info of course)
DB_HOST=ip/url DB_USER=coolUser DB_PASS=coolPass DB=dbName HTTP=true ### set to false if https is desired. can only do one or the other
- Run
automigrate.jsusingnode automigrate.jsunderzoo_api/serverThis will create the sql tables from the Loopback models. - uncomment user / original roles in
zoo_api/server/boot/authentication.jsto create a generic user on first bootup of the app. After this original bootup you should comment these out again if you don't want this user deleted over and over again. - run the initial boot of the app via
yarn startin thezoo_apifolder. - Comment out the piece from step 5.
- Copy all stored procedures to server. Stored procedures are located at
zoo_api/lib/Stored Procedures.
- create new mysql database named whatever you want it.
- If using previous customer data from Access [WIP]. This requires a manual migration and there is no automated process for this at the time. the DB Migration folder is the only piece that we have left from this. The schema of the new app has changed drastically and will be approached at a later date to work on making that final merge and never look back.
- Copy
nginx.confinto the nginx core file. We use a reverse proxy to convert the internal 3000 port to port 80 for the core webserver and port 3333 to 8080 for the API. This could change to whatever is desired (say api.test.com for the API etc)
- Generate some SSL certs via your favorite SSL cert generator and store them in ./zoo_api/server/private/
a. private key filename needs to be: privatekey.pem
b. certifacte filename needs to be: certificate.pem
c. .env file needs an HTTP attribute set to
falsein order to run on https
- The frontend bundler needs to know what ip address to ping in production to grab all the data from. Currently this sits directly in a tracked git file, but will eventually be moved to a
.envlike thezoo_api. - To set up, change the
process.env.BACKEND_URLvalue to the server's external IP address in thezoo_frontend/env-config.jsfile. There is an IP address already there, replace it. (This should be a commit chnage otherwise it will be overwritten everygit pull).
- In the root directory after running
git pullandyarnto pull all the latest updates and packages - Run
deploy.shin the root directory. If you can't run it runchmod 777 ./deploy.shto change the perms.