mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refine backend README.md
This commit is contained in:
parent
df4a5b7390
commit
d57c02c48e
@ -7,8 +7,9 @@ Run the following command to install everything through docker.
|
|||||||
The installation takes a bit longer on the first pass or on rebuild ...
|
The installation takes a bit longer on the first pass or on rebuild ...
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder
|
||||||
$ docker-compose up
|
$ docker-compose up
|
||||||
|
# or
|
||||||
# rebuild the containers for a cleanup
|
# rebuild the containers for a cleanup
|
||||||
$ docker-compose up --build
|
$ docker-compose up --build
|
||||||
```
|
```
|
||||||
@ -28,6 +29,7 @@ between different local node versions.
|
|||||||
Install node dependencies with [yarn](https://yarnpkg.com/en/):
|
Install node dependencies with [yarn](https://yarnpkg.com/en/):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder
|
||||||
$ cd backend
|
$ cd backend
|
||||||
$ yarn install
|
$ yarn install
|
||||||
```
|
```
|
||||||
@ -45,12 +47,14 @@ a [local Neo4J](http://localhost:7474) instance is up and running.
|
|||||||
Start the backend for development with:
|
Start the backend for development with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/
|
||||||
$ yarn run dev
|
$ yarn run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
or start the backend in production environment with:
|
or start the backend in production environment with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/
|
||||||
$ yarn run start
|
$ yarn run start
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -72,6 +76,7 @@ backend is running:
|
|||||||
{% tab title="Docker" %}
|
{% tab title="Docker" %}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run db:migrate init
|
$ docker-compose exec backend yarn run db:migrate init
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -79,7 +84,7 @@ $ docker-compose exec backend yarn run db:migrate init
|
|||||||
{% tab title="Without Docker" %}
|
{% tab title="Without Docker" %}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# in folder backend/
|
# in folder backend/ while database is running
|
||||||
# make sure your database is running on http://localhost:7474/browser/
|
# make sure your database is running on http://localhost:7474/browser/
|
||||||
yarn run db:migrate init
|
yarn run db:migrate init
|
||||||
```
|
```
|
||||||
@ -98,12 +103,14 @@ need to seed your database:
|
|||||||
In another terminal run:
|
In another terminal run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run db:seed
|
$ docker-compose exec backend yarn run db:seed
|
||||||
```
|
```
|
||||||
|
|
||||||
To reset the database run:
|
To reset the database run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run db:reset
|
$ docker-compose exec backend yarn run db:reset
|
||||||
# you could also wipe out your neo4j database and delete all volumes with:
|
# you could also wipe out your neo4j database and delete all volumes with:
|
||||||
$ docker-compose down -v
|
$ docker-compose down -v
|
||||||
@ -117,12 +124,14 @@ $ docker-compose exec backend yarn run db:migrate init
|
|||||||
Run:
|
Run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/ while database is running
|
||||||
$ yarn run db:seed
|
$ yarn run db:seed
|
||||||
```
|
```
|
||||||
|
|
||||||
To reset the database run:
|
To reset the database run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/ while database is running
|
||||||
$ yarn run db:reset
|
$ yarn run db:reset
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -140,6 +149,7 @@ you have to migrate your data e.g. because your data modeling has changed.
|
|||||||
Generate a data migration file:
|
Generate a data migration file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run db:migrate:create your_data_migration
|
$ docker-compose exec backend yarn run db:migrate:create your_data_migration
|
||||||
# Edit the file in ./src/db/migrations/
|
# Edit the file in ./src/db/migrations/
|
||||||
```
|
```
|
||||||
@ -147,6 +157,7 @@ $ docker-compose exec backend yarn run db:migrate:create your_data_migration
|
|||||||
To run the migration:
|
To run the migration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run db:migrate up
|
$ docker-compose exec backend yarn run db:migrate up
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -156,6 +167,7 @@ $ docker-compose exec backend yarn run db:migrate up
|
|||||||
Generate a data migration file:
|
Generate a data migration file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/
|
||||||
$ yarn run db:migrate:create your_data_migration
|
$ yarn run db:migrate:create your_data_migration
|
||||||
# Edit the file in ./src/db/migrations/
|
# Edit the file in ./src/db/migrations/
|
||||||
```
|
```
|
||||||
@ -163,6 +175,7 @@ $ yarn run db:migrate:create your_data_migration
|
|||||||
To run the migration:
|
To run the migration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/ while database is running
|
||||||
$ yarn run db:migrate up
|
$ yarn run db:migrate up
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -180,6 +193,7 @@ database after each test, running the tests will wipe out all your data!
|
|||||||
Run the unit tests:
|
Run the unit tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in main folder while docker-compose is running
|
||||||
$ docker-compose exec backend yarn run test
|
$ docker-compose exec backend yarn run test
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -190,6 +204,7 @@ $ docker-compose exec backend yarn run test
|
|||||||
Run the unit tests:
|
Run the unit tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# in backend/ while database is running
|
||||||
$ yarn run test
|
$ yarn run test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user