|
| 1 | +# Deployment Instructions |
| 2 | + |
| 3 | +## Requirements |
| 4 | + |
| 5 | +You will need the following to run this application: |
| 6 | +1. Server running MySQL version 14.14 |
| 7 | +1. Java version 1.8 |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +Setup the MySQL database. |
| 12 | + |
| 13 | +```bash |
| 14 | +mysql -u USERNAME -h HOSTNAME -P PORT -p -e "create database groupthree" |
| 15 | +``` |
| 16 | + |
| 17 | +## Configure GitLab OAuth2 |
| 18 | + |
| 19 | +Follow the instructions provided on this [website](https://docs.gitlab.com/ee/integration/oauth_provider.html). Set the callback URL to `http://{DOMAIN_NAME}/login/oauth2/code/gitlab`, replacing {DOMAIN_NAME} with the appropriate domain name. |
| 20 | + |
| 21 | + |
| 22 | +## Configure application.yml |
| 23 | + |
| 24 | +This file contains the properties of the deployment of the application. |
| 25 | +Create a new file `application.yml` with the following contents, replacing {} with the appropriate details: |
| 26 | + |
| 27 | +`{HOSTNAME}` = Hostname of the sql server e.g. mysql.mcscw3.le.ac.uk |
| 28 | +`{PORT}` = Port of the sql server e.g. 3306 |
| 29 | +`{USERNAME}` = Username for the sql server |
| 30 | +`{PASSWORD}` = Password for the sql server |
| 31 | +`{CLIENT_ID}` = GitLab Application Id |
| 32 | +`{CLIENT_SECRET}` = GitLab Secret |
| 33 | +`{PORT_NUMBER}` = Port you would like the application to run on |
| 34 | + |
| 35 | + |
| 36 | +```yaml |
| 37 | +spring: |
| 38 | + datasource: |
| 39 | + platform: mysql |
| 40 | + url: jdbc:mysql://{HOSTNAME}:{PORT}/groupthree |
| 41 | + username: {USERNAME} |
| 42 | + password: {PASSWORD} |
| 43 | + driverClassName: com.mysql.jdbc.Driver |
| 44 | + jpa: |
| 45 | + hibernate: |
| 46 | + ddl-auto: create |
| 47 | + properties: |
| 48 | + hibernate: |
| 49 | + dialect: org.hibernate.dialect.MySQL5InnoDBDialect |
| 50 | + mvc: |
| 51 | + view: |
| 52 | + prefix: /WEB-INF/views/ |
| 53 | + suffix: .jsp |
| 54 | + security: |
| 55 | + oauth2: |
| 56 | + client: |
| 57 | + registration: |
| 58 | + gitlab: |
| 59 | + client-id: {CLIENT_ID} |
| 60 | + client-secret: {CLIENT_SECRET} |
| 61 | + authorization-grant-type: authorization_code |
| 62 | + # Below property should not be changed |
| 63 | + redirect-uri-template: '{baseUrl}/login/oauth2/code/{registrationId}' |
| 64 | + scope: openid |
| 65 | + clientName: GitLab |
| 66 | + provider: |
| 67 | + gitlab: |
| 68 | + authorization-uri: https://gitlab.com/oauth/authorize |
| 69 | + token-uri: https://gitlab.com/oauth/token |
| 70 | + user-info-uri: https://gitlab.com/api/v4/user |
| 71 | + jwk-set-uri: https://gitlab.com/oauth/discovery/keys |
| 72 | +server: |
| 73 | + port: {PORT_NUMBER} |
| 74 | +``` |
| 75 | +
|
| 76 | +## Run the application |
| 77 | +
|
| 78 | +```bash |
| 79 | +java -jar /path/to/co2015-1819-group-03-0.0.1-SNAPSHOT.war --spring.config.location=file:relative/path/to/application.yml |
| 80 | +``` |
0 commit comments