Giter Site home page Giter Site logo

ccvgd-integral's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ccvgd-integral's Issues

Production flag should trigger production configuration of frontend Angular

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.

Use traefik to expose the web frontend

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:

- "traefik.http.routers.angular.rule=Host(`angular.docker.localhost`)"

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.

Use WSGI server for API

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

Redact credentials

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:

  • Provide a copy of a sample environment file which is committed to the repo
  • Add the actual environment file referenced in the docker compose file to the .gitignore
  • Provide instructions in the README for the user to copy the sample file to the actual filename, modifying the values to their own settings.

This way, there is no risk of the user accidentally committing their secrets to the git repository.

Pass name of backend to angular via environment variable

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.

Clean build of backend doesn't automatically load the data

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.