mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #4112 from Ocelot-Social-Community/4107-database-migration-readme
chore: 🍰 Database Initialisation Readme After First Deployment
This commit is contained in:
commit
27d3e81f91
@ -26,27 +26,32 @@ some known problems with more recent node versions). You can use the
|
|||||||
between different local node versions.
|
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
|
||||||
$ cd backend
|
$ cd backend
|
||||||
$ yarn install
|
$ yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
Copy Environment Variables:
|
Copy Environment Variables:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# in backend/
|
# in backend/
|
||||||
$ cp .env.template .env
|
$ cp .env.template .env
|
||||||
```
|
```
|
||||||
|
|
||||||
Configure the new file according to your needs and your local setup. Make sure
|
Configure the new file according to your needs and your local setup. Make sure
|
||||||
a [local Neo4J](http://localhost:7474) instance is up and running.
|
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
|
||||||
$ yarn run dev
|
$ yarn run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
or start the backend in production environment with:
|
or start the backend in production environment with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn run start
|
$ yarn run start
|
||||||
```
|
```
|
||||||
|
|
||||||
For e-mail delivery, please configure at least `SMTP_HOST` and `SMTP_PORT` in
|
For e-mail delivery, please configure at least `SMTP_HOST` and `SMTP_PORT` in
|
||||||
@ -65,21 +70,23 @@ backend is running:
|
|||||||
|
|
||||||
{% tabs %}
|
{% tabs %}
|
||||||
{% tab title="Docker" %}
|
{% tab title="Docker" %}
|
||||||
```bash
|
|
||||||
docker-compose exec backend yarn run db:migrate init
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose exec backend yarn run db:migrate init
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endtab %}
|
||||||
{% tab title="Without Docker" %}
|
{% tab title="Without Docker" %}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# in folder backend/
|
# in folder backend/
|
||||||
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
{% endtab %}
|
{% endtab %}
|
||||||
{% endtabs %}
|
{% endtabs %}
|
||||||
|
|
||||||
|
|
||||||
#### Seed Database
|
#### Seed Database
|
||||||
|
|
||||||
If you want your backend to return anything else than an empty response, you
|
If you want your backend to return anything else than an empty response, you
|
||||||
@ -99,7 +106,7 @@ $ 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
|
||||||
# if container is not running, run this command to set up your database indeces and contstraints
|
# if container is not running, run this command to set up your database indeces and contstraints
|
||||||
$ docker-compose run backend yarn run db:migrate init
|
$ docker-compose exec backend yarn run db:migrate init
|
||||||
```
|
```
|
||||||
{% endtab %}
|
{% endtab %}
|
||||||
|
|
||||||
|
|||||||
@ -8,3 +8,55 @@ We have tested two different Kubernetes providers: [Minikube](./minikube/README.
|
|||||||
and [Digital Ocean](./digital-ocean/README.md).
|
and [Digital Ocean](./digital-ocean/README.md).
|
||||||
|
|
||||||
Check out the specific documentation for your provider. After that, choose whether you want to go with the recommended deploy option [Helm](./helm/README.md), or use Kubernetes to apply the configuration for [ocelot.social](./ocelot-social/README.md).
|
Check out the specific documentation for your provider. After that, choose whether you want to go with the recommended deploy option [Helm](./helm/README.md), or use Kubernetes to apply the configuration for [ocelot.social](./ocelot-social/README.md).
|
||||||
|
|
||||||
|
## Initialise Database For Production After Deployment
|
||||||
|
|
||||||
|
After the first deployment of the new network on your server, the database must be initialized to start your network. This involves setting up a default administrator with the following data:
|
||||||
|
|
||||||
|
- E-mail: admin@example.org
|
||||||
|
- Password: 1234
|
||||||
|
|
||||||
|
{% hint style="danger" %}
|
||||||
|
TODO: When you are logged in for the first time, please change your (the admin's) e-mail to an existing one and change your password to a secure one !!!
|
||||||
|
{% endhint %}
|
||||||
|
|
||||||
|
Run the following command in the Docker container of the or a backend:
|
||||||
|
|
||||||
|
{% tabs %}
|
||||||
|
{% tab title="Kubernetes For Docker" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# with explicit pod backend name
|
||||||
|
$ kubectl -n ocelot-social exec -it <backend-name> yarn prod:migrate init
|
||||||
|
|
||||||
|
# or
|
||||||
|
|
||||||
|
# if you have only one backend grep it
|
||||||
|
$ kubectl -n ocelot-social exec -it $(kubectl -n ocelot-social get pods | grep backend | awk '{ print $1 }') yarn prod:migrate init
|
||||||
|
|
||||||
|
# or
|
||||||
|
|
||||||
|
# sh in your backend and do the command here
|
||||||
|
$ kubectl -n ocelot-social exec -it $(kubectl -n ocelot-social get pods | grep backend | awk '{ print $1 }') sh
|
||||||
|
backend: $ yarn prod:migrate init
|
||||||
|
backend: $ exit
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endtab %}
|
||||||
|
{% tab title="Docker-Compose Running Local" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# exec in backend
|
||||||
|
$ docker-compose exec backend yarn run db:migrate init
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endtab %}
|
||||||
|
{% tab title="Running Local" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# exec in folder backend/
|
||||||
|
$ yarn run db:migrate init
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endtab %}
|
||||||
|
{% endtabs %}
|
||||||
|
|||||||
@ -29,8 +29,8 @@ services:
|
|||||||
- "DEBUG=${DEBUG}"
|
- "DEBUG=${DEBUG}"
|
||||||
- PUBLIC_REGISTRATION=false
|
- PUBLIC_REGISTRATION=false
|
||||||
volumes:
|
volumes:
|
||||||
- backend_node_modules:/nitro-backend/node_modules
|
- backend_node_modules:/develop-backend/node_modules
|
||||||
- uploads:/nitro-backend/public/uploads
|
- uploads:/develop-backend/public/uploads
|
||||||
neo4j:
|
neo4j:
|
||||||
volumes:
|
volumes:
|
||||||
- neo4j_data:/data
|
- neo4j_data:/data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user