Skip to content

Commit

Permalink
Merge pull request #64 from WildCodeSchool/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Dolpheus89 authored Feb 6, 2025
2 parents 2c7edd9 + 4b41b6a commit 42f264f
Show file tree
Hide file tree
Showing 210 changed files with 28,220 additions and 8,140 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/dist
*.log
*.md
.git
build/
**/node_modules
27 changes: 26 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## Client

# if VITE_NODE_ENV === production,
# AuthGuard is on
VITE_NODE_ENV="dev"

# Server location change to /graphql in staging or prod
VITE_API_URL="http://localhost:3200"

## Server

DBNAME=YOUR_DBNAME
DBUSERNAME=YOUR_DBUSERNAME
DBPASS=YOUR_DB_PASS
DBPASS=YOUR_DB_PASS

# URL
FRONTEND_URL="http://localhost:4200"

# smtp
SMTP_HOST=""
SMTP_PORT=
SMTP_USER=''
SMTP_PASS=''

# change emailservices initialization when this value === "production"
NODE_ENV="dev"

JWTSECRETKEY="JWTSECRETKEY"
54 changes: 54 additions & 0 deletions .github/workflows/prod-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Compile and push client image


on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:


jobs:


build:


runs-on: ubuntu-latest


steps:

- uses: actions/checkout@v4

# login with Docker

- uses: docker/login-action@v3
name: Login to Docker Hub

with:

username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}



# prepare buildx for docker

- uses: docker/setup-buildx-action@v3
name: Set up Docker Buildx


# build and push the newly created image

- uses: docker/build-push-action@v5
name: Build and push

with:

context: ./client
file: ./client/Dockerfile
push: true

tags: ${{ secrets.DOCKER_HUB_USERNAME }}/prod_client_pawplanner:latest
54 changes: 54 additions & 0 deletions .github/workflows/prod-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Compile and push server image


on:


push:
branches: ["main"]


workflow_dispatch:


jobs:

build:


runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4


# login with Docker

- uses: docker/login-action@v3
name: Login to Docker Hub

with:

username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}



# prepare buildx for docker

- uses: docker/setup-buildx-action@v3
name: Set up Docker Buildx


# build and push the newly created image

- uses: docker/build-push-action@v5
name: Build and push

with:

context: ./server
file: ./server/Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/prod_server_pawplanner:latest
54 changes: 54 additions & 0 deletions .github/workflows/staging-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Compile and push client image


on:
push:
branches: ["staging"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:


jobs:


build:


runs-on: ubuntu-latest


steps:

- uses: actions/checkout@v4

# login with Docker

- uses: docker/login-action@v3
name: Login to Docker Hub

with:

username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}



# prepare buildx for docker

- uses: docker/setup-buildx-action@v3
name: Set up Docker Buildx


# build and push the newly created image

- uses: docker/build-push-action@v5
name: Build and push

with:

context: ./client
file: ./client/Dockerfile
push: true

tags: ${{ secrets.DOCKER_HUB_USERNAME }}/staging_client_pawplanner:latest
54 changes: 54 additions & 0 deletions .github/workflows/staging-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Compile and push server image


on:


push:
branches: ["staging"]


workflow_dispatch:


jobs:

build:


runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4


# login with Docker

- uses: docker/login-action@v3
name: Login to Docker Hub

with:

username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}



# prepare buildx for docker

- uses: docker/setup-buildx-action@v3
name: Set up Docker Buildx


# build and push the newly created image

- uses: docker/build-push-action@v5
name: Build and push

with:

context: ./server
file: ./server/Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/staging_server_pawplanner:latest
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ dist-ssr
**/.env
.env
*/node_modules
/db_data
/db_data

# Upload
**server/upload
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
npm run check-format || {
echo "🚨 Your code is not properly formatted. Please run 'npm run format' in the root directory to fix the formatting."
echo "Once formatted, you will need to run 'git add' again before committing."
exit 1
}
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ ___
- **Apollo Server**
- **TypeGraphQL**
- **PostegreSQL**
- **Jest**
- Client side:
- **React** (through ViteJS)
- **Apollo Client** (via Vite)
- **Sass**
- **Vitest**

## Launch

Expand All @@ -39,6 +41,13 @@ ___
2. **Any other launch**
- Run `docker compose up`

Every new dependency asks for a rebuild (`npm run ci:all`, `docker compose down` then `docker compose up --build`).

**Client**: http://localhost:4200/ </br>
**Server**: http://localhost:3200/

**Adminer**: http://localhost:8080/

### Explanations

First of all, copy and edit the `.env.sample` in a `.env` file. <br>
Expand All @@ -48,14 +57,16 @@ Then run `npm run install:all` to run the `npm install` commands in the /root, /

On first launch, create your PostgreSQL user, either inside your container (run `npm run init:db`, it works as explained in [this documentation](./_ressources/documentation/Database_initialization.md)) or through a PostgreSQL user interface such as **pgAdmin**.

You can verify if your user has been created through **adminer** (Système: PostgreSQL | Serveur: db | Utilisateur: $DBUSERNAME | Mot de passe: $DBPASS | Base de données: $DBNAME).
You can verify if your user has been created through **adminer** (Système: PostgreSQL | Serveur: db | Utilisateur: $DBUSERNAME | Mot de passe: $DBPASS | Base de données: $DBNAME - replace the variables).

Run `docker compose up`.

Isolated basic commands for debugging purpose:
- client side: `npm run dev`
- server side: `npm start`

// FIXME: add doc design pattern

### Folder Structure

```lua (aesthetic use, not actual lua)
Expand All @@ -68,12 +79,14 @@ PawPlanner/
├── client/ -- FRONTEND
│ ├── public/
| ├── src/
| │ ├── __tests__/
| │ | └── ...
| │ ├── assets/
| │ ├── components/
| │ | ├── _atoms/
| │ | ├── _molecules/
| │ | ├── _organisms/
| │ | └── ComponentName/ -- TODO: sort and clean
| │ | └── ComponentName/
| | │ ├── ComponentName.tsx
| | │ └── ComponentName.scss
| │ ├── graphQL/
Expand Down Expand Up @@ -101,6 +114,8 @@ PawPlanner/
| └── -- Other client side config files
├── server/ -- BACKEND
| ├── src/
| │ ├── __tests__/
| │ | └── ...
| │ ├── dataSource/
| │ | ├── dataSource.ts
| │ | └── initTestData.ts
Expand Down
8 changes: 8 additions & 0 deletions _ressources/conception_ressources/SequenceDiagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
1. [Registration Sequence](#registration-sequence)
2. [Login Sequence](#login-sequence)
3. [Logout Sequence](#logout-sequence)
4. [Forgot password](#forgot-password-sequence)

### Visitor functions

Expand Down Expand Up @@ -40,6 +41,13 @@

![UML Diagram Use Case of PawPlanner](./assets/sequences/logout.svg)


## Forgot Password Sequence

[Back to Top](#table-of-contents)

![UML Diagram Use Case of PawPlanner](./assets/sequences/ForgotPassword.svg)

---
---

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _ressources/conception_ressources/class.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ressources/documentation/MPD_PawPlanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _ressources/scripts/init_db_user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exec } from 'child_process';
import { exec } from 'node:child_process';
import dotenv from 'dotenv';
dotenv.config();

Expand Down
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"quoteProperties": "asNeeded",
"semicolons": "always",
"trailingCommas": "all"
},
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
},
"organizeImports": { "enabled": true },
Expand Down
2 changes: 2 additions & 0 deletions client-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker compose exec client /bin/bash -c "npm install $*"
Loading

0 comments on commit 42f264f

Please sign in to comment.