Configure your project
Back to home
On this page
Required files
To host your application on Upsun, a configuration file (YAML) is needed to manage the way your application behaves.
This configuration file is located inside a .upsun
folder at the root of your source code:
my-app
βββ .upsun
β βββ config.yaml
βββ [.environment]
βββ <project sources>
To pre-generate these YAML files, run the following command from the root of your project.
upsun project:init
Follow the prompts. The upsun project:init
command does the following:
- If possible, automatically detects which framework youβre using. If not detected, you are asked which runtime language your codebase is in.
- Asks if you want to add any services.
- Generates the corresponding
.upsun/config.yaml
and.environment
files.
The generated configuration varies slightly based on your answers to these prompts and whether a framework is detected. However, the structure of the configuration file remains similar to the following:
applications:
# Configuration for all applications within an environment.
myapp:
# configuration for the application 'app'
services:
# Configuration for all services within an environment.
db:
# configuration for service 'db'
routes:
# Configuration for routing to applications
'https://{default}/':
Note
If you want more information on the structure of this configuration file, see the dedicated YAML page.
Committing variables
An additional .environment
file may be located at the root of your source code. This file contains Upsun specific environment variables.
Commit your new files:
git add . && git commit -m "Add configuration for Upsun."
Push up to your Upsun project:
upsun push
Upsun now reads your configuration files, begins building your application image and allocates resources to your various containers.
Note
By default, Upsun uses default resources for each of your services/apps. You can adjust these resources.
Errors on first push
If you try to push a source code that is not Upsun ready, the following error is usually triggered at this point:
Found 749 commits
E: Error parsing configuration files:
- : Configuration directory '.upsun' not found.
E: Error: Invalid configuration files, aborting build
This error is triggered because you have not yet added Upsun configuration to your project to setup deployments.
Errors
The project:init
CLI command uses your responses and some framework-detection logic to attempt to set some sane configuration for your project.
Your project - like most projects - is unique, and this goal of a seamless first deployment may yet be incomplete at this stage.
Have no fear! Upsun provides a highly customizable configuration schema that can be adjusted for your particular package manager, environment variables, builds, deploys, workers, crons, and other requirements to get you fully deployed.
To start exploring what might still be needed, see the following language-specific configuration pages:
Next steps
With your deployment finished, you may have noticed that the resources allocated to the application and service containers of your project have been set automatically:
Opening environment
Environment configuration
app (type: php:8.2, cpu: 0.5, memory: 224, disk: 512)
db (type: mariadb:12.4, cpu: 0.5, memory: 1408, disk: 512)
memcached (type: memcached:1.6, cpu: 0.5, memory: 1088)
Note
Each time you create a new branch, your new environment inherits its parent environment’s resource allocation.
If you need more disk for uploaded files, or less memory for rarely used services, you can adjust resources at any time.