In case you run into any issues during the migration, please contact our team over embedded chat icon within your instance or at [email protected]
When migrating an existing self-hosted PentestPad instance to a new hostname, certain URLs within the application need to be updated to reflect the change. This includes URLs for uploaded images, as PentestPad supports full URL paths for images, including those copy-pasted from external websites. To ensure that everything works correctly after the hostname change, follow these steps.
Step 1: Update Environment Variables
You need to update the following properties in the .env
file to match your new hostname:
APP_URL: This is the base URL for your application.
REVERB_HOST: This is the hostname used by PentestPad for notifications and other host-specific functionality.
Ensure that both these values reflect the new hostname.
Step 2: Restart PentestPad Docker Containers
After updating the .env
file, you must restart your PentestPad Docker containers for the changes to take effect:
docker stop pentestpad_redis pentestpad-docker-gotenberg-1 pentestpad_app pentestpad_postgres
docker-compose -f docker-compose.yml up
Step 3: Run the Migration Script
To update the old hostname to the new one throughout your data, you can use the provided migration command. This command scans the database for references to the old hostname, specifically within image URLs and notification links, and replaces them with the new hostname.
First, you need to enter the command prompt inside the pentestpad_app container:
docker exec -ti 'pentestpad_app' /bin/bash
The following command demonstrates how to run the migration script in dry-run mode:
pp migrate:images --old-hostname=localhost --new-hostname=localhost1 --dry-run
The --dry-run
option is highly recommended for the first run, as it allows you to preview the changes without making any actual modifications. The output will show the differences between the old and new URLs, highlighting what would be changed.
Step 4: Apply the Changes
Once you've reviewed the output of the dry-run and are confident the new hostname is correct, rerun the command without the --dry-run
flag to apply the changes:
pp migrate:images --old-hostname=localhost --new-hostname=localhost1
This will permanently replace the old hostname with the new one in all relevant fields, ensuring your instance is fully migrated.