UKFast Server

Accessing the server

Add this to your .ssh/config

Redacted

If the root user is disabled, use the developer account:

Redacted

Redacted

Redacted

LetsEncrypt Renewal

This should be set up in a cron job, but a script exists at /home/developer/edmondscommerce-ukfastserver/shellscripts/letsencrypt-renew.bash which will renew all SSL certificates.

Edmonds Commerce Website

Prerequisites

Before working with the container either locally or on the cluster, be sure to add the following to your host file:

Redacted

The reason for this is due to the nature of the build task runner which will not work with the standard client SSL certificates. Adding the host entries allows for a direct resolution of both the dynamic and static versions of the site.

Working with the container

To work with the Edmonds Commerce website you need to pull down the ec-website container. See the documentation on cloning containers for how to clone a container.

Viewing the site

You can view the website that is generated dynamically by visiting:

1
http://www.website.ec.desktop.com

To preview what will be deployed, visit:

1
http://www.static.ec.desktop.com

Working with the site

Referencing images

Local images (stored in local-images):

1
edmondscommerce-files/gd-images/create.php?lowq&src=bridge.jpg &resize[w]=1200&resize[h]=1080

Generating the output

The website runs in two flavours, dynamic and generated output.

To generate the output for deployment run from the project root:

1
bash Deployment/_production/production.bash

The projects's root is in

1
/var/www/vhosts/edmondscommerce.co.uk

Dynamic public root

1
/var/www/vhosts/edmondscommerce.co.uk

Static public root

1
/var/www/vhosts/edmondscommerce.co.uk/Deployment/output

When running the production command it can take some time to run if you choose to run it with no image cache (full generation of images). The site runs with external images that are proxied through PHP and saved in compressed versions, this is resolved to local static images when running the build runner.

Add Section Background

First you need to add your image to:

1
public/skin/edmondscommerce-files/gd-images/local-images/

Then you need to add the following Less:

1
2
3
  #<your-section-id> {
    .sectionMixin('<your-image-file>');
  }

to:

1
public/skin/edmondscommerce-files/pages.less

And compile the Less.

Compiling Less (Dynamic site)

1
bash shellscripts/compileCss

Deploying

Note

Add live site remote

1
git remote add SITE ukfast-free:var/repos/edmondscommerce.co.uk

Build static files

1
bash ./Deployment/_production/production.bash
When you run the above command you will be met by the following output:

1
2
3
4
5
First clear the cache
Do you want to clear the image cache ?
  * [0] No I do not (default)
  * [1] Yes, but not the screenshots
  * [2] Yes all the cached images
What you will need to do here is be sure to always press 0 unless told otherwise.

Then check the output is correct once the command has finished running at www.static.ec.desktop.com.

Push your changes

1
2
3
4
git add -A
git commit -m "Your message"
git push origin master
git push SITE master

Pull your changes

1
2
3
ssh ukfast-free
cd /var/www/vhosts/edmondscommerce.co.uk.git
git pull

Restart varnish

1
2
sudo bash
systemctl restart varnish

And check the site is still working correctly.

IPM Case Study

When working with case studies bundled in to sub folders of the site, you can use Browser Sync to manage most of the heavy lifting when it comes to seeing changes. The frontend work flow when working with these sites is to use the Webpack configuration (wrapped by Laravel Mix - https://laravel.com/docs/5.4/mix).

In a nutshell, to compile assets and see the page automatically update, from the project root run:

1
   npm run watch-poll
This will compile all assets and start up Browser Sync and then will continue to watch the SCSS source files for changes. You will see a link in the terminal telling you what the URL is for Browser Sync.

All source files are held in assets/ipm/scss/. There is currently a bug where some assets are copied to the project root, namely images and fonts.

Compiling for production

Before deploying changes to the case study, run:

1
    npm run production
This will minify all assets and reduce the output considerably compared to development compilation.

See https://laravel.com/docs/5.4/mix for more information on the commands available.