The following sub-sections describe the steps involved in creating a cartridge base image on the GCE IaaS:
SSH to the spawned instance and make relevant changes to the base image (e.g., If you need a PHP cartridge, install PHP related libraries).
Follow the steps given below to configure a base Image:
Start up a virtual machine (VM) instance using a preferred OS, on a preferred IaaS.
Install the Puppet agent.
Open the puppet
file, which is in the
<PUPPET_AGENT>/etc/default
directory and configure it as follows:
START=yes
Add the following to the puppet.conf
file, which is in the <PUPPET_AGENT>
/etc/puppet
directory:
[main] server=puppet.stratos.org
Stop the puppet instance or instances that are running.
cd /etc/init.d/puppet stop
Copy the init.sh
script into the
<PUPPET_AGENT>/root/bin
directory.
Update the /etc/rc.local
file.
/root/bin/init.sh > /tmp/puppet_log exit 0
Execute the following commands:
rm -rf /var/lib/puppet/ssl/* rm -rf /tmp/*
Set the auto-delete state of the root persistent disk to false
as follows:
This is done to avoid the persistent disk from being automatically deleted when you terminate the instance.
Click on the name of the instance.
Edit the settings related to the instance.
Uncheck the Delete boot disk when instance is deleted option. This is done to ensure that all the data is not deleted when you terminate the instance.
Click Save.
If you wish to view details on the disk related to the instance, click Compute Engine and then click Disks.
Delete the instance.
Initially, you need to terminate the spawned instance using the root persistent disk to be able to create an image. When you are terminating the instance make sure that the persistent disk is not attached to any other virtual machines.
Create a new image as follows:
Disk
and select the relevant disk name from the dropdown menu. You need to do this to create the image based on the persistent disk.