ulsdevteam / ccvgd-integral Goto Github PK
View Code? Open in Web Editor NEWDocker based deployment of the CCVGD web interface
Docker based deployment of the CCVGD web interface
The PRODUCTION_FLAG
variable in the .env
file should trigger ccvgd-frontend
to configure the container as production, either by swapping the environment.prod.ts
file for the environment.ts
file, or rebuilding with ng build --prod
.
As is, ccvgd-frontend
is always running in dev mode, as reported by the web browser console:
Angular is running in development mode. Call enableProdMode() to enable production mode.
Migrated from: https://github.com/Caligula1022/ccvg_integral/issues/4
I have forked this repository from https://github.com/Caligula1022/ccvg_integral/ so that the ULS can maintain this repo as we move it into production.
Please archive or delete the original repository in favor of the ulsdevteam fork. You may want to delete the repo and then fork it from ulsdevteam for your own convenience in development.
Migrated from: https://github.com/Caligula1022/ccvg_integral/issues/2
To make the Docker deployment entirely self contained, good practice is to use a container which publicly presents ports 80 and 443.
Please add a traefik container to expose ports 80 and 443, mapping to the frontend's web port.
The selection of an SSL certificate for port 443 should be part of the environment configuration.
From a production deployment, the only exposed ports and names should be that of the frontend (angular app) on 80 and 443, and the same for the backend API. We'll want to remove the other ports and names for production purposes. A common way to do this is to maintain a docker compose file dedicated to development and a compose file which is dedicated to production.
We will also want to migrate the traefik hostname to be an environment variable:
ccvgd-integral/docker-compose.yml
Line 43 in dae9c29
This will allow you to configure the name as angular.docker.localhost
for your development purposes, but for a production configuration we would add an actual DNS name in place as the environment variable.
Finally, the current traefik configuration does bring up the site on port 80 (HTTP) but does not map port 443 (HTTPS) to the angular container. You can leave the SSL certificate as the self-signed certificate for your development purposes; good practice would be to also allow traefik to mount an SSL certificate installed on the docker host via an environment variable.
The default Dockerfile for ccvgd-backend uses the built-in Python development server and is unsuitable for production use:
https://github.com/ulsdevteam/ccvgd-backend/blob/a229232a4dbb6d178ac76144a134a423cb5e28a5/Dockerfile#L13
Logs:
* Serving Flask app "manager" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
We should instead use a WSGI build of Apache (or similar) in a production Dockerfile. That Dockerfile should be referenced in this docker compose when the PRODUCTION environment variable is set.
It is more complicated than we need here, but see an example of such here:
RockefellerArchiveCenter/request_broker#245
Migrated from: https://github.com/Caligula1022/ccvg_integral/issues/3
We will also want to redact the existing use of hardcoded credentials (specifically, the database credentials) to allow these credentials to be managed via an untracked environment file.
These credentials should be pass from this repo's docker-compose to the backend's docker build, so that changing the values in the environment for docker-compose here is inherited by the backend build, and credentials do not need to be reiterated in that repo.
As a best practice, you should:
This way, there is no risk of the user accidentally committing their secrets to the git repository.
Currently, when launched via Docker Compose, the frontend still points to ngrok.luozm.me:8395
as the backend rather than pointing to the ccvg
container.
This appears to be hardcoded in ccvgd-frontend here:
https://github.com/ulsdevteam/ccvgd-frontend/blob/be07f3ddaa9b0a1e33d64edb3eea506f36554640/src/environments/environment.prod.ts#L4
and
https://github.com/ulsdevteam/ccvgd-frontend/blob/be07f3ddaa9b0a1e33d64edb3eea506f36554640/src/environments/environment.ts#L7
Instead, these configurations should receive the desired endpoint name as an environment variable, which can be set when building the ccvgd-frontend repo directly, but can also be passed in from docker compose by the integral repo.
With an initial build of the ccvgd-backend container, nothing automatically triggers a data load via the python scripts.
This should either be automated in the Dockerfile / docker-compose, or should be documented in the READMEs to indicate how do do the initial data load in a containerized environment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.