Skip to main content

Exporting Website for 3rd Party Host

Database Exporting

Export the database with content, excluding system_event_logs and system_request_logs.

danger

After export open the sql file and check there are no postmark or other settings that are saved in system_settings that could expose any api keys or passwords.

S3 and assets

If the assets are stored in S3 then you will need to export them to your local machine to zip up (if the assets are local you can skip this step as they will be zipped with the site files next, but this is unlikely).

AWS Cli

To export S3 files you will need the AWS CLI. If this already setup on your machine you can skip to the S3 export command.

First you will need the AWS Cli installed on your machine. If it is not installed, see here.

Then run, aws configure, it will ask you for your IAM keys.

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: eu-west-1
Default output format [None]: json

AWS S3

aws s3 cp s3://<BUCKET-NAME> ~/Downloads/s3-assets --recursive

Then zip these up in a file named s3-assets.zip.

Website files

  1. SSH in to the lightsail for the website
  2. SSH in to app container
docker exec -it ubuntu-app-1 sh

or for old sites:

docker exec -it ubuntu_app_1 sh
  1. Zip all the files up (ensuring you are in the /var/www/html directory
zip -r website.zip ./
  1. Exit from the docker container and copy bundled file outside the container
docker cp ubuntu-app-1:/var/www/html/website.zip ./

or for old sites:

docker cp ubuntu_app_1:/var/www/html/website.zip ./
  1. On your local machine secure copy the bundled file locally
scp ubuntu@<LIGHTSAIL-PUBLIC-IP>:website.zip ~/Downloads/
danger

You may need to add the lightsail key to your ssh session

ssh-add <path-to-key-file>.pem

.env

The .env file will need to be inside the website.zip for the client to use on their preferred hosting but all passwords and api keys need to be removed first.

e.g. Database, Postmark, Google Maps, AWS IAM Keys etc.

The following should cleared ("DB_HOST= "):

  • DB_HOST
  • DB_DATABASE
  • DB_USERNAME
  • DB_PASSWORD
  • MAIL_HOST
  • MAIL_USERNAME
  • MAIL_PASSWORD
  • SENTRY_DSN
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION
  • S3_BUCKET
  • JUMP_RECAPTCHA_PUBLIC_KEY
  • JUMP_RECAPTCHA_PRIVATE_KEY

The follow should be changed:

  • FILESYSTEM=local

Finally

Then Once all the above is done, create a WeTransfer link with the following in:

  • Database SQL file
  • website.zip
  • s3-assets.zip

The wetransfer link will need to be given to the client contact along with the instructions below.

Instructions for the Client

danger

If the client is not using their own Google account for analytics or tag manager (a.k.a it is created by us). Then remove the reference to step 4 for that client (and adjust the other numbers accordingly)

The website requires the following from the webserver:

  • PHP 7.1+, 8.1+ or 8.3+ (depending on version of PHP specified in 'composer.json')
  • PHP FPM 7 or 8 depending on version of PHP specified in 'composer.json')
  • NGINX (Apache can be configured but is out of scope of this document)

The website ZIP will need to be unzipped to the webserver and then the s3-assets zip can be unzipped into the /storage/app directory. This should give you /storage/app/media and /storage/app/uploads.

Configuring the Web Application

  1. Change Database credentials in .env file:

    • Set DB_HOST, DB_DATABASE, DB_USERNAME and DB_PASSWORD to match your database details
  2. To get the website sending Emails you'll need to update the mail settings in .env file

  3. Setup Recpatcha to prevent spam submissions on website forms

    • Create a Google account if you don't already have one and head to https://www.google.com/recaptcha
    • Create a v2 API which will generate a Public and Private key
    • Add these to the .env file under JUMP_RECAPTCHA_PUBLIC_KEY and JUMP_RECAPTCHA_PRIVATE_KEY
  4. Google Analytics & Google Tag Manager

    • It looks like you're the account owner for these accounts so you can leave the current JUMP_ANALYTICS_TAG_MANAGER_ID value in the .env file
    • If you wanted to create a new Tag Manager account, it is this value you would change
    • Remember to remove JUMP from the Analytics and Tag Manager access
  5. Set up Google Maps API Key

  6. Force security

    • In the JUMP infrastructure, the website was secured by an SSL certificate on the AWS CloudFront Distribution and all traffic was directed through this. The website origin was then served over HTTP.
    • This would either need recreating on your end, or alternatively an SSL certificate could be installed locally and used (this would require an update to the nginx.conf)
    • Once an SSL certificate has been setup, you can enable redirection to HTTPS by setting JUMP_HTTP_FORCE_HTTPS=true in the .env file
    • You can enable redirection to www. by setting JUMP_HTTP_FORCE_CANONICAL=true in the .env file