|
@@ -2,7 +2,7 @@
|
|
|
A web app to collect data on noise detection by humans on images.
|
|
|
|
|
|
## Download project
|
|
|
-```sh
|
|
|
+```console
|
|
|
git clone https://gogs.univ-littoral.fr/Prise3D/Antoine_Internship.git
|
|
|
cd Antoine_Internship
|
|
|
```
|
|
@@ -32,7 +32,7 @@ Configure more deeply the way the app works by modifying *[config.js](config.js)
|
|
|
|
|
|
### Run server + client
|
|
|
Linux
|
|
|
-```sh
|
|
|
+```console
|
|
|
PORT=8080 SERVE_CLIENT=true IMAGE_PATH=/var/images docker-compose up
|
|
|
```
|
|
|
Windows
|
|
@@ -45,7 +45,7 @@ docker-compose up
|
|
|
|
|
|
### Run server only
|
|
|
Linux
|
|
|
-```sh
|
|
|
+```console
|
|
|
SERVE_CLIENT=false docker-compose up
|
|
|
```
|
|
|
Windows
|
|
@@ -55,14 +55,14 @@ docker-compose up
|
|
|
```
|
|
|
|
|
|
### Run client only
|
|
|
-```sh
|
|
|
+```console
|
|
|
docker-compose -f docker-compose.frontapp_only.yml up
|
|
|
```
|
|
|
|
|
|
### Notice
|
|
|
#### New version Docker build
|
|
|
When using a new version of the project, you need to re-build the application with Docker.
|
|
|
-```sh
|
|
|
+```console
|
|
|
# Server / Server + client versions
|
|
|
docker-compose build
|
|
|
|
|
@@ -89,7 +89,7 @@ yarn install
|
|
|
If this is a production build, set the `NODE_ENV` environment variable to `production` to enhance performance.
|
|
|
|
|
|
Linux
|
|
|
-```sh
|
|
|
+```console
|
|
|
export NODE_ENV=production
|
|
|
```
|
|
|
Windows
|
|
@@ -99,17 +99,17 @@ SET NODE_ENV=production
|
|
|
|
|
|
### API
|
|
|
#### Run the server
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run server:start
|
|
|
```
|
|
|
|
|
|
#### Run the server with hot-reload for development
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run server:dev
|
|
|
```
|
|
|
|
|
|
#### Automatically fix the API code syntax with ESLint
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run server:lint
|
|
|
```
|
|
|
|
|
@@ -117,24 +117,24 @@ yarn run server:lint
|
|
|
### Client
|
|
|
#### Compile and minify for production
|
|
|
Files will be built to the `dist/` directory.
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run app:build
|
|
|
```
|
|
|
|
|
|
#### Run a hot-reload server for client development
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run app:dev
|
|
|
```
|
|
|
|
|
|
|
|
|
#### Automatically fix the client code syntax with ESLint
|
|
|
-```sh
|
|
|
+```console
|
|
|
yarn run app:lint
|
|
|
```
|
|
|
|
|
|
## Automated deployment
|
|
|
The app can be automatically deployed when a push event is sent to the master branch using Gogs. Open a port to the web and start *[webhook_deploy_gogs.js](webhook_deploy_gogs.js)*.
|
|
|
-```sh
|
|
|
+```console
|
|
|
WEBHOOK_SECRET=your_webhook_secret WEBHOOK_PORT=5000 SERVE_CLIENT=true PORT=8080 node webhook_deploy_gogs.js
|
|
|
```
|
|
|
You can pass any parameters to the script, they will be passed to the Docker instance. The following are required.
|
|
@@ -144,5 +144,11 @@ You can pass any parameters to the script, they will be passed to the Docker ins
|
|
|
| `WEBHOOK_SECRET` | The secret set on Gogs to verify the identity |
|
|
|
| `WEBHOOK_PORT` | The port the script is listening to |
|
|
|
|
|
|
+## Running tests
|
|
|
+The `docker-compose` script will automatically run tests. Use the following command to run them by hand.
|
|
|
+```console
|
|
|
+yarn test
|
|
|
+```
|
|
|
+
|
|
|
## License
|
|
|
[The MIT license](LICENSE)
|