visulate / visulate-ora2pg

Docker image and single page web application for Ora2Pg
Apache License 2.0
30 stars 10 forks source link

Publish a version of Visulate-Ora2Pg on Google Cloud Marketplace #81

Closed pgoldtho closed 2 years ago

pgoldtho commented 2 years ago

Product should be packaged as a virtual machine image. Follow Cloud Marketplace instructions

The image should include versions of Ora2Pg + Visulate for Oracle. Container images for it are in the Google Container Repo - gcr.io/visulate-llc-public/visulate-for-oracle

The v4oracle README has instructions for running in a docker container. These haven't been tested for a while and may need to be adapted.

  1. Angular stores environment variables like the API server location in a file that gets copied into the app bundle at build time. The file contents are concatenated with other sources into a single minified file. The file checked into source control relies on a load balancer to resolve API calls. It needs to be edited if a load balancer is not being used. Review apiBase value in visulate-for-oracle/ui/src/environments/environment.prod.ts and edit to match the API server deployment value. For example, if you plan to deploy the API server on a VM called my-api-server.com the file would look like this:

    export const environment = {
    production: true,
    apiBase: 'http://my-api-server.com:3000/api',
    findObjectBase: 'http://my-api-server.com:3000/find',
    ddlGenBase: 'http://my-api-server.com:3000/ddl'
    };
  2. The API server rejects cross origin requests from URLs that have not been whitelisted. Edit visulate-for-oracle/api-server/config/http-server.js to specify the origin server where the UI will be running. For example if the UI will be served from port 8080 of my-ui-server.com:

    module.exports = {
    port: process.env.HTTP_PORT || 3000 ,
    corsOriginWhitelist: process.env.CORS_ORIGIN_WHITELIST ||['http://my-api-server.com:8080'],
    logFileLocation: process.env.PWD + '/logs'
    };
  3. Pull the docker images:

    docker pull gcr.io/visulate-llc-public/visulate-for-oracle:1.1
    docker pull gcr.io/visulate-llc-public/visulate-for-oracle/ui:1.1
    docker pull gcr.io/visulate-llc-public/visulate-for-oracle/sql:1.1

    Docker pull of UI won't work. Need to figure workaround to custom build requirement

  4. Deploy the images:

    docker run -d -p 3000:3000/tcp gcr.io/visulate-llc-public/visulate-for-oracle:1.1
    docker run -d -p 80:80/tcp gcr.io/visulate-llc-public/visulate-for-oracle/ui:1.1
  5. (Optional) bind the log file directories to a persistent volume (e.g /var/log/some-directory)

    
    docker run -d -p 3000:3000/tcp \
    -v /var/log/visulate-server:/visulate-server/logs \
    gcr.io/visulate-llc-public/visulate-for-oracle:1.1

docker run --rm -d -p 80:80/tcp \ -v /var/log/visulate-client:/var/log/nginx \ gcr.io/visulate-llc-public/visulate-for-oracle/ui:1.1

6. (Optional) Copy the `visulate-for-oracle/config` files to a staging directory before starting the server. This will allow you to edit the database registration file and CORS whitelist without rebuilding the image. Example:

docker run -d -p 3000:3000/tcp \ -v /home/pgoldtho/config:/visulate-server/config \ -v /var/log/visulate-server:/visulate-server/logs \ gcr.io/visulate-llc-public/visulate-for-oracle:1.1

pgoldtho commented 2 years ago

There are 2 issues that need to be solved when packaging the installation:

  1. The URL for API calls is set when RUN $(npm bin)/ng build --prod is called during the docker build. Its value is embedded in a minified file that cannot be updated at runtime.
  2. The CORS origin for UI API calls needs to be set in Express when the API server is started if the UI and API servers are exposed on different ports.

The K8S deployment uses a load balancer to workaround these issues. The API and UI servers are bound to the same namespace

pgoldtho commented 2 years ago

Need to decide whether to deploy as a containerized application or OS native installation

https://cloud.google.com/community/tutorials/migrate-oracle-postgres-using-ora2pg

pgoldtho commented 2 years ago

Google changed the terms and conditions for publishing images to Cloud Marketplace. Publishing is no longer possible