November 9, 2021
3 min read time

Two-Minute Tech Tuesdays - Varnish on OCI

In this week’s Two Minute Tech Tuesday, we're discussing the official Varnish Enterprise image on the Oracle Cloud marketplace.

If you're a follower of the series, you may have noticed that we've featured a lot of official Varnish Enterprise marketplace images. We've covered AWS, Azure and Google Cloud. Today, we'll talk about the Oracle Cloud. 

 


  1. The story starts in Oracle Cloud's Compute Instances Overview. We already have a web server that we want to accelerate, so we're going to create a new Varnish instance that will cache the content of the web server.

  2. Begin by naming this server Varnish and keep most of the default settings. However, we're going to change the Oracle Linux image to a partner image called Varnish Enterprise 6 for Oracle Cloud Infrastructure OCI. Search for Varnish, and eventually, you'll stumble upon our image, Varnish Enterprise 6 for Oracle Cloud Infrastructure OCI.

  3. Next, we'll select the image and change the shape of the server. We'll stick with two AMD CPUs, and we'll downgrade memory to four gigabytes of RAM, which should be good enough for the demo.

  4.  Select the shape, scroll all the way down and download the private SSH key for SSH access later on. Now, it's just a matter of creating the server and waiting until it's provisioned.

  5. When the server provisioning is finished, you can copy the public IP address and paste it into a browser window. You should end up on the Varnish landing page. Select Next Steps to see installation instructions.

  6. Before we can access the server via SSH, we need to set the permissions. Then it's a matter of using the private key and the opc username along with the public IP address. Then we can run sudo vim /etc/varnish/default.vcl to open up the VCL file.
    [opc@varnish ~]$ sudo vim /etc/varnish/default.vcl

     

  7. Remove the placeholder return statement and change the values of the host and the port for the backend to the corresponding ones of our web server.

  8. After saving and closing the VCL file we run sudo systemctl edit varnish to edit the runtime parameters.
    [opc@varnish ~]$ sudo systemctl edit varnish

     

  9. Then, change the value of the allocated memory from 256 megabytes to gigabytes. Then again, we save and close and run the final command. In this case sudo systemctl restart varnish to restart the Varnish server. Then we can go back to our browser refresh the page and that is the content of our web platform.
    [opc@varnish ~]$ sudo systemctl restart varnish

     

Now you know how to install Varnish Enterprise on the Oracle Cloud. This is a great model for users who are already invested in Oracle services, both Pay-As-You-Go and Bring-Your-Own-License. Stay tuned for next's week episode on Cache variations.


varnish_6_by_example_download