Skip to main content
Skip to main content
🚧 Work in Progress

Create shared storage service in Zerops

Zerops provides shared storage service that can be connected to runtime services. Shared storage enables your runtime service to share files between all containers of the same service or even among containers of different runtime services.

Connect a shared storage in Zerops GUI​

Connect your Nginx static service directly when creating a new shared storage service. Just select your Nginx static service in the Share with Services block on the Add new shared storage service page.

connect_shared_storage_1

To connect the existing shared storage to the Nginx static service, go to the shared storage service detail and select Shared storage connections. A list of all your current runtime services will be shown. Select a runtime service and the shared storage will be connected to the selected runtime.

connect_shared_storage_1

Zerops will create a new folder /mnt/[shared storage name]`` in the runtime root folder. E.g. /mnt/teststoragefor ateststorage` shared storage. The content of this folder is shared among all containers of the runtime service you've selected. If you select multiple runtimes, the content of the folder will be shared among all containers of selected services.

Disconnect a shared storage in Zerops GUI​

Go to the shared storage service detail and select Shared storage connections. A list of all your current runtime services will be shown. Switch off the toggle to disconnect the shared storage from the selected runtime.

Note

Your runtime service will be automatically restarted when a shared storage is disconnected.

Create Nginx static service with a shared storage using zCLI​

zCLI is the Zerops command-line tool. To create a new Nginx static service via the command-line, follow these steps:

  1. Install & setup zCLI
  2. Create a project description file
  3. Create a project with a Nginx static service and a shared storage

Create a project description file​

Zerops uses a yaml format to describe the project infrastructure.

description.yml format​

Read the basics how to define the Nginx static service using the description.yml.

Example with a shared storage​

Create a directory my-project. Create an description.yml file inside the my-project directory with following content:

# basic project data
project:
# project name
name: my-project

# optional: project description
description: A project with a Nginx and a shared storage

# optional: project tags
tags:
- DEMO
- ZEROPS

# array of project services
services:
- # service name
hostname: teststorage

# shared storage service has no version
type: shared-storage

# mode: HA / NON_HA
mode: NON_HA

- # service name
hostname: app

# service type and version number in nginx@{version} or nginx@latest format
type: nginx@latest

# defines the minimum number of containers for horizontal autoscaling. Max value = 6.
minContainers: 2

# defines the maximum number of containers for horizontal autoscaling. Max value = 6.
maxContainers: 4

# Mount the shared storage to the Nginx static service
mount:
- teststorage

The mount attribute accepts an array of shared storage names you want to mount to your runtime service.

Create a project with a Nginx static service and a shared storage​

Follow the article How to create a project based on the description.yml.