Browse Source

update default domain and readme

Olivier Massot 6 months ago
parent
commit
b81eeef854
8 changed files with 198 additions and 640 deletions
  1. 1 19
      api/.env
  2. BIN
      app/.yarn/install-state.gz
  3. 1 0
      app/package.json
  4. 31 3
      app/pages/about.vue
  5. 110 586
      app/yarn.lock
  6. 2 2
      docker/api/vhost.conf
  7. 2 2
      docker/caddy/caddy/Caddyfile
  8. 51 28
      readme.md

+ 1 - 19
api/.env

@@ -26,32 +26,14 @@ DATABASE_URL='mysql://root:Hxb3aMXUPb3m%$Ai*@snc_demo_db:3306/snc_demo?serverVer
 ###< doctrine/doctrine-bundle ###
 
 ###> nelmio/cors-bundle ###
-CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1|local\.app\.snc-demo\.fr)(:[0-9]+)?$'
+CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1|local\.app\.snc-demo\.net)(:[0-9]+)?$'
 ###< nelmio/cors-bundle ###
 
-###> symfony/messenger ###
-# Choose one of the transports below
-# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
-# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
-MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
-###< symfony/messenger ###
-
 ###> symfony/lock ###
 # Choose one of the stores below
-# postgresql+advisory://db_user:db_password@localhost/db_name
 LOCK_DSN=flock
 ###< symfony/lock ###
 
 ###> symfony/mailer ###
 MAILER_DSN=null://null
 ###< symfony/mailer ###
-
-###> symfony/mercure-bundle ###
-# See https://symfony.com/doc/current/mercure.html#configuration
-# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
-MERCURE_URL=https://example.com/.well-known/mercure
-# The public URL of the Mercure hub, used by the browser to connect
-MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure
-# The secret used to sign the JWTs
-MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
-###< symfony/mercure-bundle ###

BIN
app/.yarn/install-state.gz


+ 1 - 0
app/package.json

@@ -16,6 +16,7 @@
     "@mdi/font": "^7.4.47",
     "@nuxtjs/i18n": "^9.5.5",
     "nuxt": "^3.17.5",
+    "sass": "^1.69.5",
     "vite-plugin-vuetify": "^2.1.1",
     "vuetify": "3.8.8"
   },

+ 31 - 3
app/pages/about.vue

@@ -2,11 +2,31 @@
   <div>
     <h1 class="text-center mb-6">About</h1>
     <v-card class="pa-4">
-      <p class="text-center">
-        This is a demo application built with Symfony 7 + Nuxt.js 3.
+      <p>
+        This project is a full-stack web application demonstrating the integration of modern web technologies through a
+        Docker Compose setup.
+      </p>
+
+      <p>
+        It serves as both a proof of concept and a starter template for developers looking to work with this particular
+        technology stack.
+      </p>
+
+      <p>
+        The backend is built with <a href="https://symfony.com/" target="_blank">Symfony 7</a> and
+        <a href="https://api-platform.com/" target="_blank">API Platform 4</a>.
+
+        The frontend uses <a href="https://nuxt.com/" target="_blank">Nuxt.js 3</a> with
+        <a href="https://vuetifyjs.com/en" target="_blank">Vuetify</a> components and
+        <a href="https://www.typescriptlang.org/" target="_blank">TypeScript</a>.
+
+        The entire application is served through Caddy web server, offering automatic HTTPS.
+        Enjoy!
       </p>
       <p class="text-center">
-        <a href="https://github.com/olinox14/model_snc">Contribute</a>
+        <v-btn href="https://github.com/olinox14/model_snc" target="_blank">
+          Contribute
+        </v-btn>
       </p>
     </v-card>
   </div>
@@ -17,3 +37,11 @@ useHead({
   title: 'About'
 })
 </script>
+
+<style scoped lang="scss">
+  .v-card p {
+    max-width: 900px;
+    margin: 25px auto;
+    text-align: justify;
+  }
+</style>

File diff suppressed because it is too large
+ 110 - 586
app/yarn.lock


+ 2 - 2
docker/api/vhost.conf

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

+ 2 - 2
docker/caddy/caddy/Caddyfile

@@ -2,7 +2,7 @@
   debug
 }
 
-local.api.snc-demo.fr {
+local.api.snc-demo.net {
   tls internal
 
   # Serve static assets directly
@@ -28,7 +28,7 @@ local.api.snc-demo.fr {
   }
 }
 
-local.app.snc-demo.fr {
+local.app.snc-demo.net {
   tls internal
   reverse_proxy snc_demo_app:3002
   log {

+ 51 - 28
readme.md

@@ -1,21 +1,32 @@
-# Model: Symfony+Nuxt+Caddy
+# Fullstack demo : Symfony + Nuxt + Caddy
+
+This project is a full-stack web application demonstrating the integration of modern web technologies through a 
+Docker Compose setup. 
+
+It serves as both a proof of concept and a starter template for developers looking to work with this particular 
+technology stack.
+
+The backend is built with [Symfony 7](https://symfony.com/) and [API Platform 4](https://api-platform.com/). 
+The frontend uses [Nuxt.js 3](https://nuxt.com/) with [Vuetify](https://vuetifyjs.com/en) components and [TypeScript](https://www.typescriptlang.org/).
+The entire application is served through Caddy web server, offering automatic HTTPS.
+Enjoy!
 
 ## Install
 
-Add those lines to your hosts file:
+Add those lines to your [hosts](https://linuxize.com/post/how-to-edit-your-hosts-file/) file :
 
     127.0.0.1 local.api.<domain>.fr
     127.0.0.1 local.app.<domain>.fr
 
-Run from the project directory:
+Run from the project directory :
 
     docker-compose build
 
-Copy the .env file, and edit it if needed:
+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 (default: 'snc-demo.net')
 
 * docker/api/vhost.conf
 * docker/caddy/Caddyfile
@@ -24,47 +35,59 @@ Edit the following files to update the directives whith you domain name
 
 ## Run
 
-Run from the project directory:
+Run from the project directory :
 
     docker-compose up
 
 Install the API server : 
 
-    docker exec -it api bash
+    docker exec -it snc_demo_api bash
     composer install --with-all-dependencies
     bin/console doctrine:database:create
     bin/console doctrine:schema:update --force
 
 Start the nuxt server:
 
-    docker exec -it app bash
+    docker exec -it snc_demo_app bash
     yarn install
     yarn dev
 
-> **Warning**: You will probably have to open a tab for both of the domains (`local.api.<domain>.fr` and 
->          `local.api.<domain>.fr`) in your browser to add a security exception for the self-signed SSL certificate.
+> **Warning**: You will probably have to open a tab for both of the subdomains (`local.api.<domain>.net` and 
+>          `local.api.<domain>.net`) in your browser to add a security exception for the self-signed SSL certificate.
 > Without it, the frontend's requests will be blocked as CORS errors.
 
 
 ## Add Fixtures
 
-	ALTER TABLE `snc_demo`.`author` AUTO_INCREMENT = 1;
-    INSERT INTO `snc_demo`.`author` (`name`)
-    VALUES 
-        ('Artist 1'),
-        ('Artist 2'),
-        ('Artist 3');
-
-    ALTER TABLE `snc_demo`.`song` AUTO_INCREMENT = 1;
-    INSERT INTO `snc_demo`.`song` (`title`, `author_id`)
-    VALUES
-        ('Song A', 1),
-        ('Song B', 1),
-        ('Song C', 1),
-        ('Song D', 2),
-        ('Song E', 2),
-        ('Song F', 3),
-        ('Song G', 3);
+    docker exec -it snc_demo_db bash
+
+    mysql -u root -p'Hxb3aMXUPb3m%$Ai*' -D snc_demo -e "
+        ALTER TABLE `snc_demo`.`author` AUTO_INCREMENT = 1;
+        INSERT INTO `snc_demo`.`author` (`name`)
+        VALUES 
+            ('Artist 1'),
+            ('Artist 2'),
+            ('Artist 3');
+    
+        ALTER TABLE `snc_demo`.`song` AUTO_INCREMENT = 1;
+        INSERT INTO `snc_demo`.`song` (`title`, `author_id`)
+        VALUES
+            ('Song A', 1),
+            ('Song B', 1),
+            ('Song C', 1),
+            ('Song D', 2),
+            ('Song E', 2),
+            ('Song F', 3),
+            ('Song G', 3);
+    "
+
+> Warning : If you plan to use this as a starter for your own project, don't forget to change the 
+> DB password !
+
+
+## Try it
+
+At this point, the application shall be served at https://local.app.snc-demo.fr/.
 
 
 ## Accessing the OpenAPI Interface
@@ -72,7 +95,7 @@ Start the nuxt server:
 The OpenAPI interface is available at:
 
 ```
-https://local.api.snc-demo.fr/api/docs
+https://local.api.snc-demo.net/api/docs
 ```
 
 This interface provides documentation for all available API routes.

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