CodeNewbie Community 🌱

Sharon428931
Sharon428931

Posted on

How to Migrate SafeLine WAF in Minutes (Step-by-Step Guide)

Need to move your SafeLine to a new server without losing any data? Here's a quick and reliable way to migrate your entire setup — in just a few simple steps.

What You’ll Do

We’ll copy all SafeLine WAF data from your current environment (let's call it Env1) to a new environment (Env2) that will take over.


Step 1: Prepare Both Environments

  • Make sure both Env1 and Env2 are running the same version of SafeLine.
  • If Env1 is outdated, upgrade it before migration.
  • Ensure SafeLine is properly installed in both environments.

Image description

Tip: You can check the SafeLine version by logging into the admin panel or inspecting the installation directory.


Step 2: Stop All SafeLine Containers

Stop the SafeLine containers on both environments.

# Run this in the SafeLine install directory
docker compose down
Enter fullscreen mode Exit fullscreen mode

Do this on both Env1 and Env2.

Env1
Image description

Env2
Image description


Step 3: Copy the safeline Data Directory

From Env1, compress the entire safeline directory:

apt install zip     # Install zip if it's not available
cd /data
zip -r safeline.zip safeline
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Then transfer the zip file to Env2 using scp:

scp safeline.zip root@<Env2-IP>:/data
Enter fullscreen mode Exit fullscreen mode

Image description

On Env2, unzip and replace the existing safeline directory:

cd /data
rm -rf safeline               # Remove old data
unzip safeline.zip            # Extract the migrated data
Enter fullscreen mode Exit fullscreen mode

Image description


Step 4: Start SafeLine on the New Server

On Env2, navigate into the SafeLine directory and restart the WAF:

cd /data/safeline
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Image description

Once it's running, log in to confirm:

✅ All your original configurations, rules, and logs should now be present on Env2.


Final Check

Test a few features to make sure everything works as expected.

If all looks good — migration is done!


Why This Works

This method is fast, doesn't require downtime beyond a restart, and keeps your full configuration intact. Perfect for server upgrades, environment cloning, or disaster recovery setups.


Learn More

Top comments (0)