Skip to content

Commit

Permalink
feat: add instructions to run the stack locally (#77)
Browse files Browse the repository at this point in the history
* feat: add instructions to run the stack locally

* chore: revert apoc.conf
  • Loading branch information
Kuruyia authored Feb 28, 2024
1 parent 5c576d5 commit a3f5911
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 46 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
# LinkedOut

LinkedOut is a user-friendly platform tailored to seasonal workers on the
hunt for job opportunities.

This platform offers a variety of essential features, including user profile
management, job listing services, intelligent job recommendations, streamlined
recruitment processes, transparent review and rating systems, and multilingual
support (initially in French and English).

## Running the platform

LinkedOut is made of two main part: a backend, written in Kotlin, and a mobile
application, written in TypeScript.

### Backend

To run the backend, you can simply start the whole stack using Docker Compose:

```sh
docker compose -f docker-compose.all.yml up -d
```

You will have access to the MinIO web interface through [localhost:8280](http://localhost:8280),
the default username is `minio` and the default password is `miniosecret`.

> [!WARNING]
> Because it is not possible to generate the access key in advance, you will not have
> access to features requiring S3 (profile picture and resume uploading) unless
> you manually create an access key in the MinIO web interface and set the
> `S3_ACCESS_KEY` and `S3_SECRET_KEY` environment variables in the `linkedout_profile`
> service.
### Mobile application

First, you'll need to create a `.env` file in the `front/` directory. Here's
a sample file for the Android emulator:

```
EXPO_PUBLIC_API_URL=http://10.0.2.2:9090/api/v1
EXPO_PUBLIC_OIDC_DISCOVERY_URL=https://auth.linkedout.cluster-2020-5.dopolytech.fr/realms/linkedout-dev
EXPO_PUBLIC_OIDC_CLIENT_ID=linkedout-mobile
```

Afterward, install the dependencies and run Expo:

```sh
cd front/
npm i
npm start
```

For the Android emulator, you might need to set your `ANDROID_HOME` environment
variable to point to your Android SDK root:

```sh
ANDROID_HOME='/home/user/Android/Sdk' npm start
```
138 changes: 138 additions & 0 deletions docker-compose.all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
x-linkedout-common: &linkedout_common
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
neo4j:
condition: service_started

x-linkedout-env: &linkedout_env
NATS_SPRING_SERVER: nats://nats:4222

services:
# Postgres
postgres:
image: bitnami/postgresql:16.1.0
environment:
ALLOW_EMPTY_PASSWORD: yes
POSTGRESQL_USERNAME: postgres
POSTGRESQL_POSTGRES_PASSWORD: postgres
volumes:
- postgresql_data:/bitnami/postgresql
- ./config/postgres:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U postgres'"]
interval: 5s
timeout: 2s
retries: 24

# NATS
nats:
image: bitnami/nats:2.10.5

# Neo4j
neo4j:
image: neo4j
environment:
NEO4J_PLUGINS: "[\"apoc\", \"apoc-extended\"]"
NEO4J_AUTH: neo4j/password
NEO4J_dbms_security_procedures_allowlist: gds.*, apoc.*
NEO4J_dbms_security_procedures_unrestricted: gds.*, apoc.*
volumes:
- neo4j_data:/bitnami/neo4j
- ./backend/recommendation/apoc.conf:/var/lib/neo4j/conf/apoc.conf
- ./backend/recommendation/schema.cypher:/var/lib/neo4j/db_init/schema.cypher

# MinIO
minio:
image: bitnami/minio:2024.2.26
ports:
- 8280:9001
volumes:
- minio_data:/bitnami/minio/data

# LinkedOut microservices
linkedout_api_gateway:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/api_gateway
ports:
- 9090:9090
environment:
<<: *linkedout_env

linkedout_employer:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/employer
environment:
<<: *linkedout_env
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/employer
SPRING_R2DBC_USERNAME: employer
SPRING_R2DBC_PASSWORD: employer
SPRING_FLYWAY_URL: jdbc:postgresql://postgres:5432/employer
SPRING_FLYWAY_USER: employer
SPRING_FLYWAY_PASSWORD: employer

linkedout_jobs:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/jobs
environment:
<<: *linkedout_env
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/job
SPRING_R2DBC_USERNAME: job
SPRING_R2DBC_PASSWORD: job
SPRING_FLYWAY_URL: jdbc:postgresql://postgres:5432/job
SPRING_FLYWAY_USER: job
SPRING_FLYWAY_PASSWORD: job

linkedout_messaging:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/messaging
environment:
<<: *linkedout_env
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/messaging
SPRING_R2DBC_USERNAME: messaging
SPRING_R2DBC_PASSWORD: messaging
SPRING_FLYWAY_URL: jdbc:postgresql://postgres:5432/messaging
SPRING_FLYWAY_USER: messaging
SPRING_FLYWAY_PASSWORD: messaging

linkedout_notification:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/notification
environment:
<<: *linkedout_env
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/notification
SPRING_R2DBC_USERNAME: notification
SPRING_R2DBC_PASSWORD: notification
SPRING_FLYWAY_URL: jdbc:postgresql://postgres:5432/notification
SPRING_FLYWAY_USER: notification
SPRING_FLYWAY_PASSWORD: notification

linkedout_profile:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/profile
environment:
<<: *linkedout_env
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/profile
SPRING_R2DBC_USERNAME: profile
SPRING_R2DBC_PASSWORD: profile
SPRING_FLYWAY_URL: jdbc:postgresql://postgres:5432/profile
SPRING_FLYWAY_USER: profile
SPRING_FLYWAY_PASSWORD: profile
S3_ACCESS_KEY: minio
S3_SECRET_KEY: miniosecret

linkedout_recommendation:
<<: *linkedout_common
image: ghcr.io/thomas-mauran/linkedout/recommendation
environment:
<<: *linkedout_env
SPRING_NEO4J_URI: bolt://neo4j:7687
SPRING_NEO4J_AUTHENTICATION_USERNAME: neo4j
SPRING_NEO4J_AUTHENTICATION_PASSWORD: password

volumes:
postgresql_data:
neo4j_data:
minio_data:
55 changes: 9 additions & 46 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ services:
ports:
- 5432:5432
environment:
- ALLOW_EMPTY_PASSWORD=yes
- POSTGRESQL_USERNAME=postgres
- POSTGRESQL_POSTGRES_PASSWORD=postgres
ALLOW_EMPTY_PASSWORD: yes
POSTGRESQL_USERNAME: postgres
POSTGRESQL_POSTGRES_PASSWORD: postgres
volumes:
- postgresql_data:/bitnami/postgresql
- ./config/postgres:/docker-entrypoint-initdb.d
Expand All @@ -18,14 +18,15 @@ services:
ports:
- 4222:4222
- 8222:8222
# neo4j

# Neo4j
neo4j:
image: neo4j
environment:
- NEO4J_PLUGINS=["apoc", "apoc-extended"]
- NEO4J_AUTH=neo4j/password
- NEO4J_dbms_security_procedures_allowlist=gds.*, apoc.*
- NEO4J_dbms_security_procedures_unrestricted=gds.*, apoc.*
NEO4J_PLUGINS: "[\"apoc\", \"apoc-extended\"]"
NEO4J_AUTH: neo4j/password
NEO4J_dbms_security_procedures_allowlist: gds.*, apoc.*
NEO4J_dbms_security_procedures_unrestricted: gds.*, apoc.*
ports:
- 7474:7474
- 7473:7473
Expand All @@ -35,44 +36,6 @@ services:
- ./backend/recommendation/apoc.conf:/var/lib/neo4j/conf/apoc.conf
- ./backend/recommendation/schema.cypher:/var/lib/neo4j/db_init/schema.cypher

# # Keycloak
# keycloak_postgresql:
# image: bitnami/postgresql:16.1.0
# environment:
# - ALLOW_EMPTY_PASSWORD=yes
# - POSTGRESQL_USERNAME=keycloak
# - POSTGRESQL_PASSWORD=keycloak
# - POSTGRESQL_DATABASE=keycloak
# volumes:
# - keycloak_postgresql_data:/bitnami/postgresql
#
# keycloak:
# image: bitnami/keycloak:22.0.5
# ports:
# - 8180:8080
# environment:
# - KEYCLOAK_DATABASE_HOST=keycloak_postgresql
# - KEYCLOAK_DATABASE_NAME=keycloak
# - KEYCLOAK_DATABASE_USER=keycloak
# - KEYCLOAK_DATABASE_PASSWORD=keycloak
# depends_on:
# - keycloak_postgresql
#
# keycloak_config:
# image: bitnami/keycloak-config-cli:5.9.0
# environment:
# - KEYCLOAK_URL=http://keycloak:8080
# - KEYCLOAK_USER=user
# - KEYCLOAK_PASSWORD=bitnami
# - KEYCLOAK_AVAILABILITYCHECK_ENABLED=true
# - KEYCLOAK_AVAILABILITYCHECK_TIMEOUT=120s
# - IMPORT_FILES_LOCATIONS=/config/*
# volumes:
# - ./config/keycloak:/config
# depends_on:
# - keycloak

volumes:
postgresql_data:
neo4j_data:
# keycloak_postgresql_data:

0 comments on commit a3f5911

Please sign in to comment.