Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

This use case combines Linode’s and Akamai’s capabilities to create a complete end-to-end solution for a simple microsite. To build this application we’ll use Linode origin servers and an Akamai delivery product.

Akamai cloud computing based on Linode provides you with these benefits when creating a microsite:

  • Simple and well-documented UI, CLI, and API provisioning capabilities.
  • A clear pricing model that lets you estimate the cost for your compute needs.
  • The simplicity of Linode combined with the scale of the Akamai CDN.

Architecture Overview

Prerequisites

This use case is for existing Akamai customers that want to learn how to use cloud computing based on Linode when building applications.

Linode Account

Before you start, make sure you have access to a Linode Cloud Manager account, either through your existing account or via a trial login. You can also sign up for a new account.

Note
Talk to your account representative or simply try the free credit available at the top of this guide.

If you’re new to Linode, watch this video to help you get started.

Entitlement for Ion

You also need access to an Akamai account with entitlement for Ion.

Note
To see if you already have entitlement for Ion, log in to ​Akamai Control Center​, go to > ACCOUNT ADMIN > Contracts. Click a Contract ID and search for Ion in the list of products.

Create a Linode

Create a Linode Compute instance to act as an origin server that will store content, messages, and other data for your microsite in the cloud.

Note
To avoid an unexpected bill make sure to delete this Linode Compute Instance once you’ve completed this use case.
  1. Log in to the Linode Cloud Manager and select the Marketplace link from the left navigation menu. This displays the Linode Create page with the Marketplace tab pre-selected.

    You can read An Overview of the Linode Cloud Manager to learn more about features and services available in Linode’s Cloud Manager.

  2. Use the Select an App field to search for the Node.js Marketplace App and select it.

    Select the Node.js Marketplace App

  3. Enter required information under the NodeJS Setup section. For more information and instructions refer to Guides - Deploying Node.js through the Linode Marketplace.

    Note

    This guide involves configuring DNS settings and SSL certificates for your domain. These steps can be automated during the Marketplace App installation process by providing a Linode API Token during setup.

    During installation, the API Token is used to generate a domain zone and records using Linode DNS Manager. The Node.js Marketplace App then utilizes certbot to generate SSL certificates for your domain and subdomain.

    If you plan to utilize Linode DNS Manager, we recommend taking steps now familiarize yourself with our DNS Manager guide.

  4. Select “Ubuntu 20.04 LTS” in the Select an Image section.

  5. Select a region.

  6. Select the Shared CPU Linode 2GB Linode Plan.

  7. Enter a root password.

  8. Select any SSH keys for root access. For more information, refer to the Cloud Manager guide: Manage SSH Keys.

  9. Select Private IP under Add-ons.

  10. Click the Create Linode button at the bottom of the page.

  11. Verify Marketplace App installation before continuing with this guide. It may take several minutes for installation to complete.

    Note

    You can also create a Linode Compute instance using these options:

    Note
    The steps in this example reference the Linode and Akamai user interfaces. You can also perform these tasks using Terraform, the management API, or CLI.

Create an Ion Property

Set up a delivery property to determine how your microsite will be delivered to requesting clients. We’ll use ​the Akamai​ setup wizard to do this.

Begin the Ion Setup Wizard

  1. Start the setup wizard by following the instructions in Create a new guided Ion property.

  2. Enter the FQDN of your Linode origin server as the Hostname. In this guide, we use the example domain www.test.com.

  3. In the Origin Server section select Web server as the Origin hostname and accept the suggested value for the Origin hostname.

Configure the Origin Hostname for your Linode

  1. Add the origin hostname to your origin server domain’s DNS settings.

    For example, if your Linode IP address is 203.0.113.1 and the suggested origin hostname is origin-0361ece-www.test.com, your Linode DNS Manager domain zone needs to have an A record with the following values according to your choice of primary domain:

    Primary DomainRecord TypeHostnameIP Address
    test.comA/AAAAorigin-0361ece-www203.0.113.1
  2. Verify your new origin hostname DNS configuration. For instructions, see the Use dig to Perform Manual DNS Queries guide.

  3. Update your web server to include the origin hostname.

    For example, if you are using NGINX, add the full hostname to the server_name entry as below:

    File: /etc/nginx/sites-enabled/*
    1
    2
    3
    4
    
    server {
        server_name  origin-0361ece-www.test.com test.com www.test.com;
    ...
        

    Then reload NGINX.

    systemctl reload nginx
    
  4. Next, update your origin certificate to include the Origin hostname and reload your web server.

    If using the Node.js Marketplace App, access your origin server via LISH or SSH connection, replacing the example hostnames with your own:

    certbot --expand -d www.test.com -d origin-0361ece-www.test.com
    

    Select 1: No redirect when prompted to complete SSL certificate configuration, then reload your NGINX server:

    systemctl reload nginx
    

    While you are connected, rename the Linode’s system hostname to help identify it later:

    hostnamectl set-hostname server1
    

Complete the Ion Setup Wizard

  1. In the Ion setup wizard ORIGIN SERVER window, select Validate.

  2. Continue to the EDGE CERTIFICATE configuration in the Ion setup wizard.

  3. Select Standard TLS and add the following TXT record to the FQDN domain zone as guided.

    If using Linode DNS Manager, create a TXT record in a domain zone for the Linode’s full hostname. Refer to the following example settings:

    Primary DomainRecord TypeHostnameValue
    www.test.comTXT_acme-challengeEnter Record Value
    Note
    Ensure that there no extra empty spaces when entering the Record Value.
  4. Verify your domain validation DNS record, then click the Validate button.

  5. Continue through the Ion setup wizard by selecting default values for remaining prompts.

  6. When you reach the Review and activate step, click Activate to enable your Ion configuration and Edge certificates.

    This process takes several minutes to complete. Wait for the Next button to appear, then click it to continue.

  7. Once your Ion configuration is activated, your Ion property should now include an Edge hostname such as www.test.com.edgesuite.net. Follow the instructions under the Verify section of the Ion setup wizard to test connectivity directly to your Edge hostname’s IP address by updating your local hosts file. If the IP address for your Edge hostname does not appear before your domain under Hosts file entry as shown in the screen capture below, refresh the page until it does.

  8. After you complete the test, remove the line you added to your local hosts file and click Next.

    Note

    You can also test with staging IP addresses for your Edge hostname. For example, if your edge hostname is www.test.com.edgesuite.net, its staging hostname is www.test.com.edgesuite-staging.net.

    Run the nslookup or dig commands on the staging hostname as shown below.

    dig www.test.com.edgesuite-staging.net +short
    
    nslookup www.test.com.edgesuite-staging.net
    

    As a result, you will see two staging IP addresses. Add either of them to your local hosts file along with your domain and perform the same Verify section browser test.

  9. Replace existing DNS A/AAAA records with an alias to direct your Ion property hostname to your new Edge hostname.

    If using Linode DNS Manager, you must first remove all A/AAAA records and primary domain zones for your Ion property hostname, then create a CNAME record according to the following example values:

    Primary DomainRecord TypeHostnameValue
    test.comCNAMEwwwwww.test.com.edgesuite.net
  10. Verify your DNS configuration changes, then click Check CNAME in the Ion setup wizard. Once your CNAME record is confirmed, requests to your domain should now route through Akamai’s Edge CDN.

Set Up High Availability

High availability is a term used to describe server setups that eliminate single points of failure. The following sections provide instructions for setting up multiple backend servers behind a NodeBalancer, then redirecting traffic from your Ion property to the NodeBalancer by adjusting DNS settings.

Note

NodeBalancers communicate with backend nodes through their private IPv4 addresses via HTTP.

Before you start, ensure your origin server supports HTTP port 80.

If you created your Linodes using Node.js from the Marketplace Apps, you can watch this interactive guide for more information.

Create Multiple Origin Servers

This section involves cloning your Linode origin server to provide high availability through redundancy.

Note

Clustering files or databases is not in the scope of this use case. You can, however, refer to the Host a Website with High Availability guide if you want to learn more.

If you want to use a solution such as GlusterFS, instead of cloning the origin server you need to follow the instructions in Create a Linode to create two or more new Linode Compute Instances.

  1. Log in to the Linode Cloud Manager.

  2. Use the Linode cloning feature to create another Linode origin server in the same region.

    For instructions, refer to Cloning a Linode.

  3. Under Select Linode to Clone From, click the Linode you created for the web server in Create a Linode.

  4. Select the same Linode Plan option you previously selected and click Create Linode.

  5. Add a Private IPv4 Address to the cloned Linode.

  6. Select Power On for the cloned Linode after creation is complete.

  7. Ensure that the web server is running on your cloned Linode.

    If using the Node.js Marketplace App, LISH or SSH into the cloned Linode and start the Node.js server as a background process:

    node /opt/nodejs/hello.js &
    

    You can also rename the cloned Linode hostname to help identify it later:

    hostnamectl set-hostname server2
    

Set Up Network Load Balancing

Linode NodeBalancers distribute user requests between compute instances to improve capacity, performance, and availability. For more information, refer to the Getting Started with NodeBalancers guide.

Note
Before you start, make sure that each of your origin servers has a private IPv4 address. For more information and instructions on how to add private IPv4 addresses to your origin servers, refer to the Managing IP addresses guide.
  1. Log in to the Linode Cloud Manager.

  2. Navigate to the NodeBalancer page and click Create NodeBalancer.

  3. Select the same region you selected for your backend Linode instances.

  4. In the Port Configuration section, change Port from 80 to 443.

  5. Change the Protocol from HTTP to HTTPS.

  6. In the SSL Certificate section, paste the PEM-formatted contents of your web server SSL certificate.

    Note

    If using the Node.js Marketplace App, certificate files are located in the /etc/letsencrypt/live/domain/ directory on your origin servers. Use the contents fullchain.pem and privkey.pem when configuring your NodeBalancer.

    Otherwise, to learn how to get an SSL certificate, refer to the Enabling HTTPS Using Certbot with NGINX guide.

  7. In the Private Key section, paste the PEM-formatted contents of your webserver private key. Your private key cannot have a passphrase.

  8. Select “Least Connection” for the Algorithm setting and “HTTP Cookie” for the Session Stickiness setting.

    Note

    To enable Forward Secrecy for SSL/TLS connections, follow the instructions in the NodeBalancer SSL Configuration guide.

    If using the Node.js Marketplace app, Diffie-Hellman parameters are located on the Linode origin server in the /etc/letsencrypt/ssl-dhparams.pem file by default.

  9. In the Active Health Checks section, select the “HTTP Status” for the Type setting and enter a forward slash (/) as the Check HTTP Path.

    Note
    Make sure all the origin servers listen to HTTP, not HTTPS, otherwise the HTTP Status option will not work.
  10. In the Backend Nodes section, select the Enter IP Address dropdown menu and select private IP address for the first web server.

  11. Enter a label. For example, Server1.

  12. Enter the HTTP port number of the web server under the Port section.

  13. Click Add a Node, and add the second web server.

  14. Review the configuration, and click the Create NodeBalancer button.

  15. Make note of the IP Address of the NodeBalancer.

  16. Redirect your Ion origin hostname DNS A record to point to your NodeBalancer IP address.

    If using Linode DNS Manager, the following settings apply for the example www.test.com domain and NodeBalancer IP address of 203.0.113.2 according to the choice of primary domain:

    Primary DomainRecord TypeHostnameIP Address
    test.comA/AAAAorigin-0361ece-www203.0.113.2
    Note
    For more information on configuration options, see the TLS/SSL Termination on NodeBalancers guide.

Test Your Origin

Complete these steps to test your Linode origin servers.

Create Test Pages

You can use a dynamic or static page to test your Linode origin servers.

  1. To test using dynamic pages, create a page for each of your origin servers. It should show a unique characteristic of the origin servers, such as the server IP address or hostname.

    For example, if you used Node.js Marketplace App to create your Linode, you can edit the /opt/nodejs/hello.js file for each backend Linode and restart Node.js:

    File: /opt/nodejs/hello.js
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    const http = require('http');
    
    const hostname = 'localhost';
    const port = 3000;
    
    const os = require('os');
    
    //Add the following line:
    const servername = os.hostname();
    
    const server = http.createServer((req, res) => {
      res.statusCode = 200;
      res.setHeader('Content-Type', 'text/html');
    
    //Update the following line as shown below:
      res.end('Hello World @'+servername);
    });
    
    server.listen(port, hostname, () => {
      console.log();
    });
        
    
  2. To test using a static page, create a unique html page for each of your Linode origin servers. The pages can simply include text to help you identify each of the origin servers. For example, server1 and server2.

    File: index.html for server1
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    
    <!DOCTYPE html>
    <html>
    
    <head>
       <title>server1</title>
    </head>
    
    <body>
       Welcome to server1!
    </body>
    
    </html>
        
    File: index.html for server2
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    
    <!DOCTYPE html>
    <html>
    
    <head>
       <title>server2</title>
    </head>
    
    <body>
       Welcome to server2!
    </body>
    
    </html>
        

Test Session Stickiness

  1. Open the test page URL using a web browser that supports HTTP cookies. For example, if you have the Node.js test page above and your origin hostname is origin-0361ece-www.test.com, your test page URL is https://origin-0361ece-www.test.com/.

  2. Reload the page a few times. You should receive all responses from the same origin server.

  3. Open a new browser window in private/incognito mode or delete your web browser cookies and test again.

  4. Repeat step 2, until you see a new response coming from a different origin server.

Test Failover

  1. To test failover, shut down one of your origin servers by selecting Power Off for the desired Linode.

    Power Off a Linode origin server.

  2. Repeat the steps in Test Session Stickiness. You should only get a response from active origin servers.

For more information on testing options, refer to the Ion documentation.

Learn More

You can also view the instructions for this use case in the Akamai techdocs.

To participate in a series of interactive modules that will guide you through the steps to get started with Akamai cloud computing based on Linode, go to the Build on Akamai training. You can use your Akamai Control Center login credentials to access the site.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.