Skip to content

Commit

Permalink
Merge pull request #63 from gipplab/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jpwahle authored Jul 12, 2022
2 parents 638f045 + a9e491a commit a9c108a
Show file tree
Hide file tree
Showing 48 changed files with 8,085 additions and 3,973 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ node_modules
lib
public
.env
.env.production
coverage
.DS_Store
.DS_Store
.idea
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY ./ /api-server

ENV NODE_ENV=production
RUN npm install --production
RUN npm run build --prod
RUN npm run build --production
73 changes: 36 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,37 @@

## Getting Started

First, you need to copy the sample `.env.sample` file to `.env`

```
After cloning the repository you need to change the directory.
```shell
cd NLP-Land-backend
cp .env.sample .env
```

Then we are providing two ways to setup this project.
Then we are providing two ways to set up this project.


<details> <summary> Production </summary>
<br/>
In production mode an instance of mongo is created in Docker and the backend started and connected to it.

To spin up the production version of this project, switch into the root directory of this project and run:
First, you need to create an `.env.production` file.
You can copy the `.env.development` file, if you do not intent to change the default values:
```shell
cp .env.development .env.production
```

```console
docker-compose up --build
In production mode an instance of mongo is created in Docker and the backend started and connected to it.
To spin up the production version of this project, switch into the root directory of this project and run:
```shell
docker-compose --env-file=.env.production up --build
```
</details>
<details> <summary> Development </summary>
<br/>
If you want to actively develop this project, you need to install the project and dependencies locally.

To run the development environment locally, you need to spin up a mongodb instance.

```console
source .env
If you want to actively develop this project, you need to install the project and dependencies locally with
```shell
npm install
```

To run the development environment locally, you need to create up a mongodb instance the first time you start the backend.
```shell
source .env.development
set -o allexport
docker run -d -p 27017:27017 --name mongodev \
-e MONGO_INITDB_ROOT_USERNAME=$MONGO_USER \
Expand All @@ -49,13 +52,12 @@ docker run -d -p 27017:27017 --name mongodev \
mongo
```

Then you can start the backend with auto-reload (whenever the code was changed) using:

```console
set -o allexport
source .env
npm run build:live
Then you can start the backend using:
```shell
npm run dev
```
In the future only need to use this command and can skip the other commands.
It starts the docker container (if it is not started yet), uses auto-reload (whenever the code was changed), automatically compiles TypeScript files, and spawns multiple processes.
</details>

## Repository
Expand All @@ -77,62 +79,59 @@ The following is a list of some notable packages we use:
- [Redoc](https://github.com/Redocly/redoc): Automatic documentation

## Tests

This repository follows clean code principles using static typing, linting, unit tests, semanitc releases, and documentation. In the following you can find details for running these tests in the cloud and locally.
This repository follows clean code principles using static typing, linting, unit tests, semantic releases, and documentation. In the following you can find details for running these tests in the cloud and locally.

<details> <summary> Continous Integration (CI) </summary>
<details> <summary> Continuous Integration (CI) </summary>

1. Whenever an issue is assigned, a issue branch from the current `dev` branch is created.
1. Whenever an issue is assigned, an issue branch from the current `dev` branch is created.
2. Whenever you create a pull request against the `dev` branch, typing, linting, and unit tests are checked.
3. Whenever a maintainer or admin creates a pull request from the `dev` to the `main` branch, a new release, docker image, documentation, and coverage report is generated.

</details>

<details> <summary> Local Pipelines </summary>

To run these CI pipelines such as tests and linting locally install [act](https://github.com/nektos/act). With act you can run CI tests in docker containers the way they are run on GitHub actions.

To run the full check suite with act you need the full ubuntu image (>12GB) and then execute:

```console
```shell
act
```

To run a single check like the Test from the pipeline, execute:

```console
```shell
act -j Test
```

You can also run the tests without act using:

```console
```shell
npm run test
npm run lint
```
</details>


## Documentation
The auto-generated redoc documentation can be found [here](https://gipplab.github.io/NLP-Land-backend/).

A general overview of standard endpoints, parameters, and possible queries can be found [here](https://florianholzapfel.github.io/express-restify-mongoose/v1/).


## Contribution

New Git and GitHub deploys, releases, as well as changelogs are automatically created and deployed when a maintainer or admin merges a pull request from the `dev` into the `main` branch.

Developers should proceed in the following way:
1. If you want to develop a new feature, fix, or test, create an issue and assign yourself to that issue. This will trigger a GitHub action that creates a new issue from the dev branch.
1. If you want to develop a new feature, fix, or test, create an issue and assign yourself to that issue. You can create a new branch using [GitHub's built-in system](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue).
2. When you are done developing, create a commit with a message that includes "#patch", "#minor", or "#major" according to the semantic versioning [specification](https://semver.org/).
3. Finally, create a pull request to the `dev` branch. Assign the pull request one of the labels "fix", "feature", or "test" so they appear correctly later in the changelogs.

## License

This project is licensed under the terms of MIT license. For more information, please see the [LICENSE](LICENSE) file.

## Citation

If you use this repository, or use our tool for analysis, please cite our work:

```bib
Expand All @@ -146,4 +145,4 @@ If you use this repository, or use our tool for analysis, please cite our work:
address = {Marseille, France},
doi = {},
}
```
```
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ version: '3'
services:
api:
build: .
env_file:
- .env
depends_on:
- mongo
command: npm run cluster
Expand All @@ -17,7 +15,6 @@ services:
mongo:
image: mongo:latest
restart: always
env_file: .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
Expand Down
Loading

0 comments on commit a9c108a

Please sign in to comment.