# Runcloud

# Setup a basic staging site on the Dusted Digital using RunCloud

Before getting starting, you should have already created a staging branch, a zip or tar file of the media library, and a backup of the DB.

Steps for RunCloud

  1. From the admin page, choose the Dusted Digital server and 'Deploy a New web App'
  2. Choose Git Repository and Bitbucket
  3. Add the name of the app (replace any spaces with hyphens).
  4. Keep 'Use existing system user' checked.
  5. Choose dustedadmin as the owner.
  6. Domain should just be the name of the client appended with .dusted.digital. i.e. client.dusted.digital
  7. Keep 'enable www for this domain' unchecked.
  8. For DNS Integration, Keep 'None - I will set up DNS records' selected (save the A records as you will need them later).
  9. For SSL/TLS method, choose basic.
  10. For Git, copy and paste the name of the repo: dusted/name-of-client. Make sure you don't have any additional /'s.
  11. Select the branch, ideally staging (create this branch in the repo if it doesn't exist).
  12. Save the text for the deployment key as you will need this for the next stage.
  13. Check Basic settings (Public Path, PHP version, NGINX and Production mode) defaults are all OK.
  14. Deploy the application.

Add your deployment key to Bitbucket

  1. Choose your repo in Bitbucket.
  2. From the repo, go to Repository settings (you might have to increase your user privileges if this option is unavailable).
  3. Choose 'Access keys' from the sub-navigation.
  4. Add a new key for Staging and copy and paste RunCloud's deployment key.

Point your DNS to your server in CloudFlare

  1. CF handles the DNS for the dusted.digital domains.
  2. Request the A records are added (or login to CF and add them).

Add the database for your application

  1. Back RunCloud and on the Dusted Digital server, choose Databases from the sub-navigation.
  2. Add a new database.
  3. DB Name should be the name of the client appended with db. i.e. clientnamedb.
  4. For DB Collation, utf8_general_ci should be fine for most WP sites.
  5. For DB User, cmsdbadmin should be fine.
  6. Add these credentials to the wp-config-staging.php for your site (you can get the DB Password from the other sites hosted on the server).
  7. SSH to the Dusted Digital server and import the database. See MySQL for the command.
  8. Perform a search and replace on the DB and update the production URL for with the Staging URL.
  9. Transfer and uncompress the media library i.e. unzip Archive.zip.

Now, make a cup of tea

via GIPHY