From 874dd51efd821d9b9bb828f6e6428886246f03c6 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Tue, 22 Oct 2024 16:41:21 +0200 Subject: [PATCH 1/2] Update instructions --- docker-compose-prod.yml | 14 +++++------ docker-compose.yml | 8 +++--- docs/development/backend.md | 2 +- docs/development/build-for-production.md | 27 --------------------- docs/development/development-environment.md | 4 +-- docs/development/multitenancy.md | 8 +++--- docs/development/plugins.md | 2 +- docs/installation/deploy-production.md | 22 +++++++++++++++++ docs/installation/deployproduction.md | 19 --------------- 9 files changed, 40 insertions(+), 66 deletions(-) delete mode 100644 docs/development/build-for-production.md create mode 100644 docs/installation/deploy-production.md delete mode 100644 docs/installation/deployproduction.md diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml index 00d219bf..cae9364e 100644 --- a/docker-compose-prod.yml +++ b/docker-compose-prod.yml @@ -1,8 +1,7 @@ services: - laravel-prod: - container_name: laravel-prod - build: - dockerfile: docker/DockerfileBackendProd + backend: + container_name: backend + image: enaccess/micropowermanager-backend:latest depends_on: - maria - redis @@ -13,10 +12,9 @@ services: - 8000:80 - 8443:443 - ui-prod: - container_name: ui-prod - build: - dockerfile: docker/DockerfileFrontendProd + frontend: + container_name: frontend + image: enaccess/micropowermanager-frontend:latest ports: - 8001:8081 volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 69cf9a5a..198d61d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: - laravel-dev: - container_name: laravel-dev + backend-dev: + container_name: backend-dev build: dockerfile: docker/DockerfileBackendDev depends_on: @@ -15,8 +15,8 @@ services: volumes: - ./src/backend:/var/www/html - ui-dev: - container_name: ui-dev + frontend-dev: + container_name: frontend-dev build: dockerfile: docker/DockerfileFrontendDev ports: diff --git a/docs/development/backend.md b/docs/development/backend.md index 4a87a6d6..be373b8b 100644 --- a/docs/development/backend.md +++ b/docs/development/backend.md @@ -11,7 +11,7 @@ automatically. If you prefer to install dependencies manually or need to add add 1. Enter the Docker container named "laravel": ```bash - docker exec -it laravel-dev bash + docker exec -it backend-dev bash ``` 2. Run the following command to install dependencies, replacing {package-name} with the actual name of the package: diff --git a/docs/development/build-for-production.md b/docs/development/build-for-production.md deleted file mode 100644 index ece4a29a..00000000 --- a/docs/development/build-for-production.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -order: 6 ---- - -# Building docker image for production - -## Backend Prod - -From the root directory run - -```sh -docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f docker/DockerfileBackendProd . -``` - -## Frontend Prod - -```sh -docker build --platform linux/amd64 -t micropowermanager-ui-prod -f docker/DockerfileFrontendProd . -``` - -## Docker Compose - -A working environment running with production containers can be achieved by running: - -```sh -docker compose -f docker-compose-prod.yml up -``` diff --git a/docs/development/development-environment.md b/docs/development/development-environment.md index 7ed576d7..d6a4e2fd 100644 --- a/docs/development/development-environment.md +++ b/docs/development/development-environment.md @@ -43,7 +43,7 @@ Before proceeding, ensure you can open a terminal (Terminal app on macOS, termin When you run the application for the first time, you need to run the following command to initialize the databases and load Demo data: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan migrate --seed ``` @@ -90,7 +90,7 @@ It can be run multiple times to generate more data as required. If you wish reset the Demo data setup to the default setup run: ```sh -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan migrate-tenant:drop-demo-company php artisan migrate:fresh --seed ``` diff --git a/docs/development/multitenancy.md b/docs/development/multitenancy.md index 58f49de5..17f33d92 100644 --- a/docs/development/multitenancy.md +++ b/docs/development/multitenancy.md @@ -41,7 +41,7 @@ with data exclusive to their company, providing a personalized and secure experi When creating a migration file, you need to use the following command: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan migrator:create {migration-name} ``` @@ -50,7 +50,7 @@ This command creates a migration file in Micropower Manager's core migration fil After creating the migration file, you can shift it to other company databases using the following command: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan migrator:copy ``` @@ -59,13 +59,13 @@ This command syncs the migration files in the core migration folder for other co To migrate the database, use the following command: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan migrator:migrate ``` Alternatively, you can migrate the database for a specific company using the following command: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php shard:migrate {company_id} {--force} ``` diff --git a/docs/development/plugins.md b/docs/development/plugins.md index 51befb64..7e737b02 100644 --- a/docs/development/plugins.md +++ b/docs/development/plugins.md @@ -22,7 +22,7 @@ In the backend section, you'll find instructions on how to create a plugin. We have a custom plugin creator command that generates a template. Use the following command to create a new plugin: ```bash -docker exec -it laravel-dev bash +docker exec -it backend-dev bash php artisan micropowermanager:new-package {package-name} ``` diff --git a/docs/installation/deploy-production.md b/docs/installation/deploy-production.md new file mode 100644 index 00000000..480855d2 --- /dev/null +++ b/docs/installation/deploy-production.md @@ -0,0 +1,22 @@ +--- +order: 4 +--- + +# Deploy for Production + +The MicroPowerManager is distributed as pre-compile Docker images via [DockerHub](https://hub.docker.com/). + +For running a self-hosted version of MicroPowerManager multiple options exists as explained in the following. + +## Docker Compose + +A working environment running with production containers can be achieved by running: + +```sh +docker compose -f docker-compose-prod.yml up +``` + +## Kubernetes + +> [!NOTE] +> Comming soon... diff --git a/docs/installation/deployproduction.md b/docs/installation/deployproduction.md deleted file mode 100644 index 2963a125..00000000 --- a/docs/installation/deployproduction.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -order: 4 ---- - -# Deploy for Production - -> [!WARNING] -> This sites describes a potentially deprecated feature of MPM - -The production mode will automatically install **Let\'s Encrypt SSL -certificates**. Therefore you need firstly register a domain. - -When you have your domain, the first thing to do is editing `app.conf` -and `db.conf` files under -`NginxProxy/conf.p`. - -Afer that, paste `chmod +x ./install-production.sh` to make the file -executable and run it via `./install-production.sh`. This will guide you -through the installation and finally, it will start the services. From 96263095f61bc15425a90a591694a693e6fccac3 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Tue, 22 Oct 2024 18:18:53 +0200 Subject: [PATCH 2/2] Add `k8s` instructions --- docs/installation/deploy-production.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/installation/deploy-production.md b/docs/installation/deploy-production.md index 480855d2..4c130483 100644 --- a/docs/installation/deploy-production.md +++ b/docs/installation/deploy-production.md @@ -19,4 +19,6 @@ docker compose -f docker-compose-prod.yml up ## Kubernetes > [!NOTE] -> Comming soon... +> This section will be expanded in the future. + +A working sample of Kubernetes manifest files that are used to run the [MPM Demo Version](https://demo.micropowermanager.io/#/login) can be found in the `k8s` directory of this repository.