Git commit
Once you have your project initialized, it’s time to add the basics to get it deployed.
In your repository, create a file to hold your app configuration:
touch .platform.app.yamlThis file holds all the configuration for the container where your app lives. By keeping the configuration in this file, you ensure it remains the same across all environments, from development to production.
Start by adding basic properties for your app, such as its name and language.
You can adjust the file to fit your code, such as the start command to start your app, or desires, such as changing the name.
# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'php:8.0'
# Indicate to use Composer 2 (leave out if you want Composer 1)
# See how without Composer: https://fixed.docs.upsun.com/guides/wordpress/vanilla.html
dependencies:
php:
composer/composer: '^2'
# The size of the persistent disk of the application (in MB)
disk: 2048
# Your app's configuration when it's exposed to the web.
web:
locations:
"/":
# The public directory of the app, relative to its root.
root: "web"
# The front-controller script to send non-static requests to.
passthru: "/index.php"# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'php:8.0'
# Indicate to use Composer 2 (leave out if you want Composer 1)
# See how without Composer: https://fixed.docs.upsun.com/guides/wordpress/vanilla.html
dependencies:
php:
composer/composer: '^2'
# The size of the persistent disk of the application (in MB)
disk: 2048
# Your app's configuration when it's exposed to the web.
web:
# Set the upstream property to create a socket to listen to
upstream:
socket_family: tcp
protocol: http
# Set the specific command to start your app
# using the provided port
commands:
start: php path/to/start/command --port=$PORT
locations:
"/":
# Send all requests through to the app
allow: false
passthru: true
scripts: false# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'python:3.10'
# The size of the persistent disk of the application (in MB)
disk: 1024
# Your app's configuration when it's exposed to the web.
web:
commands:
start: python app.pyYou may need to adapt the start command to fit your app.
# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'python:3.10'
# The build-time dependencies of the app.
dependencies:
python3:
pipenv: "2022.6.7"
# The size of the persistent disk of the application (in MB)
disk: 1024
# Your app's configuration when it's exposed to the web.
web:
upstream:
# Ensure your app listens on the right socket
socket_family: unix
commands:
# The exact command varies based on the server you use
# 1) ASGI: daphne
start: "pipenv run daphne app.asgi:application"
# 2) ASGI: uvicorn
start: "pipenv run gunicorn -k uvicorn.workers.UvicornWorker -w 4 -b unix:$SOCKET app.wsgi:application"
# 3) ASGI: hypercorn
start: "pipenv run hypercorn app.asgi:application"
# 4) WSGI: gunicorn
start: "pipenv run gunicorn -w 4 -b unix:$SOCKET app.wsgi:application"# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'python:3.10'
# Set properties for poetry
variables:
env:
POETRY_VERSION: '1.1.14'
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_VIRTUALENVS_CREATE: false
# The size of the persistent disk of the application (in MB)
disk: 1024
web:
upstream:
# Ensure your app listens on the right socket
socket_family: unix
commands:
# The exact command varies based on the server you use
# 1) ASGI: daphne
start: "poetry run daphne app.asgi:application"
# 2) ASGI: uvicorn
start: "poetry run gunicorn -k uvicorn.workers.UvicornWorker -w 4 -b unix:$SOCKET app.wsgi:application"
# 3) ASGI: hypercorn
start: "poetry run hypercorn app.asgi:application"
# 4) WSGI: gunicorn
start: "poetry run gunicorn -w 4 -b unix:$SOCKET app.wsgi:application"# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'nodejs:16'
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
start: NODE_ENV=production npm run start# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'nodejs:16'
# Turn off the default use of npm
build:
flavor: none
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
start: NODE_ENV=production yarn start# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'nodejs:16'
# Turn off the default use of npm
build:
flavor: none
# Include yarn as a global dependency
dependencies:
nodejs:
yarn: "1.22.19"
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
start: NODE_ENV=production yarn startThis assumes you start your app with a start script in your package.json.
You may need to adapt the start command to fit your app.
# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'golang:1.18'
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
# This should match the output of your build command
start: ./bin/appYou may need to adapt the start command to fit your app.
# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'java:14'
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
start: java -jar $JAVA_OPTS target/app.jar --server.port=$PORT# The name of the app. Must be unique within a project.
name: app
# The type of the application to build
type: 'java:14'
# The size of the persistent disk of the application (in MB)
disk: 512
# Your app's configuration when it's exposed to the web.
web:
commands:
# Adapt the `app.jar` to what's in `build.gradle`
start: java -jar $JAVA_OPTS build/libs/app.jar --server.port=$PORTYou may need to adapt the start command to fit your app.
To build your app, you may also need to add commands to go through the build process. These are included in what’s known as the build hook.
Add something similar to the following to the end of the file you just added:
hooks:
build: pipenv install --system --deployhooks:
build: |
# Fail the build if any part fails
set -e
# Install poetry
export PIP_USER=false
curl -sSL https://install.python-poetry.org | python3 - --version $POETRY_VERSION
export PIP_USER=true
# Install dependencies
poetry install (This assumes you have your build process as part of a build script in your package.json)
hooks:
build: npm run buildhooks:
build: |
# Fail the build if any part fails
set -e
corepack yarn install
corepack yarn build hooks:
build: |
# Fail the build if any part fails
set -e
yarn --frozen-lockfile
yarn build hooks:
# Make sure the output matches your start command
build: go build -o bin/apphooks:
build: mvn clean packageAssuming you’ve committed Gradle to your repository.
hooks:
build: ./gradlew clean build --no-daemonCommit your changes (to save your changes):
git add .
git commit -m "Add Upsun Fixed files"Push your changes (to share your changes with everyone with access to your project/repository):
platform pushYou can now see your built app at the returned URL.
Your app is built and served at the returned URL, but it doesn’t yet have all the services it needs to work.
You could define more complicated routes, but the default is enough for basic apps. Now branch your environment to see how data works in Upsun Fixed and then add services.