Upgrading shared hosting to VPS

Tags: 170 views 0

How to allow upgrade of regular shared hosting websites to a website on a virtual machine.

Overview

The components that make the upgrade process possible are Restatemachine and Atomia VPS Agent.

  • Restatemachine orchestrates long running tasks by defining different steps that it performs in sequence.
  • Atomia VPS Agent is deployed on the virtual machines and makes it possible to deploy a website inside of the virtual machine.

Restatemachine and Atomia VPS Agent

Image: Restatemachine and Atomia VPS Agent flowchart.

The restatemachine does the following when migrating a website to a virtual server:

  1. Waits for the VPS to be created and become available.
  2. Creates the website on the VPS:
    • Copies website content from filesystem agent.
    • Updates the preview DNS record of the website.
    • Sets the migration to pending status.
  3. Waits for the migration to be approved. Approval is done by the customer by first previewing the website and then clicking Approve migration in the User Panel.
  4. When approved, updates the DNS records for the website. The old website is kept to avoid interruption of service.
  5. Waits for a configurable amount of time, verifies that the DNS changes has propagated and changes the old website service to a DNS-only service.

Installing restatemachine

  1. Add the Atomia public APT repo to the server and install packages.
  2. repo="$(wget -q -O - http://public.apt.atomia.com/setup.sh.shtml | sed s/%distcode/`lsb_release -c | awk '{ print $2 }'`/g)"; echo "$repo" | sh
    apt-get update
    apt-get install restatemachine restatemachine-pack
    
  3. Modify configuration file /etc/restatemachine/restatemachine.conf.
  4. # ListenOn = ":80"
    # Username = "deus"
    # Password = "exmachina"
    # TLSCertificateFile = "/some/certificate.pem"
    # TLSKeyFile = "/some/certificate_key.pem"
    # StateMachinePath = "/etc/restatemachine/statemachines"
    
  5. Restart restatemachine.
  6. service restatemachine restart
    

Updating the Atomia Resource file

  1. Locate the resource file on the Automation Server machine at C:\Program Files (x86)\Atomia\AutomationServer\Common\Resources.xml.
  2. Modify it to fit the information in the configuration file above.
  3.   <bindings>
        <moduleList>
          <module name="Atomia.Provisioning.Modules.RestateMachine.RestateMachine" resourceAsignmentPolicy="RoundRobin" />
        </moduleList>
        <resourceList>
          <resource name="RestateMachine1">
            <property name="Username">deus</property>
            <property name="Password">exmachina</property>
            <property name="Url">http://127.0.0.1:80</property>
          </resource>
        </resourceList>
      </bindings>      
    
  4. Perform an IIS reset on the server and restart the three Atomia provisioning services to pick up the changes made.

Enabling the upgrade option in Hosting Control Panel

  1. Modify the Domain manager plugin configuration located on the Hosting Control Panel server at C:\Program Files (x86)\Atomia\HostingControlPanel\bin\Atomia.Web.Plugin.Domains.dll.config.
  2. Change ManagedWebsiteEnabled plugin setting to true.
  3. <pluginSetting name="ManagedWebsiteEnabled" value="true" />
  4. Select Managed website as service when clicking Edit on a Linux/Apache website.

Was this helpful?