> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salad.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using our preset example image

*Last Updated: October 10, 2024*

We offer a 1-click deploy Ubuntu-based image that contains examples for all our features to let you get quickly up and
running on SaladCloud and to test our services. This image includes some basic tools and applications, as well as
example scripts and servers to test out the features we offer on deployments. You can find it
[here](https://github.com/saladtechnologies/salad-recipes/pkgs/container/recipe-example-image). The source code for the
image is available [here](https://github.com/SaladTechnologies/salad-recipes/tree/master/src/example-image).

## Included Tools:

1. **nvidia-smi**: Lets you check the GPU model in the instance.
2. **neofetch**: Lets you check the hardware you're running on. *Note, neofetch will not display the GPU available in
   your instance, you'll need to use nvidia-smi for this.*
3. **curl & wget**: Lets you curl websites and download files.
4. **nano**: Lets you edit any files on the instance.
5. **ping**: So you can check external networking is working on the instance.
6. **btop**: Lets you check running processes and stats of the instance.

## Included scripts/examples

1. **Example IPv6 enabled server API**: This is an example server that is configured to use IPv6 for compatibility with
   SaladCloud. It offers three endpoints.
   * Running a GET to `https://{saladURL}/` will return a randomly generated string unique to the machine.
     * EG: `curl -H "Content-type: application/json" 'https://{saladURL}/'`
   * Running a POST to `https://{saladURL}/hello` with the following body: `{"message": "Hello"}` will return either
     Goodbye or Hello depending on whether the content of the message field is 'Hello' or 'Goodbye'. **\*note**, only
     Hello and Goodbye are supported messages.\*
     * EG: `curl -XPOST -H "Content-type: application/json" -d '{"message": "Hello"}' 'https://{saladURL}/hello'`
   * Running a POST to https\://{saladURL}/set with the following schema: `{"set": "example_text"}` will change the
     randomly generated string on the `https://{saladURL}/` route to a custom string of your choosing.
     * EG: `curl -XPOST -H "Content-type: application/json" -d '{"set": "example_text"}' 'https://{saladURL}/set'`
2. **Example Environment Variable definitions**: Running ./env\_test.sh will echo the example defined Environment
   Variables defined for your container group. We've pre-defined some in this example image by default.
3. **Example [JWT retrieval](/container-engine/how-to-guides/imds/obtaining-an-imds-jwt) from our Instance Metadata
   Service (IMDS)**: Running `python3 jwt.py` will return the current JWT inside the container. Please note, the IMDS
   only runs when deployed on Salad, you cannot access it when running this image locally.
4. **Readiness probe test**: Running ./readiness-probe.sh will disable the ready status of this container instance for 2
   minutes, before returning to ready. You can check it on the deployment page for this group.
5. **Liveness probe**: This deployment also contains a Liveness probe, it's checking to see if the 'liveness' file
   exists, and as long as it remains reachable the container will stay alive. If the file disappears or becomes
   unavailable, the container will exit and automatically reallocate. Try deleting it with `rm liveness`.
6. **Speedtest**: This container also contains an internet speedtest. Run it with `./speedtest.sh`. Please note, results
   may not be 100% accurate to download speeds with other services. The speedtest downloads a 1.3GB file from
   testfile.org.

## Using the image

Start by entering the /app directory from the terminal with `cd /app`.

The image comes with a readme.sh file which will also contain all the above information.

We configured the image to sleep for a long period of time (approximately 16 years) at startup, this is required in
order to keep the instance running on the node. Manually closing this process will cause the instance to shut down and
reallocate.

We recommend you to use this image to test SaladCloud is working and you have the right settings configured, or to try a
single-use setup to verify your app or program works, without needing to build your final image first.

SaladCloud Replicas are best used stateless, interacting with a specific replica or deployment via the terminal in
stateful manners is not recommended, as replicas can be reallocated at any time due to the spot-instance style of
deployment. Once reallocated, you'll be wiped clean with a base Ubuntu image again. The same will happen if you have
multiple deployed replicas, only one replica will receive the changes you make and could be wiped clean without warning.

## Additional information

This image is based on Ubuntu 24.04 LTS. Python3 is included. Any files you want to import can be retrieved using curl
or wget.
