<commit_before># Running / Building
This project assumes that you are running a fairly recent version of a common
Linux-based operating system such as Ubuntu or Fedora.

## External Dependencies
This project uses [Gradle](https://gradle.org/) for building and running. Because we include
the `gradlew` script in the project, you don’t need to install gradle separately. This script
 pulls in Gradle and then pulls in almost all the dependencies for the project, but
you will need the following external dependencies

- [MongoDB](https://www.mongodb.com/) : The project assumes that mongoDB is running locally and requires
  no authentication to access
- Java 8: This project requires Java 8 for all the server side code. All the development
  was done using OpenJDK, but our CI test suite was run on Oracle’s implementation.
- [Yarn](https://yarnpkg.com/en/): Gradle can automatically install its own version of yarn on some platforms,
  but requires manual installation on others.

## Building

- Use `git clone https://github.com/UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2 ddg` to
  get a copy of your repository.
- Use `cd ddg` to move into the directory you just cloned.
- In `client/webpack.prod.js` a variable `API_URL` is defined. The value should be the URL to your website
  followed by `/api/`. For example `https://ddg.mygarden.com/api/`. (Note the trailing slash!)
- This project uses Google OAuth services to authenticate users. Currently, the list of administrators is
   hardcoded in the constructor for 
   `server/src/main/java/umm3601/digitalDisplayGarden/Authentication/Auth.java`. 
   Add the address each of the people that need access and remove the addresses of those who don’t. Each
   address in the list _must_ be a Gmail address or a Gmail for Business address, otherwise they won’t be
   able to authentication through Google.
- Run `./gradlew build` to build the project. This will also run all the tests for the project some of
  which can take a lot of memory. If you wish to skip the tests, use `./gradlew assemble` instead.

## Running
- Run `cp server/build/distributions/server.tar ~` to copy the built version of your server to the home directory.
- Run `cd ~` to move into the home directory.
- Run `tar xvf server.tar` to extract your server tarball.
- Create a file called `config.properties`. See [ServerConfiguration.md](./ServerConfiguration.md) for what needs to go in the file. 
- Run `server/bin/server config.properties` to start the server. 

Our server does not have any HTTPS capabilities and will happily serve everything over HTTP. 
We _strongly_ recommend running this application behind a reverse proxy that provides HTTPS 
to clients. An example of how to create a reverse proxy using NGINX can be found [here](./Https.md).

After getting the site up and running, the first thing you will want to do is visit the admin
page and populate the database. See the end user documentation for the formatting requirements
on the file that you import.

## Development
The documentation above attempts to describe how to get things up and running in a production environment.
The project also has some Gradle tasks to make the development process easier.

### `./gradlew runClient`

Launches a simple node web server that serves the client-side app for the project. This server constantly 
monitors your client files and restarts itself to reflect those changes. It also maintains a connection to 
all connected clients and sends a signal to cause them to reload after it restarts. It listens for connections
on port `9000`. 

### `./gradlew run`

This launches the Spark server listening on port `2538` that provides all the server endpoints that
the client-side calls to interact with the database. During production, this server is responsible<commit_msg>Add warning about the DISPLAY var<commit_after># Running / Building
This project assumes that you are running a fairly recent version of a common
Linux-based operating system such as Ubuntu or Fedora.

## External Dependencies
This project uses [Gradle](https://gradle.org/) for building and running. Because we include
the `gradlew` script in the project, you don’t need to install gradle separately. This script
 pulls in Gradle and then pulls in almost all the dependencies for the project, but
you will need the following external dependencies

- [MongoDB](https://www.mongodb.com/) : The project assumes that mongoDB is running locally and requires
  no authentication to access
- Java 8: This project requires Java 8 for all the server side code. All the development
  was done using OpenJDK, but our CI test suite was run on Oracle’s implementation.
- [Yarn](https://yarnpkg.com/en/): Gradle can automatically install its own version of yarn on some platforms,
  but requires manual installation on others.

## Building

- Use `git clone https://github.com/UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2 ddg` to
  get a copy of your repository.
- Use `cd ddg` to move into the directory you just cloned.
- In `client/webpack.prod.js` a variable `API_URL` is defined. The value should be the URL to your website
  followed by `/api/`. For example `https://ddg.mygarden.com/api/`. (Note the trailing slash!)
- This project uses Google OAuth services to authenticate users. Currently, the list of administrators is
   hardcoded in the constructor for 
   `server/src/main/java/umm3601/digitalDisplayGarden/Authentication/Auth.java`. 
   Add the address each of the people that need access and remove the addresses of those who don’t. Each
   address in the list _must_ be a Gmail address or a Gmail for Business address, otherwise they won’t be
   able to authentication through Google.
- Run `./gradlew build` to build the project. This will also run all the tests for the project some of
  which can take a lot of memory. If you wish to skip the tests, use `./gradlew assemble` instead.

## Running
- Run `cp server/build/distributions/server.tar ~` to copy the built version of your server to the home directory.
- Run `cd ~` to move into the home directory.
- Run `tar xvf server.tar` to extract your server tarball.
- Create a file called `config.properties`. See [ServerConfiguration.md](./ServerConfiguration.md) for what needs to go in the file. 
- Run `server/bin/server config.properties` to start the server. 

Our server does not have any HTTPS capabilities and will happily serve everything over HTTP. 
We _strongly_ recommend running this application behind a reverse proxy that provides HTTPS 
to clients. An example of how to create a reverse proxy using NGINX can be found [here](./Https.md).

_**Warning**: the `DISPLAY` environment variable must either be unset or refer to a working X11 server. 
If it refers to the non-existent X11 server, the server will fail when attempting to export
collected data._

After getting the site up and running, the first thing you will want to do is visit the admin
page and populate the database. See the end user documentation for the formatting requirements
on the file that you import.

## Development
The documentation above attempts to describe how to get things up and running in a production environment.
The project also has some Gradle tasks to make the development process easier.

### `./gradlew runClient`

Launches a simple node web server that serves the client-side app for the project. This server constantly 
monitors your client files and restarts itself to reflect those changes. It also maintains a connection to 
all connected clients and sends a signal to cause them to reload after it restarts. It listens for connections
on port `9000`. 

### `./gradlew run`

This launches the Spark server listening on port `2538` that provides all the server endpoints that
the client-side calls to interact with the database. During production, this server is responsible
{'fraction_non_alphanumeric': 0.05874888973480523, 'fraction_numerical': 0.006090597639893415, 'mean_word_length': 4.13485342019544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '627396', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1967, 'n_words': 1138}