Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

feat(directory): Basic directory for psychologists #27

Merged
merged 13 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
NEXT_TELEMETRY_DISABLED=1
DATABASE_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante
DB_LOGGING_ENABLE=true

DEMARCHES_SIMPLIFIEES_TOKEN=api-token
DEMARCHES_SIMPLIFIEES_ID=52209
DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]]
8 changes: 8 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
NEXT_PUBLIC_MATOMO_URL=https://matomo.fabrique.social.gouv.fr
NEXT_PUBLIC_MATOMO_SITE_ID="59"
NEXT_PUBLIC_SENTRY_DSN=https://36021ef8cb3b4edc99320a1e2fd1f453@sentry.fabrique.social.gouv.fr/61
desoindx marked this conversation as resolved.
Show resolved Hide resolved

NEXT_TELEMETRY_DISABLED=1
DB_LOGGING_ENABLE=false

DEMARCHES_SIMPLIFIEES_TOKEN=api-token
desoindx marked this conversation as resolved.
Show resolved Hide resolved
DEMARCHES_SIMPLIFIEES_ID=52209
DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]]

NEXT_PUBLIC_DISPLAY_DIRECTORY=false
8 changes: 8 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NEXT_TELEMETRY_DISABLED=1
DB_LOGGING_ENABLE=false

DEMARCHES_SIMPLIFIEES_TOKEN=api-token
DEMARCHES_SIMPLIFIEES_ID=52209
DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]]

NEXT_PUBLIC_DISPLAY_DIRECTORY=true
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/db/migrations/
src/db/config/
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
".js",
".jsx",
".ts",
".tsx"
".tsx",
".d.ts"
]
}
}
Expand All @@ -20,7 +21,8 @@
"jsx-a11y/anchor-is-valid": "off",
"react/prop-types": "off",
"jsx-a11y/label-has-for": "off",
"import/no-unresolved": [2, {"caseSensitive": false}]
"import/no-unresolved": [2, {"caseSensitive": false}],
"react/display-name": "off"
},
"overrides": [
{
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
.eslintcache
coverage
node_modules

.env

out/

.DS_Store
7 changes: 7 additions & 0 deletions .sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require('path');

module.exports = {
'config': path.resolve('./src/db/config', 'config.js'),
'models-path': path.resolve('./src/db', 'models'),
'migrations-path': path.resolve('./src/db', 'migrations'),
}
204 changes: 0 additions & 204 deletions .socialgouv/__tests__/__snapshots__/deploy.js.snap

This file was deleted.

27 changes: 0 additions & 27 deletions .socialgouv/__tests__/deploy.js

This file was deleted.

9 changes: 3 additions & 6 deletions .socialgouv/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
"name": "app",
"type": "static",
"type": "app",
"subdomain": "monpsy",
"registry": "ghcr",
"project": "mon-psy-sante",
"ingress": {
"annotations": {
"nginx.ingress.kubernetes.io/configuration-snippet": "more_set_headers \"Content-Security-Policy: default-src 'none'; connect-src 'self' https://*.gouv.fr https://services.sarbacane.com; font-src 'self' data:; img-src 'self' data: https://forms.sbc08.com; prefetch-src 'self' https://*.gouv.fr; script-src 'self' https://*.gouv.fr https://*.sbc08.com; frame-src 'self' https://*.gouv.fr; style-src 'self' 'unsafe-inline'\";\nmore_set_headers \"X-Frame-Options: deny\";\nmore_set_headers \"X-XSS-Protection: 1; mode=block\";\nmore_set_headers \"X-Content-Type-Options: nosniff\";"
desoindx marked this conversation as resolved.
Show resolved Hide resolved
}
}
"azurepg": true,
"devInitContainerCommand": ["yarn", "db:init"]
}
34 changes: 25 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
ARG PRODUCTION
# from https://nextjs.org/docs/deployment

FROM node:14-alpine as builder
# Builder
FROM node:14-alpine AS builder
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .

RUN yarn install --frozen-lockfile
RUN if [ -z "$PRODUCTION" ]; then cp .env.staging .env.production; cp ./public/robots.staging.txt ./public/robots.txt; fi
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline
RUN yarn export

FROM ghcr.io/socialgouv/docker/nginx:6.64.2
# Production image, copy all the files and run next
FROM node:14-alpine AS runner
WORKDIR /app

ARG PRODUCTION
ENV NODE_ENV production

COPY --from=builder /out /usr/share/nginx/html
# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js .
COPY --from=builder /app/sentry.client.config.js .
COPY --from=builder /app/sentry.server.config.js .
COPY --from=builder /app/.sequelizerc .
COPY --from=builder /app/.env.production .
COPY --from=builder /app/package.json .
COPY --from=builder /app/src ./src
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder --chown=node:node /app/.next ./.next

# Create a robots.txt based on PRODUCTION build argument
RUN if [ ! -z "$PRODUCTION" ]; then echo -e "User-agent: *\nAllow: /">/usr/share/nginx/html/robots.txt; else echo -e "User-agent: *\nDisallow: /">/usr/share/nginx/html/robots.txt; fi
USER node

CMD ["yarn", "start"]
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ https://monpsy.sante.gouv.fr

# Run locally

First you need to run a docker with a postgre DB
```
docker-compose up
```

then you need to prepare the project
```
yarn
yarn build
npm run dev
yarn run db:init
```

and finally you can run the project locally with
```
yarn run dev
```

Loading