Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Most Many customers are installing install FlexDeploy in Test and Production environmentenvironments. The purpose of the Test environment is to try various patches or beta capabilities of plugins, or even trying some complex workflow workflows and/or custom plugins. The FlexDeploy test environment may be restricted for use to by select members of the team. It is good idea to periodically (mostly when applying major FlexDeploy upgrade/patch) clone FlexDeploy Production configuration/execution data to FlexDeploy Test environment, which will allow you to easily validate new FlexDeploy upgrade/patchupgrades and patches.

These steps are provided as guidelines and extreme care must be taken to not disrupt your production environments.

Info

This process should only be followed to perform a clone of FlexDeploy Production FlexDeploy to the Test environment. Make sure that Test environment is restricted for use by very few members of your team to avoid confusion, as the purpose of the Test environment is only for validating FlexDeploy itself and is not used for actual build/deploy activities. You will do some build/deploy activities, but that is strictly for validation purposes.

Code Block
languagesql
titleExport data from source FlexDeploy database
expdp system directory=DATA_PUMP_DIR dumpfile=fd_bkup.dmp schemas=FD,FF,FD_ADMIN

This process is only applied for 4.0, 4.0.x version of FlexDeploy. The Source and target version of FlexDeploy must be same.

  • Export data from Production FlexDeploy database. You will be prompted to enter password for system user.
    • This step will create fd_bkup.dmp file with all details from FD,FF and FD_ADMIN schemas. File should be in data pump directory, for example - C:\oraclexe\app\oracle\admin\XE\dpdump.
    • If your database is only used for FlexDeploy application, you may be able to perform backup and recovery operations using other Database tools.

, although you can clone and then upgrade to validate a FlexDeploy Release.

Make sure Target FlexDeploy is Ready

  • Make sure target environment is ready.

  • Keep target FlexDeploy down for this process.

Export Import Database & Copy Artifacts, Plugins, and InfluxDB data

Info

FlexDeploy uses Database tables to track all activities & configurations, and Artifact Repository folder to store build artifacts. So you must copy both items to target for successful clone.

  • Export data from Production FlexDeploy database.

    • You should export FD,FF and FD_ADMIN.

  • Take backup of artifact repository folder using tar/zip commands on Production FlexDeploy

    database.

    server. (Optional if you won’t be deploying any old artifacts, they are not needed) For example,

    • cd /flexdeploy/artifacts

    • tar -czvf /app/backup/flexdeploy_artifacts_prod.tar.gz *

  • Take backup of plugins folder using tar/zip commands on Production FlexDeploy server. Plugins folder is under server working directory. You can determine working folder by looking at flexagon.fd.application.root system property on server command line. For example,

    • cd /flexdeploy/application/plugins

    • tar -czvf /app/backup/flexdeploy_plugins.tar.gz *

  • Take backup of vsm folder (InfluxDB)

    • cd /flexdeploy/application/vsm

    • tar -czvf /app/backup/flexdeploy_vsm_prod.tar.gz *

  • Make sure Test FlexDeploy is now stopped for import process.

  • Copy fd_bkup.dmp file on to Test FlexDeploy database server in to data pump directory, for example - C:\oraclexe\app\oracle\admin\XE\dpdump.
  • Import data in to target FlexDeploy database. Make sure to run this on Test environment only.

    • You will be prompted to enter password for system user. You must delete FD,FF,FD_ADMIN users from Test environment before starting import process. If necessary take backup of Test FlexDeploy database prior to starting this process.

      Run the following sql command for the appropriate database that will generate many drop table, view and procedure statements as output.  Once this sql is complete, copy all of the output and execute that against the test database.  This method will drop all of the data but maintain table spaces, quotas and passwords for the given schemas.  This will also maintain the same password that is stored in the context.xml file.

      Oracle DB: Drop tables, views and procedures without dropping user

      Code Block
      languagesql
      select 'drop table ' || owner ||'.' || table_name || ' cascade constraints PURGE;' from dba_tables where owner in ('FD','FD_ADMIN','FF')
      union all
      select 'drop view ' || owner || '.' || view_name || ';' from dba_views where owner in ('FD','FD_ADMIN','FF')
      union all
      select 'drop procedure ' || owner || '.' || object_name || ';' from dba_objects where owner in ('FD','FD_ADMIN','FF') and object_type = 'PROCEDURE';

PostgreSQL DB: Drop tables, views and procedures without dropping user

Code Block
languagesql
select 'drop table ' || table_schema ||'.' || table_name || ' cascade ;' from information_schema.tables where upper(table_schema) in ('FD','FD_ADMIN','FF') and table_type = 'BASE TABLE'
union all
select 'drop view ' || table_schema ||'.' || table_name || ' cascade ;' from information_schema.tables where upper(table_schema) in ('FD','FD_ADMIN','FF') and table_type = 'VIEW''
  • Make sure there are no errors in import process. If there are errors, make corrections appropriately and restart import process.

Code Block
languagesql
titleImport data in to target FlexDeploy database
impdp system directory=DATA_PUMP_DIR dumpfile=fd_bkup.dmp schemas=FD,FF,FD_ADMIN
  • At this point Test FlexDeploy database should be copy of Production database.
  • At this point, the Test FlexDeploy database should be copy of Production database.

  • Copy artifacts zip file to Test FlexDeploy server and extract it in the artifact repository folder. You can determine Artifact Repository folder by looking at flexagon.fd.repository.root system property on server command line. Make sure to run this on Test environment only.

    • cd /flexdeploy/artifacts

    • tar -czvf /app/backup/flexdeploy_artifacts_test.tar.gz *

    • rm -rf *

    • tar -xzvf /app/backup/flexdeploy_artifacts_prod.tar.gz

  • Now FlexDeploy artifact repository is also copied.

  • Copy plugins tar/zip file to Test FlexDeploy server and extract it in the plugins directory under working directory. You can determine working folder by looking at flexagon.fd.application.root system property on server command line.

    • cd /flexdeploy/application/plugins

    • rm -rf ./*

    • tar -xzvf /app/backup/flexdeploy_plugins.tar.gz

  • Now FlexDeploy plugins are also copied.

Copy Influx DB

To sync your influx db between prod and test, follow these steps:

In TEST (Target)

  1. cd /flexdeploy/application/vsm

  2. tar -czvf /app/backup/flexdeploy_vsm_test.tar.gz *

  3. rm -rf ./*

  4. tar -xzvf /app/backup/flexdeploy_vsm_prod.tar.gz

  • Now FlexDeploy InfluxDB data is also copied.

Update Target Database as Necessary

  • Now make various updates to make sure to limit access to the FlexDeploy Test environment and limit what FlexDeploy Test can do against various endpoints. You can customize any of these steps as per your needs. Make sure to run this on Test environment only.

    Now you can
    • Disable external realm and users, so access to FlexDeploy is very limited. Update SQL as appropriate for your setup. For example,

      Inactivate Security Setup to restrict access

      Code Block
      languagesql
      update fdFD.fdFD_realmREALM set is_active='N';
      update fdFD.fdFD_userUSER set is_active='N' where local_user='N'; -- update as appropriate
      commit;


    • Disable all endpoints, so Test FlexDeploy can not run any executions until Administrator explicitly enables some endpoints. Update base directory to not conflict in case when one of these Endpoints is enabled in Test FlexDeploy. For example,

      Update Endpoints for Test environment

      Code Block
      languagesql
      update fdFD.endpointENDPOINT set is_active='N' where connection_type='SSH';
      update FD.ENDPOINT set base_directory = base_directory || 'fdtest';
      commit;


    • If you have workflows that perform tags on Source Control Systems, make sure to update the workflows before running builds, so you do not conflict with tags created by Production FlexDeploy. You can do this by simply running this SQL also. Adjust according to your requirements.

      Update version syntax

      Code Block
      languagesql
      update FD.PROJECT_STREAM set version_syntax = version_syntax || ' + ".fdtest"';
      commit;


    • Delete all Continuous Integration triggers.

      Delete CI Triggers

      Code Block
      languagesql
      delete from FD.PROJECT_TRIGGER_CONFIG;
      delete from FD.PROJECT_TRIGGER;
      commit;


    • Disable production environment. so Test FlexDeploy can not run any executions even for testing against Production environment. For example,

      Disable Production environment

      Code Block
      languagesql
      update fdFD.environmentENVIRONMENT set is_active='N' where environment_code='PROD'; -- update as appropriate
      commit;
  • Copy artifacts zip file to Test FlexDeploy server and extract it in artifact repository folder. Make sure to run this on Test environment only.
    • cd /flexdeploy/artifacts
    • tar -czvf /app/backup/flexdeploy_artifacts_test.tar.gz *
    • rm -rf *
    • tar -xzvf /app/backup/flexdeploy_artifacts_prod.tar.gz
  • Now FlexDeploy artifact repository is also copied.
    • Consider if you should change or remove any Outgoing webhooks that you have setup.

  • Now start Test FlexDeploy and validate it.

    • You can make necessary adjustments to Realm, User, Groups to validate setup and perform tests as necessary. This is necessary as we

    had
    • disabled user and realms in previous steps.

    If you have workflows that perform tags on Source Control Systems, make sure to update it before running builds, so you do not conflict with tags created by Production
    • You can activate specific Endpoints that you want to be included in Test environment validations.

    • Update System Settings as appropriate.

      • Change FD_SERVER_BASE_URL.

      • Change SMTP_FROM_ADDRESS. This will make sure that emails are coming from different address for Test FlexDeploy.