|
4 | 4 |
|
5 | 5 | For building and testing a project check the [GitHub Workflow](../.github/workflows/gradle.yml).
|
6 | 6 |
|
7 |
| -To run the backend you need to make Spring Boot jars and run docker compose, but before do not forget to prepare environment variables and secret keys. |
8 |
| -But before ensure that frontend is already built. |
| 7 | +### TLS Keys |
| 8 | + |
| 9 | +Generate self-signed certificates for the backend. |
| 10 | + |
| 11 | +```bash |
| 12 | +export ITMO_DATING_KEYSTORE_PASSWORD="<...>" |
| 13 | +bash ./script/crypto/keys.bash generate |
| 14 | +``` |
| 15 | + |
| 16 | +It will also duplicate backend keys to use at gateway edge. |
| 17 | + |
| 18 | +On production replace `*-external.p12` with widely trusted certificates. |
| 19 | + |
| 20 | +### Building |
| 21 | + |
| 22 | +To build all backend services just do simple: |
9 | 23 |
|
10 | 24 | ```bash
|
11 |
| -source config/env/local.sh |
12 |
| -bash config/crypto/keys.bash generate |
13 | 25 | gradle bootJar
|
14 |
| -docker compose up --build |
15 | 26 | ```
|
16 | 27 |
|
17 |
| -To connect to database you can enter the database container and login into `psql`. For example, |
| 28 | +### Running Vault & Consul |
| 29 | + |
| 30 | +Firstly deploy `Consul` and `Vault`. Then initialize the new Vault or unseal it. |
| 31 | + |
| 32 | +```bash |
| 33 | +docker compose up --build -d consul vault |
| 34 | +``` |
| 35 | + |
| 36 | +Create the `itmo-dating` Secret Engine with KV v1 (!!). |
| 37 | + |
| 38 | +There are secrets you need for each service. |
| 39 | + |
| 40 | +#### People |
| 41 | + |
| 42 | +```json |
| 43 | +{ |
| 44 | + "itmo-dating.auth.jwt.public-key": "<...>", |
| 45 | + "itmo-dating.matchmaker.url": "https://matchmaker/api", |
| 46 | + "itmo-dating.postgres.db": "postgres", |
| 47 | + "itmo-dating.postgres.host": "database-primary.dating.se.ifmo.ru", |
| 48 | + "itmo-dating.postgres.password": "<...>", |
| 49 | + "itmo-dating.postgres.username": "postgres", |
| 50 | + "itmo-dating.s3.bucket.profile-photos": "profile-photos", |
| 51 | + "itmo-dating.s3.host": "object-storage.dating.se.ifmo.ru", |
| 52 | + "itmo-dating.s3.password": "<...>", |
| 53 | + "itmo-dating.s3.port": "9000", |
| 54 | + "itmo-dating.s3.username": "<...>" |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +#### Matchmaker |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "itmo-dating.auth.jwt.public-key": "<...>", |
| 63 | + "itmo-dating.postgres.db": "postgres", |
| 64 | + "itmo-dating.postgres.host": "database-primary.dating.se.ifmo.ru", |
| 65 | + "itmo-dating.postgres.password": "<...>", |
| 66 | + "itmo-dating.postgres.username": "postgres" |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +#### Authik |
| 71 | + |
| 72 | +```bash |
| 73 | +{ |
| 74 | + "itmo-dating.auth.jwt.duration": "PT2H", |
| 75 | + "itmo-dating.auth.jwt.private-key": "<...>", |
| 76 | + "itmo-dating.auth.jwt.public-key": "<...>", |
| 77 | + "itmo-dating.postgres.db": "postgres", |
| 78 | + "itmo-dating.postgres.host": "database-primary.dating.se.ifmo.ru", |
| 79 | + "itmo-dating.postgres.password": "<...>", |
| 80 | + "itmo-dating.postgres.username": "postgres", |
| 81 | + "itmo-dating.telegram.bot-token": "<...>" |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +### Running the Config Server |
| 86 | + |
| 87 | +When Vault is ready and unsealed, you can start Config Service. |
| 88 | + |
| 89 | +```bash |
| 90 | +docker compose up --build -d config |
| 91 | +``` |
| 92 | + |
| 93 | +### Running other services |
18 | 94 |
|
19 | 95 | ```bash
|
20 |
| -docker exec -it itmo-dating-matchmaker-database-1 bash |
21 |
| -psql -h localhost -p 5432 -d $POSTGRES_DB -U $POSTGRES_USER |
| 96 | +export ITMO_DATING_VAULT_TOKEN="<...>" |
| 97 | +docker compose up --build -d |
22 | 98 | ```
|
0 commit comments