Browse Source

api docker ok

olinox14 2 years ago
parent
commit
fd34d08152
12 changed files with 375 additions and 1028 deletions
  1. 1 1
      api/.env
  2. 15 15
      api/composer.json
  3. 68 61
      app/nuxt.config.js
  4. 37 22
      app/package.json
  5. 13 28
      app/tsconfig.json
  6. 228 887
      app/yarn.lock
  7. 1 1
      docker/api/Dockerfile
  8. 2 2
      docker/api/vhost.conf
  9. 4 5
      docker/app/Dockerfile
  10. 2 2
      docker/caddy/caddy/Caddyfile
  11. 1 1
      docker/db/Dockerfile
  12. 3 3
      readme.md

+ 1 - 1
api/.env

@@ -22,7 +22,7 @@ APP_SECRET=e5d6295bff11cbca1abbb10deeb7d74c
 # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
 # For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
 # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
-DATABASE_URL=postgresql://<username>:Hxb3aMXUPb3m%$Ai*@db:5432/<db>?serverVersion=13&charset=utf8
+DATABASE_URL=postgresql://admin:WWDlSQ9IfUctQelFyNyZ@db:5432/<db>?serverVersion=13&charset=utf8
 ###< doctrine/doctrine-bundle ###
 
 ###> nelmio/cors-bundle ###

+ 15 - 15
api/composer.json

@@ -15,21 +15,21 @@
         "nelmio/cors-bundle": "^2.2",
         "phpdocumentor/reflection-docblock": "^5.3",
         "phpstan/phpdoc-parser": "^1.2",
-        "symfony/asset": "6.0.*",
-        "symfony/console": "6.0.*",
-        "symfony/dotenv": "6.0.*",
-        "symfony/expression-language": "6.0.*",
+        "symfony/asset": "6.3.*",
+        "symfony/console": "6.3.*",
+        "symfony/dotenv": "6.3.*",
+        "symfony/expression-language": "6.3.*",
         "symfony/flex": "^2",
-        "symfony/framework-bundle": "6.0.*",
-        "symfony/property-access": "6.0.*",
-        "symfony/property-info": "6.0.*",
-        "symfony/proxy-manager-bridge": "6.0.*",
-        "symfony/runtime": "6.0.*",
-        "symfony/security-bundle": "6.0.*",
-        "symfony/serializer": "6.0.*",
-        "symfony/twig-bundle": "6.0.*",
-        "symfony/validator": "6.0.*",
-        "symfony/yaml": "6.0.*"
+        "symfony/framework-bundle": "6.3.*",
+        "symfony/property-access": "6.3.*",
+        "symfony/property-info": "6.3.*",
+        "symfony/proxy-manager-bridge": "6.3.*",
+        "symfony/runtime": "6.3.*",
+        "symfony/security-bundle": "6.3.*",
+        "symfony/serializer": "6.3.*",
+        "symfony/twig-bundle": "6.3.*",
+        "symfony/validator": "6.3.*",
+        "symfony/yaml": "6.3.*"
     },
     "config": {
         "allow-plugins": {
@@ -74,7 +74,7 @@
     "extra": {
         "symfony": {
             "allow-contrib": false,
-            "require": "6.0.*"
+            "require": "6.3.*"
         }
     }
 }

+ 68 - 61
app/nuxt.config.js

@@ -1,75 +1,82 @@
-import colors from 'vuetify/es5/util/colors'
+import fs from 'fs';
 
 export default {
-  // Global page headers: https://go.nuxtjs.dev/config-head
-  head: {
-    titleTemplate: '%s - App',
-    title: 'app',
-    htmlAttrs: {
-      lang: 'en'
-    },
-    meta: [
-      { charset: 'utf-8' },
-      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
-      { hid: 'description', name: 'description', content: '' },
-      { name: 'format-detection', content: 'telephone=no' }
-    ],
-    link: [
-      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
-    ]
+  app: {
+    head: {
+      title: 'App',
+      meta: [
+        { charset: 'utf-8' },
+        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
+        { hid: 'description', name: 'description', content: '' },
+        { name: 'msapplication-TileColor', content: '#324250' },
+        { name: 'msapplication-TileImage', content: '/favicon/mstile-144x144.png' }
+      ],
+      link: [
+        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
+      ]
+    }
   },
-
-  // Global CSS: https://go.nuxtjs.dev/config-css
   css: [
+    'vuetify/lib/styles/main.sass'
   ],
-
-  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
-  plugins: [
-  ],
-
-  // Auto import components: https://go.nuxtjs.dev/config-components
-  components: true,
-
-  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
-  buildModules: [
-    // https://go.nuxtjs.dev/typescript
-    '@nuxt/typescript-build',
-    // https://go.nuxtjs.dev/vuetify
-    '@nuxtjs/vuetify'
-  ],
-
-  // Modules: https://go.nuxtjs.dev/config-modules
   modules: [
-    // https://go.nuxtjs.dev/axios
-    '@nuxtjs/axios'
+    [
+      '@pinia/nuxt',
+      {
+        autoImports: [
+          // automatically imports `usePinia()`
+          'defineStore',
+          // automatically imports `usePinia()` as `usePiniaStore()`
+          ['defineStore', 'definePiniaStore'],
+        ],
+      }
+    ],
+    '@pinia-orm/nuxt',
+    'nuxt-lodash',
+    '@nuxtjs/i18n',
   ],
-
-  // Axios module configuration: https://go.nuxtjs.dev/config-axios
-  axios: {
-    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
-    baseURL: '/'
+  typescript: {
+    strict: true
   },
-
-  // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
-  vuetify: {
-    customVariables: ['~/assets/variables.scss'],
-    theme: {
-      dark: true,
-      themes: {
-        dark: {
-          primary: colors.blue.darken2,
-          accent: colors.grey.darken3,
-          secondary: colors.amber.darken3,
-          info: colors.teal.lighten1,
-          warning: colors.amber.base,
-          error: colors.deepOrange.accent4,
-          success: colors.green.accent3
-        }
+  //@ts-ignore
+  i18n: {
+    langDir: 'lang',
+    lazy: true,
+    locales: [
+      {
+        code: 'en',
+        iso: 'en-US',
+        file: 'en.json',
+        name: 'English'
+      },
+      {
+        code: 'fr',
+        iso: 'fr-FR',
+        file: 'fr.json',
+        name: 'Français'
       }
+    ],
+    defaultLocale: 'fr',
+    fallbackLocale: 'en',
+    detectBrowserLanguage: false,
+    vueI18n: {
+      legacy: false,
     }
   },
-
-  // Build Configuration: https://go.nuxtjs.dev/config-build
   build: {
+    transpile: ['vuetify'],
+  },
+  vite: {
+    define: {
+      'process.env.DEBUG': process.env.DEBUG,
+    },
+    //@ts-ignore
+    server : {
+      //@ts-ignore
+      port: 443,
+      hmr: {
+        protocol: 'wss'
+      }
+    },
   }
 }

+ 37 - 22
app/package.json

@@ -3,7 +3,7 @@
   "version": "1.0.0",
   "private": true,
   "scripts": {
-    "dev": "nuxt --hostname '0.0.0.0' --port 3002",
+    "dev": "rm -rf /tmp/nitro && nuxt --hostname '0.0.0.0' --port 3002 dev",
     "build": "nuxt build",
     "start": "nuxt start",
     "generate": "nuxt generate",
@@ -13,30 +13,45 @@
     "test": "jest"
   },
   "dependencies": {
-    "@nuxtjs/axios": "^5.13.6",
+    "@fortawesome/fontawesome-free": "^6.2.1",
+    "@mdi/font": "^7.0.96",
+    "@nuxt/image": "^0.7.1",
+    "@nuxtjs/i18n": "^8.0.0-beta.7",
+    "@pinia-orm/nuxt": "^1.1.4",
+    "@pinia/nuxt": "^0.4.3",
+    "date-fns": "^2.29.3",
     "core-js": "^3.19.3",
-    "nuxt": "^2.15.8",
-    "vue": "^2.6.14",
-    "vue-server-renderer": "^2.6.14",
-    "vue-template-compiler": "^2.6.14",
-    "vuetify": "^2.6.1",
+    "nuxt": "^3.0.0",
+    "nuxt-lodash": "^2.4.1",
+    "pinia": "^2.0.28",
+    "pinia-orm": "^1.3.0",
+    "sass": "^1.56.1",
+    "uuid": "^9.0.0",
+    "vuetify": "^3.0.7",
     "webpack": "^4.46.0"
   },
   "devDependencies": {
-    "@babel/eslint-parser": "^7.16.3",
-    "@nuxt/types": "^2.15.8",
-    "@nuxt/typescript-build": "^2.1.0",
-    "@nuxtjs/eslint-config-typescript": "^8.0.0",
-    "@nuxtjs/eslint-module": "^3.0.2",
-    "@nuxtjs/vuetify": "^1.12.3",
-    "@vue/test-utils": "^1.3.0",
-    "babel-core": "7.0.0-bridge.0",
-    "babel-jest": "^27.4.4",
-    "eslint": "^8.4.1",
-    "eslint-plugin-nuxt": "^3.1.0",
-    "eslint-plugin-vue": "^8.2.0",
-    "jest": "^27.4.4",
-    "ts-jest": "^27.1.1",
-    "vue-jest": "^3.0.4"
+    "@nuxt/test-utils-edge": "^3.0.1-rc.0-27810184.d991a55",
+    "@nuxtjs/eslint-config": "^11.0.0",
+    "@nuxtjs/eslint-config-typescript": "^11.0.0",
+    "@nuxtjs/eslint-module": "^3.1.0",
+    "@types/cleave.js": "^1.4.7",
+    "@types/event-source-polyfill": "^1.0.0",
+    "@types/jest": "^29.2.3",
+    "@types/lodash": "^4.14.189",
+    "@types/uuid": "^8.3.4",
+    "@typescript-eslint/eslint-plugin": "^5.43.0",
+    "@typescript-eslint/parser": "^5.43.0",
+    "@vue/eslint-config-standard": "^8.0.1",
+    "eslint": "^8.27.0",
+    "eslint-config-prettier": "^8.5.0",
+    "eslint-plugin-nuxt": "^4.0.0",
+    "eslint-plugin-prettier": "^4.2.1",
+    "eslint-plugin-vue": "^9.7.0",
+    "prettier": "^2.7.1",
+    "ts-jest": "^29.0.3",
+    "typescript": "^4.9.3",
+    "vitest": "^0.25.2",
+    "vue-jest": "^3.0.7"
   }
 }

+ 13 - 28
app/tsconfig.json

@@ -1,37 +1,22 @@
 {
+  // https://nuxtjs.org/concepts/typescript
+  "extends": "./.nuxt/tsconfig.json",
+  "useDefineForClassFields": false,
   "compilerOptions": {
-    "target": "ES2018",
-    "module": "ESNext",
-    "moduleResolution": "Node",
-    "lib": [
-      "ESNext",
-      "ESNext.AsyncIterable",
-      "DOM"
-    ],
     "esModuleInterop": true,
-    "allowJs": true,
     "sourceMap": true,
-    "strict": true,
-    "noEmit": true,
     "experimentalDecorators": true,
-    "baseUrl": ".",
-    "paths": {
-      "~/*": [
-        "./*"
-      ],
-      "@/*": [
-        "./*"
-      ]
-    },
     "types": [
+      "@nuxtjs/date-fns",
       "@nuxt/types",
-      "@nuxtjs/axios",
-      "@types/node"
+      "@nuxtjs/i18n"
+    ],
+    "exclude": [
+      "node_modules",
+      ".nuxt"
+    ],
+    "typeRoots": [
+      "./types"
     ]
-  },
-  "exclude": [
-    "node_modules",
-    ".nuxt",
-    "dist"
-  ]
+  }
 }

File diff suppressed because it is too large
+ 228 - 887
app/yarn.lock


+ 1 - 1
docker/api/Dockerfile

@@ -1,4 +1,4 @@
-FROM php:8.1-apache
+FROM php:8.2-apache
 
 RUN apt-get update && apt-get install -y --fix-missing \
     apt-utils build-essential xorg wget bash gnupg zip nano git;

+ 2 - 2
docker/api/vhost.conf

@@ -1,6 +1,6 @@
 <VirtualHost *:80>
-    ServerName local.api.<domain>.fr
-    ServerAdmin admin@<domain>.fr
+    ServerName local.api.ossatura.net
+    ServerAdmin admin@ossatura.fr
     DocumentRoot /var/www/html/public
 
     <Directory /var/www/html/public>

+ 4 - 5
docker/app/Dockerfile

@@ -1,9 +1,8 @@
-FROM node:14.18.1-buster
+FROM node:18.14.0-buster
 
 ENV WORKDIR /var/app
+
+# Define working directory.
 WORKDIR ${WORKDIR}
 
-# Declare the entrypoint.sh file
-COPY ./docker/app/entrypoint.sh /entrypoint.sh
-RUN chmod +x /entrypoint.sh
-ENTRYPOINT ["/entrypoint.sh"]
+CMD node

+ 2 - 2
docker/caddy/caddy/Caddyfile

@@ -2,7 +2,7 @@
   debug
 }
 
-local.api.<domain>.fr {
+local.api.ossatura.net {
   tls internal
   reverse_proxy http://api:80
   log {
@@ -13,7 +13,7 @@ local.api.<domain>.fr {
   }
 }
 
-local.app.<domain>.fr {
+local.app.ossatura.net {
   tls internal
   reverse_proxy http://app:3002
   log {

+ 1 - 1
docker/db/Dockerfile

@@ -1,3 +1,3 @@
-FROM postgres:13-alpine
+FROM postgres:15.1-alpine
 
 WORKDIR /usr/src

+ 3 - 3
readme.md

@@ -4,8 +4,8 @@
 
 Add those lines to your hosts file:
 
-    127.0.0.1 local.api.<domain>.fr
-    127.0.0.1 local.app.<domain>.fr
+    127.0.0.1 local.api.mydomain.net
+    127.0.0.1 local.app.mydomain.net
 
 Run from the project directory:
 
@@ -15,7 +15,7 @@ Copy the .env file, and edit it if needed:
 
     cp .env.skeleton .env
 
-Edit the following files to update the directives whith you domain name
+Edit the following files to update the directives with you domain name
 
 * docker/api/vhost.conf
 * docker/caddy/Caddyfile

Some files were not shown because too many files changed in this diff