ewerton-silva00 opened a new pull request, #14746:
URL: https://github.com/apache/cloudstack/pull/14746

   ### Description
   
   This PR adds `tools/docker/local/`, a Docker Compose environment that builds 
CloudStack from the working tree and runs it with the simulator hypervisor, for 
local testing during development. It needs only Docker and mkcert on the host: 
no Java, Maven, MySQL or Node.
   
   It differs from `tools/docker/Dockerfile` (the `apache/cloudstack-simulator` 
image) in that each component runs in its own container, the database lives in 
a volume instead of inside the image, and everything is served over HTTPS on a 
hostname chosen by the developer.
   
   - Services: `nginx` (TLS termination and reverse proxy), `ui` (static 
production build), `management` (`mvn jetty:run -Dsimulator`) and `mysql` (8.4).
   - One-shot services: `db-init` runs `deploydb` and `deploydb-simulator`; 
`datacenter` deploys `setup/dev/advanced.cfg` with Marvin. Both are skipped 
when the work is already done, because `deploydb` drops the databases.
   - TLS ends at nginx with a wildcard certificate generated by mkcert 
(`generate-certs.sh <domain>`). The developer only adds one line to 
`/etc/hosts`.
   - Only ports 80 and 443 are published, on `127.0.0.1`. The integration API 
(8096, unauthenticated) and MySQL are reachable only inside the Docker networks.
   - The management and UI images have separate Dockerfiles and build contexts, 
so a UI change does not trigger the Maven build. The Maven repository and the 
npm and webpack caches are kept in BuildKit cache mounts between builds.
   
   No existing file is changed. Usage, architecture and troubleshooting are in 
`tools/docker/local/README.md`.
   
   Open point for reviewers: `tools/docker/docker-compose.yml` (MariaDB 10.0 
only) is left untouched. I can remove or replace it in this PR if preferred.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   ### How Has This Been Tested?
   
   Environment: Ubuntu, Docker Compose 5.7.0, domain `cloud.test`.
   
   Full stack, on `main` at 2737087a80, with an earlier revision of these files 
(single Dockerfile, no Maven cache mount):
   
   - Images build; `db-init` creates the `cloud`, `cloud_usage` and `simulator` 
schemas; `management` becomes healthy.
   - `datacenter` deploys the `Sandbox-simulator` zone with 4 simulated hosts; 
system VMs reach `Running`.
   - HTTP redirects to HTTPS; the certificate is trusted without `-k`; the UI 
returns 200; login works through the API and through the browser.
   - A network and an instance were created and the instance reached `Running`.
   - A second `up -d` skips `db-init` and `datacenter`.
   - `cmk` works against `https://cloudstack.cloud.test/client/api` with 
certificate verification on.
   
   Revision in this PR (separate UI Dockerfile, reduced management build 
context, Maven cache mount):
   
   - Both images build. The Maven build passes with only `ui/index.html` in the 
context, and `index.html` is present in the webapp output.
   - Management image: the Maven repository is at `~/.m2/repository` and an 
offline (`mvn -o`) compile of `cloud-client-ui` succeeds.
   - Maven step timing on one machine: 1440 s with an empty cache, 891 s on a 
rebuild with the cache filled (0 artifacts downloaded).
   - `docker compose config`, the repository pre-commit hooks and 
`apache-rat-plugin:0.18:check` pass on these files.
   - The full stack was not started again with the images of this final 
revision.
   
   #### How did you try to break this feature and the system with this change?
   
   - Ran `up -d` repeatedly to confirm the guards keep `deploydb` from dropping 
an existing database and Marvin from deploying a second zone.
   - Confirmed that only nginx publishes host ports and that 8096 is not 
reachable from the host.
   - Ran `generate-certs.sh` without a domain and with a dotless domain; both 
are rejected.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to