Requesting an Image of an Instance

Requesting an Image of an Instance

Adding scripts that execute after an instance using the image is launched and active

Adding a script to the instance

An image creator can add a script to an instance before it is converted to an image that will execute after the instance using the image is launched and active.

  1. Before requesting the image, create or symlink the script into the /etc/atmo/post-scripts.d directory.

  2. Enter a 'shebang' (bash in the following example) at the beginning of your script:

    #!/bin/bash
  3. Mark both the folder and the script with read and write (+rx or 0755) permissions. After an instance using the image is launched and active, the script will be executed.

Adding a boot script

Additionally, you can add boot scripts through the UI. This method allows you to change those scripts over time. The script can be provided by URL or providing the 'Raw Text' including a shebang line, as referenced above.

  1. Click Advanced Options at the Privacy step, before reviewing the image.

    Advanced Options (click to enlarge)
  2. Skip the Exclude Files step and move to the Deployment Scripts section.

  3. Select the Create New Script option to create a script.

  4. Use the search bar to select a previously created script. Scripts are saved per user, and can be reused across images and instances.

    Deployment Scripts (click to enlarge)
  5. Create a new script using one of the two methods:

    • New script by URL. (URLs must start with http[s]://)

      New script (click to enlarge)
    • New script by Text field. (It is expected that your script will include a shebang line.)

      New script by textfield (click to enlarge)

     6. After creating the new script you should see it listed in the Deployments Scripts section.

Script displayed (click to enlarge)

You should also see it in the final review step.

Final review (click to enlarge)

Example boot script for changing permissions to the ATMO_USER

ATMO_USER is a variable that Atmosphere injects at runtime to ensure that the correct username will be known by a script. This is a requirement for chown-ing permissions of a directory to the user who launched an instance, rather than the user who created the image.

The code below provides a boilerplate example of how one would apply permissions to ATMO_USER for the /opt directory. After changing the directory to match your use case, you should be able to copy this script into the Text field.

#!/bin/bash -x # Permissions Granting Script - v1.0 # # This is a basic 'permissions granting' script to be used as a template # for image creators, to ensure that their UID is not left on directories # critical to the success of their image. # NOTE: in this example, the directory that changes permissions is `/opt` # *REPLACE* `/opt` with the directory you are looking to replace. # Examples: # A single directory: SET_DIRS='/opt/MySoftware' # For multiple directories: SET_DIRS='/opt/MySoftware /var/lib/MySoftware' # For a single directory with a space: # SET_DIRS='/opt/My Software' # *AND* # Replace $SET_DIRS with "$SET_DIRS"  SET_DIRS='/opt' main () { # # This is the main function -- These lines will be executed each run # inject_atmo_vars set_directory } inject_atmo_vars () { # # #NOTE: For now, only $ATMO_USER will be provided to script templates (In addition to the standard 'env') # # # Source the .bashrc -- this contains $ATMO_USER PS1='HACK to avoid early-exit in .bashrc' . ~/.bashrc if [ -z "$ATMO_USER" ]; then echo 'Variable $ATMO_USER is not set in .bashrc! Abort!' exit 1 # 1 - ATMO_USER is not set! fi echo "Found user: $ATMO_USER" } set_directory () { # Set directory (via recursive `chown`) #TODO: Create a 'chown' line for each directory that should be re-assigned to the current user: # # Use $SET_DIRS when your folder does not contain a space. chown -R $ATMO_USER:iplant-everyone $SET_DIRS # USE "$SET_DIRS" when your folder contains a space (Multiple directories not supported) #chown -R $ATMO_USER:iplant-everyone "$SET_DIRS" exit 0 } # This line will start the execution of the script main

Requesting that your image be deleted

Currently, the only way to remove (also known as deleted or archived) an image you requested is to email CyVerse Support. You will receive an email when your image has been archived.

Tips

Here are some tips to help ensure a viable importable image:

  • Operating system: Base the image on CentOS 7 and later, or Ubuntu 14.04 and later.

  • File system: Ext3, Ext4, or XFS.

  • Image format: RAW or QCOW2.

  • Software: Image must contain no licensed software that would prohibit use within a cloud or virtualized environment.

When your image is ready, the preferred way is to provide the image to staff through the Data Store.

Unable to render {include} The included page could not be found.