Assets

When the Assets Storage is enabled Squash will automatically add a new /assets/ mount point for all deployments within the repository. You can upload up to 100GB of data in this folder (additional charges apply, check out the pricing page).

How to enable the Assets Storage

Step 1

Go to the Squash Admin page and then click on Settings -> Repositories

../_images/customizing-assets.png

Step 2

Pick a repository and click on “Settings”:

../_images/repo-settings-link.png

Step 3

Enable the Assets Storage

  • Click on the checkbox “Enable Assets Storage”
  • Click “Save”
../_images/assets-repo-settings.png

Uploading files

There are currently 3 methods to upload files to the assets storage.

1. Web Interface

You can upload multiple files at once, create folders, edit and delete files from this interface. Note that it takes between 1 and 3 minutes for any changes to propagate and appear on all deployments.

Note: There is a file size limit of 1 GB for files uploaded from the Web Interface. You can upload any file size (up to 100GB) using either the API or directly from Squash deployments as mentioned below.

../_images/assets-ui.png

2. From any Squash deployment

You just need to SSH to any running deployment and upload files (using SCP or rsync) to the /assets/ folder, and that’s it. Your changes will automatically appear on all running deployments, within one minute or less.

3. API

This is a great option to automate the Assets update and run it on a regular basis.

You can use our Assets API to automate the process of updating the Assets Storage.

Using Assets within my applications

There are multiple ways you can use Assets within your applications.

Using the copy_files feature in the YAML file

Here you would manually copy files or folders within the build process defined in the .squash.yml file. This will essentially transfer data from the assets folder to a different location within your source tree. Then you can use the files as part of your application’s build process.

Example:

deployments:
  AppName1:
    filename:
      ./src/Dockerfile
  copy_files:
    - /assets/dev-dumps/ ~/code/src/

For more details, see copy_files and copy_files_build_process.

Docker volumes

WARNING: We do not recommend changing asset files permissions or file ownership within a Docker volume. This will essentially cause these permissions to propagate to the host deployment and will also affect any active deployments using the assets folder. Another side effect is the ability to upload files from the Squash UI, uploads/updates will be automatically blocked from the Squash interface for assets folders/files with custom ownership or permissions.

You can easily associate the Assets Storage with your deployments by defining a Docker volume from your .squash.yml file as follows:

run_options: -v /assets/pictures:/home/devel/pictures

For the example above, Squash will mount a new “pictures” folder within the “devel” home folder of all docker containers using the contents from the assets storage.

For more details, see run_options.