Whitespots Wiki
Login
  • Home
  • 🔦Auditor
    • 📥Deployment
      • Installation
      • Update
    • 🎯Features
      • 🚀Run Audit
        • AppSec Portal cooperation
        • Direct use of Auditor
      • ⚙️Settings
        • AppSec Portal cooperation
        • Direct use of the Auditor
          • Cleaner
          • Docker Credentials
          • Workers
          • Personalization
        • Jobs
          • Technical Jobs
          • Scanner Jobs
          • Job configuration
    • 🗒️Release notes
    • 🩼Maintenance
  • 🖥️AppSec Portal
    • 📥Deployment
      • License obtaining
      • Installation
      • Get started with the AppSec Portal
        • Сonfiguration options
      • Update
      • Accessing the AppSec Portal API Endpoints
      • Database transfer guide
      • FAQ: typical errors in deployment process
    • ⚙️Post install Configuration
    • 🎯Features
      • 🎣Auto Validator
        • Rule creation
        • Rules view
      • Deduplicator
        • ⚙️Basic deduplicator rules
        • ⚙️Advance Deduplicator rules
      • 🔦Vulnerability discovery
        • ✔️Audits
        • ⚙️Auditor settings
          • Auditor config
          • Sequences
            • Sequences creating
            • Sequences setting
        • 🔎Run audit
          • Run Audit Manually
          • Scheduled Audit Run
      • 🎯Recommendations
      • Security Metrics
        • Severity Statistics Dashboard
        • WRT (Weighted Risk Trend)
        • How to work with WRT (for team leads)
        • Metrics settings
          • SLA
        • CVSS
          • CVSS Rule
      • Custom Reports
      • 📈Active tasks
      • 🧺Asset management
        • How to import repositories from version control
        • Default product
        • Adding a product asset
        • Asset Transfer Between Products
      • 🕷️Findings view
        • All findings view
        • Grouped findings as a result of
        • Grouping of findings into groups
        • Available bulk actions
        • Viewing specific findings
        • Usable filters and easy sorting
      • 📊Jira
        • Jira integration configuration
        • Setting up Jira webhook
      • 👾Move from DefectDojo
      • 🔬Scanners
        • 🔌Importing reports from scanners to AppSec Portal
          • 🖐️Manual Import using Report File
          • Importing reports via Terminal using a Report File
          • Importing reports via Lambda Function using a Report File
        • Scanner description
          • Code Scanners
            • Bandit
            • Brakeman
            • Checkov
            • CodeQL
            • ESLint
            • Gemnasium
            • Gosec
            • Hadolint
            • KICS
            • PHPCodeSniffer
            • Retire.js
            • Semgrep
            • SpotBugs
            • Terrascan
          • Secret Scanners
            • Gitleaks
            • Trufflehog3
          • Image and code dependency Scanners
            • Trivy
            • Trivy vulners.com plugin
            • Snyk
          • Web Scanners
            • Arachni Scan
            • Acunetix
            • Burp Enterprise Scan
            • OWASP Zap
          • Infrastructure Scanners
            • AWS Security Hub Scan
              • Importing reports via AWS Lambda Function within AWS Security Hub
            • Prowler
            • Subfinder
            • Nessus
            • Nuclei
          • Mobile Security Scanners
            • MobSFScan
          • Other Scanners
            • Dependency-Track
            • Whitespots Portal
      • 📦Working with products
        • Product Creation
        • Product options
        • Finding groups
        • Risk assessment
        • Product Asset
    • 🛠️General Portal settings
      • Version Control Integration
      • Profile
      • Managing user roles and access control
        • User management
        • Creating and editing roles
      • SSO settings
        • GitLab SSO
        • Microsoft SSO
        • Okta SSO
      • Scanner settings
        • Auto Closer
        • Group findings by
        • Custom Jira description
        • Custom severity mapping
        • Auditor Job Config
      • Notification settings
        • Integration
        • Criteria & Schedule
        • Status change notification
        • Manage notification schedule
      • Repository Link Configs
      • CWE list
      • Tag screen
    • 🗒️Release notes
  • To be described
    • Documentation backlog
Powered by GitBook
On this page
  • Step 1: Preparing the New Host
  • Step 2: Create a Database Dump on the Current Host
  • Step 3: Transfer the Database Dump to the New Host
  • Step 4: Restore the Database on the New Host

Was this helpful?

  1. AppSec Portal
  2. Deployment

Database transfer guide

By following the steps outlined in this guide, you can safely and effectively transfer the AppSec Portal's database to a new host

PreviousAccessing the AppSec Portal API EndpointsNextFAQ: typical errors in deployment process

Last updated 8 months ago

Was this helpful?

This guide outlines the steps to transfer a database using Docker and various commands. The process involves creating a database dump, transferring it to a remote server, and restoring it in a new container. If you have changed the default values for DB_USERNAME and DB_NAME, make sure to use your custom values in the commands provided below. Otherwise, the values of postgres should be used for both.

Step 1: Preparing the New Host

Before transferring the database to the new host, ensure that the AppSec Portal is and properly set up on new host. Follow the steps below to prepare the new host for the database migration:

  1. Ensure that the AppSec Portal configuration is correctly set up on the new host, including database connection parameters. If the DB_USERNAME and DB_NAME was changed during the setup, make sure to use the custom values in the configuration.

  2. Drop the Existing Database Inside the container, execute the following command to drop the existing database:

docker exec -i appsec-portal_postgres_1 dropdb -U <DB_USERNAME> <DB_NAME>
  1. Create a New Database. While still inside the container, create a new database with the same name using the following command:

docker exec -i appsec-portal_postgres_1 createdb -U <DB_USERNAME> <DB_NAME>

Step 2: Create a Database Dump on the Current Host

  1. Open a terminal or command prompt. Navigate to the directory where you want to create the database dump file.

cd /path/to/destination_directory
  1. Execute the following command to create a database dump from the current host:

docker exec -i appsec-portal_postgres_1 pg_dump -U <DB_USERNAME> <DB_NAME> > pg_dump

The pg_dump file will be created in the previously specified directory.

Step 3: Transfer the Database Dump to the New Host

Copy the database dump file (pg_dump) to the new host using a secure method, such as SCP (Secure Copy) or any other file transfer mechanism you prefer.

Step 4: Restore the Database on the New Host

  1. Once the database dump file is on the new host, open a terminal or command prompt on the new host. Navigate to the directory where the database dump file is located.

cd /path/to/source_directory
  1. Copy the database dump file into the appsec-portal_postgres_1 container on the new host:

docker cp pg_dump appsec-portal_postgres_1:/pg_dump
  1. Restore the database from the dump on the new host inside the container:

docker exec -it appsec-portal_postgres_1 psql -U <DB_USERNAME> -d <DB_NAME> -f /pg_dump

Congratulations! You have successfully transferred the database.

You can also use this guide to restore the database from a backup by skipping steps 2 and 3.

🖥️
📥
installed