Skip to content

cianyleow/facts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FACTS

FACTS API

Production Installation

This installation guide is written for a Debian/Ubuntu based system. Specifically, an AWS Ubuntu 14.04 instance was used in June 2016, so please note that certain programs and commands may change over time.

  1. Add the Oracle Java 8 dependency to the APT repository

  2. sudo add-apt-repository ppa:webupd8team/java

  3. Update the APT environment

  4. sudo apt-get update

  5. Install the necessary software for the API to run

  6. sudo apt-get install nginx git mysql-server oracle-java8-installer

  7. You will need to set a password for the MySQL server here and accept the Oracle Java 8 license agreements. 1. Please choose a suitably complex password.

  8. Run the commands to secure the MySQL server installation. Follow the on-screen instructions.

  9. mysql_secure_installation

  10. mysql_install_db

  11. Clone the latest FACTS repository and build it locally with a Gradle Wrapper command.

  12. git clone https://github.com/cianyleow/facts

  13. cd facts/facts

  14. chmod u+x gradlew

  15. ./gradlew build

  16. cd ../..

  17. Create the user to run the application as and file system location to reside in.

  18. sudo add user facts 1. Configure this user with a secure password.

  19. sudo mkdir /var/facts

  20. sudo mv facts/facts/build/libs/facts-0.0.1-SNAPSHOT.jar /var/facts/

  21. sudo chown facts:facts /var/facts/facts-0.0.1-SNAPSHOT.jar

  22. sudo chmod 500 /var/facts/facts-0.0.1-SNAPSHOT.jar

  23. Set up the database by running the Install-DB.sql file. You will need to create a user and database first.

  24. mysql -u root -p

  25. Enter your password and you will enter the MySQL shell. Execute commands from here in this shell.

  26. CREATE USER 'facts'@'localhost' IDENTIFIED BY '#PASSWORD#'; 1. Replace #PASSWORD# with a suitably complex password.

  27. CREATE database facts;

  28. GRANT INSERT, DELETE, SELECT, UPDATE ON facts.* FOR 'facts'@'localhost'

  29. USE facts;

  30. source facts/Install-DB.sql

  31. Create the uploads folder and secure it.

  32. sudo mkdir /var/facts/upload

  33. sudo chown facts:facts /var/facts/upload

  34. sudo chmod 600 /var/facts/upload

  35. Configure the specific application properties

  36. sudo mv /home/ubuntu/facts/application.properties /var/facts/application.properties

  37. nano /var/facts/application.properties 1. Edit the details and set the MySQL facts user password, upload location (if different to above) and the JWT secret. 2. The JWT secret can be generated with the following command:

    1. openssl genrsa -des3 256
    2. Please choose a suitably strong passphrase.
    3. Copy the key itself, which looks like the below:
    4. FFhdIezDCRo79SwavHcwqcPdCoAxM88h1LdPQYbWgENzwPotRygOcf69wQX2h+gLMRBGbstX1Ce0F57Vf0+zINIEshex5ZtegirXDsxeT39r3dadUSk4sHuT06qcPT2sdB+RNDJeVnbyFkJocJ3331yqW7buiue4UZDwItzVeJnDH4xePDgByiQHDfnQR5D7LBA5s5c3TdNJdnim7NqNYL0zcC/J997oOUhB6GJFgCM=
  38. chown 400 /var/facts/application.properties

  39. chmod 400 /var/facts/application.properties

  40. Install the application as a system service in init.d

  41. sudo ln -s /var/facts/facts-0.0.1-SNAPSHOT.jar /etc/init.d/facts

  42. sudo mkdir /run/facts

  43. sudo chown facts:root /run/facts

  44. sudo su facts 1. Become the user facts and then start the facts application. 2. /etc/init.d/facts 3. Then use exit to go back to being your standard user.

  45. Install SSL certificates for server security.

  46. Create self signed certificates: 1. sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/facts.key -out /etc/ssl/certs/facts.crt 2. sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

  47. Install existing certificates: 1. /etc/ssl/certs/facts.crt 2. /etc/ssl/private/facts.key 3. /etc/ssl/certs/dhparam.pem

  48. Configure NGINX to operate as a reverse proxy and deliver the application over SSL.

  49. sudo cp /home/ubuntu/facts/nginx/facts /etc/nginx/sites-available/

  50. sudo cp -r /home/ubuntu/facts/nginx/snippets /etc/nginx

  51. sudo ln -s /etc/nginx/sites-available/facts /etc/nginx/sites-enabled/

  52. sudo nginx -t

  53. sudo service nginx restart

Releases

No releases published

Packages

No packages published

Languages