Upsun User Documentation

Resource initialization

Sign up

Get your free trial by clicking the link below.

Get your Upsun free trial

When you first deploy your project or add a new container to it, Upsun uses default resources unless you specify a resource initialization strategy.

You can also use a specific resource initialization strategy when performing certain actions, such as branching, merging, and activating an environment, or restoring a backup.

Default resources Anchor to this heading

Upsun allocates the following default resources to every container when deployed for the first time:

Resource type Amount
CPU 0.5
RAM Depends on the container profile.
Disk size (only applicable if the app or service requires a disk) 512 MB

If you don’t want to use these default resources, you can specify a resource initialization strategy. You can also adjust resources after your project or new container has been deployed.

Specify a resource initialization strategy Anchor to this heading

Upsun provides the following resource initialization strategies:

Strategy Description
default Initializes new containers using the Upsun default resources.
This strategy applies when you first deploy your project (or new container) unless you explicitly specify a different strategy, or allocate resources manually via the resources:set CLI command.
manual With this strategy, the first deployment fails and you need to configure resources manually through the Console, or using resources:set in the CLI.

This strategy allows you to set the exact resources you want, with a single deployment. Other strategies may require fine-tuning, and therefore generate a second deployment. In this case, your environment would run for a short time with unwanted resources, and both deployments would generate downtime.
minimum Initializes new containers using the Upsun minimum resources (see below).
parent Initializes new containers using the same resources as on the parent environment.
If there is no parent environment, or if the container doesn’t already exist on the parent, the default strategy applies instead.
child Initializes new containers using the same resources as on the child environment. Only relevant during merge activities.
backup When restoring a backup, initializes new containers using the same resources as when the backup was taken.

You can specify a resource initialization strategy when performing the following actions:

Action Available strategies Default
First deployment parent, default, minimum, manual parent
Environment branch parent, default, minimum parent
Environment merge child, default, minimum, manual child
Environment activation parent, default, minimum parent
Backup restoration backup, parent, default, minimum backup

First deployment Anchor to this heading

You can define which resource initialization strategy Upsun uses to allocate resources when you first deploy your project or add a new container.

If you’re not using a source integration, you can use a Git push option to specify a resource initialization strategy. To do so, run the following command:

Terminal
upsun push --resources-init=INITIALIZATION_STRATEGY

For example, to use the minimum strategy for your deployment, run the following command:

Terminal
upsun push --resources-init=minimum

Note that you can specify a different resource initialization strategy for each of your deployments.

If you’re using a source integration, you can use the --resources-init flag to specify a resource initialization strategy.

To specify a resource initialization strategy when creating your source integration, include the --resources-init flag in your source integration options.
For example, if you set up a GitHub integration, use the following options:

Terminal
platform integration:add \
  --project PROJECT_ID \
  --type github \
  --repository OWNER/REPOSITORY \
  --token GITHUB_ACCESS_TOKEN \
  --base-url GITHUB_URL
  --resources-init INITIALIZATION_STRATEGY

To specify a resource initialization strategy for an existing source integration, run the following command:

Terminal
upsun integration:update --resources-init=INITIALIZATION_STRATEGY

For example, to use the minimum strategy for your deployment, run the the following command:

Terminal
upsun integration:update --resources-init=minimum

Environment branch Anchor to this heading

By default, when you branch an environment to create a new child environment, the child environment inherits all the resources from its parent. However, you can specify a different resource initialization strategy.

Run the following command:

Terminal
upsun environment:branch --resources-init=INITIALIZATION_STRATEGY

For example, to use the minimum resource initialization strategy, run the following command:

Terminal
upsun environment:branch --resources-init=minimum
  1. Navigate to the environment you want to branch from.
  2. Click Branch.
  3. Enter a name and a type for the new environment.
  4. Select an initialization strategy from the proposed list.
  5. Click Branch.

Environment merge Anchor to this heading

When you merge a child environment into its parent environment, any apps and services you created on the child are merged and therefore created on the parent.

When this happens, any new app or service container created on the parent environment is granted the same resources as on the child environment. However, you can specify a different resource initialization strategy.

Run the following command:

Terminal
upsun environment:merge --resources-init=INITIALIZATION_STRATEGY

For example, to use the manual resource initialization strategy, run the following command:

Terminal
upsun environment:merge --resources-init=manual
  1. Navigate to the environment you want to merge into its parent.
  2. Click Merge.
  3. Select an initialization strategy from the proposed list.
  1. Click Merge.

Environment activation Anchor to this heading

When you activate an environment, Upsun uses the same resource allocation as on the parent environment. If there is no parent environment, the default resource initialization strategy applies.

You can also specify a different resource initialization strategy using the CLI. To do so, run the following command:

Terminal
upsun environment:activate --resources-init=INITIALIZATION_STRATEGY

For example, to use the minimum resource initialization strategy, run the following command:

Terminal
upsun environment:activate --resources-init=minimum

Backup restoration Anchor to this heading

When you restore a backup using the CLI, you can restore it to your current environment or a different environment.

Backup restoration to your current environment Anchor to this heading

Each container already running on the environment keeps its existing resources.

You may have deleted containers between the moment you took the backup, and the moment you restore it.
These containers are restored to your current environment using the backup strategy, which grants them the same resources they were using when the backup was taken. However, you can specify a different resource initialization strategy for those previously deleted containers.

Backup restoration to a different environment Anchor to this heading

The backup strategy also applies by default. However, as all the apps and services are initialized as new containers on the environment, you can specify a different resource initialization strategy for all of them.

Specify a resource initialization strategy when restoring a backup via the CLI Anchor to this heading

Run the following command:

Terminal
upsun backup:restore --resources-init=INITIALIZATION_STRATEGY

For example, to use the minimum resource initialization strategy, run the following command:

Terminal
upsun backup:restore --resources-init=minimum

When you restore a backup using the Console, it is restored to your current environment.

Each container already running on your current environment keeps its existing resources. Therefore, you don’t need to specify a resource initialization strategy.

Environment sync Anchor to this heading

Syncing an environment means merging changes from a parent environment into a child environment. You can sync:

  • Only the code
  • Only the data (databases, files)
  • Only the resources (CPU and RAM, instances, and disk space)
  • Any combination of the three (code and data, data and resources, etc.)

Run the following commands depending on your needs:

  • Sync only resources:

    Terminal
    upsun sync resources
  • Sync only code:

    Terminal
    upsun sync code
  • Sync only data:

    Terminal
    upsun sync data
  • Sync everything:

    Terminal
    upsun sync code data resources

    You can adjust the command depending on the exact combination of elements you want to sync.

  1. Navigate to your Production environment.
  2. Click Sync.
  3. Select the sync options you want from the proposed list.
  4. Select Sync resources from Production into Staging.
  5. Click Sync.

Is this page helpful?