diff --git a/.github/workflows/build-from-fork.yaml b/.github/workflows/build-from-fork.yaml index 0cb9cfa2a8..c72309ba44 100644 --- a/.github/workflows/build-from-fork.yaml +++ b/.github/workflows/build-from-fork.yaml @@ -2,7 +2,7 @@ name: Build from fork on: pull_request_target: - branches: [main] + branches: [main, ga-staging] types: [labeled,unlabeled,synchronize] env: diff --git a/.github/workflows/check-labels.yaml b/.github/workflows/check-labels.yaml index 320ad730f1..d7dce15438 100644 --- a/.github/workflows/check-labels.yaml +++ b/.github/workflows/check-labels.yaml @@ -1,7 +1,7 @@ name: Check labels on: pull_request_target: - branches: [main] + branches: [main, ga-staging] types: [labeled,opened,reopened,synchronize] env: diff --git a/.github/workflows/generate-cli-commands-page.yaml b/.github/workflows/generate-cli-commands-page.yaml index 4d425e1b8f..c61ec01cf1 100644 --- a/.github/workflows/generate-cli-commands-page.yaml +++ b/.github/workflows/generate-cli-commands-page.yaml @@ -16,7 +16,7 @@ env: BRANCH_TITLE: cli-commands-doc-page DEFAULT_BRANCH: "main" PLATFORMSH_CLI_DOC_PATH: "sites/platform/src/administration/cli/reference.md" - UPSUN_CLI_DOC_PATH: "sites/friday/src/administration/cli/reference.md" + UPSUN_CLI_DOC_PATH: "sites/upsun/src/administration/cli/reference.md" permissions: contents: write diff --git a/.github/workflows/get-pr-info.yaml b/.github/workflows/get-pr-info.yaml index f6e7037cca..69e90e3221 100644 --- a/.github/workflows/get-pr-info.yaml +++ b/.github/workflows/get-pr-info.yaml @@ -1,7 +1,7 @@ name: Get info on PR on: pull_request_target: - branches: [main] + branches: [main, ga-staging] types: [labeled,opened,reopened,synchronize] env: diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index 2fb604ae2a..4d4a0efbcb 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -1,7 +1,7 @@ name: Linting on: pull_request_target: - branches: [main] + branches: [main, ga-staging] types: [labeled,opened,reopened,synchronize] jobs: diff --git a/.github/workflows/manage-environment.yaml b/.github/workflows/manage-environment.yaml index 71c97afd75..5a6e07f61c 100644 --- a/.github/workflows/manage-environment.yaml +++ b/.github/workflows/manage-environment.yaml @@ -1,7 +1,7 @@ name: Manage environment on: pull_request_target: - branches: [main] + branches: [main, ga-staging] types: - opened - reopened diff --git a/.github/workflows/pr-check-links.yaml b/.github/workflows/pr-check-links.yaml index 757701a731..be07b60438 100644 --- a/.github/workflows/pr-check-links.yaml +++ b/.github/workflows/pr-check-links.yaml @@ -1,7 +1,7 @@ name: Check internal links on: pull_request: - branches: [main] + branches: [main, ga-staging] types: [opened,reopened,synchronize,labeled,unlabeled] diff --git a/.platform/applications.yaml b/.platform/applications.yaml index b4a0c539bb..3fc37c361e 100644 --- a/.platform/applications.yaml +++ b/.platform/applications.yaml @@ -66,7 +66,7 @@ size: S - # The name of this application, which must be unique within a project. - name: 'friday' + name: 'upsun' # The type key specifies the language and version for your application. type: 'nodejs:20' @@ -75,7 +75,7 @@ variables: env: HUGOVERSION: 0.116.0 - SITE_DIR: 'sites/friday' + SITE_DIR: 'sites/upsun' build: flavor: none @@ -111,7 +111,7 @@ locations: '/': # The public directory of the application relative to its root. - root: 'sites/friday/public' + root: 'sites/upsun/public' passthru: true index: ['index.html'] scripts: false @@ -124,8 +124,8 @@ disk: 1024 mounts: - "sites/friday/public/scripts/xss/dist/config": + "sites/upsun/public/scripts/xss/dist/config": source: local - source_path: "sites/friday/config" + source_path: "sites/upsun/config" size: S diff --git a/.platform/routes.yaml b/.platform/routes.yaml index d96c8e739d..2cd0694739 100644 --- a/.platform/routes.yaml +++ b/.platform/routes.yaml @@ -272,8 +272,8 @@ https://{default}/: https://docs.upsun.com/: type: upstream - upstream: friday:http - id: friday + upstream: upsun:http + id: upsun cache: enabled: true ssi: diff --git a/.vale.ini b/.vale.ini index abf36461d3..01fb72f70e 100644 --- a/.vale.ini +++ b/.vale.ini @@ -2,7 +2,7 @@ StylesPath = contributing/styles Vocab = Platform -MinAlertLevel = suggestion # suggestion, warning, or error +MinAlertLevel = error # suggestion, warning, or error [*.md] BasedOnStyles = Platform,Vale diff --git a/README.md b/README.md index ebb3638236..09314f9ce9 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ but if you don't, the search field doesn't appear in the sidebar. 1. To run the docs alone, clone this repository and install dependencies: ```bash - cd sites/platform # or cd sites/friday + cd sites/platform # or cd sites/upsun npm install ``` @@ -161,15 +161,15 @@ When you add a white label documentation, you want vendor-specific values, such For example, if you add a white label documentation for a product called MyGreatProduct, you want every instance of `Platform.sh` and `Platform.sh CLI` to be automatically substituted by `MyGreatProduct` and `MyGreatProduct CLI` respectively. -To achieve that result, use the settings placeholders defined in the `sites/friday/config/_default/params.yaml` file: +To achieve that result, use the settings placeholders defined in the `sites/upsun/config/_default/params.yaml` file: ```yaml # Vendorization vendor: - name: Deploy Friday - cli: friday - env_prefix: FRIDAY - config_dir: .friday + name: Upsun + cli: upsun + env_prefix: PLATFORM + config_dir: .upsun ``` Each of them can be used in any templates (HTML or MarkDown) using shortcodes: @@ -207,7 +207,7 @@ To do so, you could implement the following file structure: ```bash sites -├── friday +├── upsun │ └── src │ └── tutorials │ └── migrating diff --git a/contributing/styles/config/vocabularies/Platform/accept.txt b/contributing/styles/config/vocabularies/Platform/accept.txt index 5cdc37a42a..1e647babd4 100644 --- a/contributing/styles/config/vocabularies/Platform/accept.txt +++ b/contributing/styles/config/vocabularies/Platform/accept.txt @@ -26,6 +26,7 @@ CDNs? CMS CNAMEs? [Cc]onfig +[Cc]omposable Corepack CPUs? [Cc]ron @@ -101,6 +102,7 @@ Nagios Namecheap namespace Neve +Nixpkgs [Nn]ginx NodePing Nori diff --git a/search/index_external_sites.sh b/search/index_external_sites.sh index c24e9e08ba..12a7dd131b 100755 --- a/search/index_external_sites.sh +++ b/search/index_external_sites.sh @@ -3,7 +3,7 @@ cleanup(){ echo "* CLEANING UP OLD DOCS INDEX" rm -f output/platform_index.json - rm -f output/friday_index.json + rm -f output/upsun_index.json } @@ -27,9 +27,9 @@ update_index(){ POETRY_LOCATION=/app/.local/bin/poetry # Update indexes $POETRY_LOCATION run python createPrimaryIndex.py platform - $POETRY_LOCATION run python createPrimaryIndex.py friday + $POETRY_LOCATION run python createPrimaryIndex.py upsun $POETRY_LOCATION run python main.py platform - $POETRY_LOCATION run python main.py friday + $POETRY_LOCATION run python main.py upsun } # scrape diff --git a/search/main.py b/search/main.py index c5a5d526a5..1e4fd1c2b9 100644 --- a/search/main.py +++ b/search/main.py @@ -129,13 +129,13 @@ def update(self): # Create a new index create_index_task = client.create_index(uid=self.docs_index, options={'primaryKey': self.primaryKey, 'uid': self.index_name}) - timeout = 5000 + timeout = 10000 if "friday" == docs_index_name: timeout = 15000 try: client.wait_for_task(create_index_task['taskUid'], timeout) - except MeilisearchTimeoutError as merror: + except meilisearch.errors.MeilisearchTimeoutError as merror: print('Failed waiting {0} milliseconds for Meilisearch to create the index. Error message: {1}'.format(timeout, merror)) return diff --git a/search/post_deploy.sh b/search/post_deploy.sh index c6f1aa1931..d729c0d3c4 100755 --- a/search/post_deploy.sh +++ b/search/post_deploy.sh @@ -3,20 +3,20 @@ cleanup(){ echo "* CLEANING UP OLD DOCS INDEX" rm -v output/platform_docs.json && echo "output json for platform deleted" || echo "failed to delete output json for platform" - rm -v output/friday_docs.json && echo "output json for upsun deleted" || echo "failed to delete output json for upsun" + rm -v output/upsun_docs.json && echo "output json for upsun deleted" || echo "failed to delete output json for upsun" } getDocsData() { # Get the frontend URLs PLATFORM_DOCS_URL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary) | .key') - FRIDAY_DOCS_URL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.id=="friday") | .key') + UPSUN_DOCS_URL=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.id=="upsun") | .key') printf "URL for platform docs: %s\n" "${PLATFORM_DOCS_URL}" - printf "URL for upsun docs: %s\n" "${FRIDAY_DOCS_URL}" + printf "URL for upsun docs: %s\n" "${UPSUN_DOCS_URL}" # Delete docs index in the mount if it exists rm -v data/platform_index.json && echo "data json for platform deleted" || echo "failed to delete data json for platform" - rm -v data/friday_index.json && echo "data json for upsun deleted" || echo "failed to delete data json for upsun" + rm -v data/upsun_index.json && echo "data json for upsun deleted" || echo "failed to delete data json for upsun" # remove the previous headers log if [ -f "data/platform-headers.txt" ]; then @@ -34,17 +34,17 @@ getDocsData() { # curl --user-agent "request-to-upsun-docs" -s -D - -o foobar.json "https://docs.upsun.com/index.json" >> headers.txt curl --user-agent "request-search-index-for-platform-docs" -s -D - -o data/platform_index.json "${PLATFORM_DOCS_URL}index.json" >> data/platform-headers.txt #curl -s "${PLATFORM_DOCS_URL}index.json" >> data/platform_index.json && echo "retrieved psh index" || echo "failed to retrieve psh index" - curl --user-agent "request-search-index-for-upsun-docs" -s -D - -o data/friday_index.json "${FRIDAY_DOCS_URL}index.json" >> data/upsun-headers.txt - #curl -s "${FRIDAY_DOCS_URL}index.json" >> data/friday_index.json && echo "retrieved upsun index" || echo "failed to retrieve upsun index" + curl --user-agent "request-search-index-for-upsun-docs" -s -D - -o data/upsun_index.json "${UPSUN_DOCS_URL}index.json" >> data/upsun-headers.txt + #curl -s "${UPSUN_DOCS_URL}index.json" >> data/upsun_index.json && echo "retrieved upsun index" || echo "failed to retrieve upsun index" # How many times does Platform.sh appear in the platform index? Should be 3815 pshOccurrenceInPsh=$(cat data/platform_index.json | grep -o -i Platform.sh | wc -l) # How many times does Platform.sh appear in the Upsun index? should be 33 - pshOccurrenceInUpsun=$(cat data/friday_index.json | grep -o -i Platform.sh | wc -l) + pshOccurrenceInUpsun=$(cat data/upsun_index.json | grep -o -i Platform.sh | wc -l) #How many times does Upsun appear in the platform index? Should be 0 upsunOccurrenceInPsh=$(cat data/platform_index.json | grep -o -i Upsun | wc -l) #how many times does Upsun appear in the upsun index? Should be 4616 - upsunOccurrenceInUpsun=$(cat data/friday_index.json | grep -o -i Upsun | wc -l) + upsunOccurrenceInUpsun=$(cat data/upsun_index.json | grep -o -i Upsun | wc -l) printf "Upsun appears %d times in the platform index.\nUpsun appears %d times in the Upsun index.\n" "${upsunOccurrenceInPsh}" "${upsunOccurrenceInUpsun}" printf "Platform appears %d times in the platform index.\nPlatform appears %d times in the Upsun index.\n" "${pshOccurrenceInPsh}" "${pshOccurrenceInUpsun}" @@ -62,13 +62,13 @@ getDocsData() { # Delete templates index in the mount if it exists rm -f data/platform_templates.yaml - rm -f data/friday_templates.yaml + rm -f data/upsun_templates.yaml # Get the updated index for templates curl -s "${PLATFORM_DOCS_URL}files/indexes/templates.yaml" >> data/platform_templates.yaml # @todo: For now, reuse the same index. To be removed entirely. - cp data/platform_templates.yaml data/friday_templates.yaml + cp data/platform_templates.yaml data/upsun_templates.yaml } update_index(){ @@ -76,11 +76,11 @@ update_index(){ POETRY_LOCATION=/app/.local/bin/poetry # Create indices for templates and docs $POETRY_LOCATION run python createPrimaryIndex.py platform - $POETRY_LOCATION run python createPrimaryIndex.py friday + $POETRY_LOCATION run python createPrimaryIndex.py upsun # Update indexes $POETRY_LOCATION run python main.py platform - $POETRY_LOCATION run python main.py friday + $POETRY_LOCATION run python main.py upsun } save_headers() { diff --git a/shared/data/registry.json b/shared/data/registry.json index 9d70e28fce..f1400c9aa5 100644 --- a/shared/data/registry.json +++ b/shared/data/registry.json @@ -3,8 +3,8 @@ "description": "", "disk": false, "docs": { - "relationship_name": "chromeheadlessbrowser", - "service_name": "chromeheadless", + "relationship_name": "chrome-headless", + "service_name": "chrome-headless", "url": "/add-services/headless-chrome.html" }, "endpoint": "http", @@ -100,7 +100,7 @@ "description": "A manufacture service for Elasticsearch", "disk": true, "docs": { - "relationship_name": "essearch", + "relationship_name": "elasticsearch", "service_name": "elasticsearch", "url": "/add-services/elasticsearch.html" }, @@ -276,7 +276,7 @@ "description": "", "disk": true, "docs": { - "relationship_name": "influxdbdatabase", + "relationship_name": "influxdb", "service_name": "influxdb", "url": "/add-services/influxdb.html" }, @@ -355,7 +355,7 @@ "description": "", "disk": true, "docs": { - "relationship_name": "kafkaqueue", + "relationship_name": "kafka", "service_name": "kafka", "url": "/add-services/kafka.html" }, @@ -431,7 +431,7 @@ "repo_name": "mariadb", "disk": true, "docs": { - "relationship_name": "mariadbdatabase", + "relationship_name": "mariadb", "service_name": "mariadb", "url": "/add-services/mysql.html" }, @@ -491,7 +491,7 @@ "repo_name": "mariadb", "disk": true, "docs": { - "relationship_name": "mysqldatabase", + "relationship_name": "mysql", "service_name": "mysql", "url": "/add-services/mysql.html" }, @@ -547,7 +547,7 @@ "repo_name": "memcached", "disk": false, "docs": { - "relationship_name": "memcachedcache", + "relationship_name": "memcached", "service_name": "memcached", "url": "/add-services/memcached.html" }, @@ -573,7 +573,7 @@ "repo_name": "mongodb", "disk": true, "docs": { - "relationship_name": "mongodbdatabase", + "relationship_name": "mongodb", "service_name": "mongodb", "url": "/add-services/mongodb.html" }, @@ -598,8 +598,8 @@ "repo_name": "mongodb", "disk": true, "docs": { - "relationship_name": "mongodbdatabase", - "service_name": "mongodb", + "relationship_name": "mongodb-enterprise", + "service_name": "mongodb-enterprise", "url": "/add-services/mongodb.html" }, "endpoint": "mongodb", @@ -712,7 +712,7 @@ "description": "A manufacture service for OpenSearch", "disk": true, "docs": { - "relationship_name": "ossearch", + "relationship_name": "opensearch", "service_name": "opensearch", "url": "/add-services/opensearch.html" }, @@ -754,7 +754,7 @@ "repo_name": "oracle-mysql", "disk": true, "docs": { - "relationship_name": "oracledatabase", + "relationship_name": "oracle-mysql", "service_name": "oracle-mysql", "url": "/add-services/mysql.html" }, @@ -844,7 +844,7 @@ "repo_name": "postgresql", "disk": true, "docs": { - "relationship_name": "postgresqldatabase", + "relationship_name": "postgresql", "service_name": "postgresql", "url": "/add-services/postgresql.html" }, @@ -946,7 +946,7 @@ "repo_name": "rabbitmq", "disk": true, "docs": { - "relationship_name": "rabbitmqqueue", + "relationship_name": "rabbitmq", "service_name": "rabbitmq", "url": "/add-services/rabbitmq.html" }, @@ -1002,7 +1002,7 @@ "repo_name": "redis", "disk": false, "docs": { - "relationship_name": "rediscache", + "relationship_name": "redis", "service_name": "redis", "url": "/add-services/redis.html" }, @@ -1150,7 +1150,7 @@ "repo_name": "solr", "disk": true, "docs": { - "relationship_name": "solrsearch", + "relationship_name": "solr", "service_name": "solr", "url": "/add-services/solr.html" }, @@ -1206,7 +1206,7 @@ "repo_name": "varnish", "disk": false, "docs": { - "relationship_name": "varnishstats", + "relationship_name": "varnish", "service_name": "varnish", "url": "/add-services/varnish.html" }, @@ -1236,7 +1236,7 @@ "description": "", "disk": true, "docs": { - "relationship_name": "vault_secret", + "relationship_name": "vault-kms", "service_name": "vault-kms", "url": "/add-services/vault.html" }, diff --git a/sites/friday/src/add-services/network-storage.md b/sites/friday/src/add-services/network-storage.md deleted file mode 100644 index d468e577ca..0000000000 --- a/sites/friday/src/add-services/network-storage.md +++ /dev/null @@ -1,221 +0,0 @@ ---- -title: "Network Storage" -weight: -30 ---- - -The Network Storage service enables a new kind of [mount](../create-apps/app-reference.md#mounts) -that refers to a shared service rather than to a local directory. -This service allows you to store data and share it between different apps. - -## Supported versions - -{{% major-minor-versions-note configMinor="true" %}} - -{{< image-versions image="network-storage" status="supported" environment="grid" >}} - -This service is the {{% vendor/name %}} network storage implementation, not the version of a third-party application. - -{{< note theme="warning">}} - -It isn't possible to upgrade or downgrade the network storage service version while keeping existing data in place. -Changing the service version requires that the service be reinitialized. -Any change to the service version results in existing data becoming inaccessible. - -{{< /note >}} - -{{% deprecated-versions %}} - -{{< image-versions image="network-storage" status="deprecated" environment="grid" >}} - -## Usage example - -{{% endpoint-description type="network-storage" noApp=true /%}} - -## Multi-application usage - -If your project contains [multiple apps](../create-apps/multi-app/_index.md), -they may [share `storage` mounts](/create-apps/app-reference/_index.md#data-sharing-through-mounts). - -Alternatively, they may use shared `service` mounts. -If the `source_path` is the same for both apps, -the files are shared between the two applications even if the mount location is different. - -It's also possible to have one app mount a `source_path` that's a subdirectory of another application's mount. -For example: - -```yaml {configFile="apps"} -{{% snippet name="app1" config="apps" %}} -... -mounts: - 'web/uploads': - source: service - service: files - source_path: uploads -{{% /snippet %}} - -{{% snippet name="app2" config="apps" globKey="false" %}} -... -mounts: - 'process': - source: service - service: files - source_path: uploads/incoming - 'done': - source: service - service: files - source_path: uploads/done -{{% /snippet %}} -``` - -In this example, `app1` has access to the entire `uploads` directory by writing to `web/uploads`. -`app2` has two mounts that it can write to: `process` and `done`. -The `process` mount refers to the same directory as the `web/uploads/incoming` directory does on `app1`, -and the `done` mount refers to the same directory as the `web/uploads/done` directory on `app1`. - -## How do I give my workers access to my main application’s files? - -If you need to use a worker with access to the same file mount as your web-serving app, -define all the necessary mounts as `service` mounts. - -The following example assumes a Network Storage service named `files` has been defined in `{{< vendor/configfile "services" >}}`. -Drupal files directories are shared between the `web` and `worker` instances, -while the Drush backup directory is unique to the `web` instance. - -```yaml {configFile="app"} -name: 'app' -type: 'php:7.2' - -relationships: - mariadbdatabase: 'mariadb:mysql' - -hooks: - # ... - -web: - locations: - '/': - # ... - -mounts: - # The public and private files directories are - # network mounts shared by web and workers. - 'web/sites/default/files': - source: service - service: files - source_path: files - 'private': - source: service - service: files - source_path: private - # The backup, temp, and cache directories for - # Drupal's CLI tools don't need to be shared between web and workers. - # It wouldn't hurt anything to make them network - # shares, however. - '/.drush': - source: storage - source_path: drush - 'tmp': - source: tmp - source_path: tmp - 'drush-backups': - source: storage - source_path: drush-backups - '/.console': - source: storage - source_path: console - -# Crons run on the web container, so they have the -# same mounts as the web container. -crons: - drupal: - spec: '*/20 * * * *' - commands: - start: 'cd web ; drush core-cron' - -# The worker defined here also has the same 6 mounts; -# 2 of them are shared with the web container, -# the other 4 are local to the worker. -workers: - queue: - commands: - start: | - cd web && drush queue-run myqueue -``` - -## How can I migrate data from a `storage` mount to a `service` mount? - -Network Storage `service` mounts can be shared between different apps, -while `storage` mounts can only be shared between different _instances_ of the same app. -To move data from a `storage` mount to a `service` one, follow these instructions. - -Assuming you have the following `storage` mount: - -```yaml {configFile="app"} -mounts: - web/uploads: - source: storage - source_path: uploads -``` - -1. Add a new `network-storage` service to your configuration: - - ```yaml {configFile="services"} - # The name of the service container. Must be unique within a project. - network-storage: - type: network-storage:{{% latest "network-storage" %}} - ``` - - {{< note >}} - - Make sure you [allocate enough disk space](/manage-resources/adjust-resources.md#vertical-scaling) to your `network-storage` service - for your existing files with some buffer. - - {{< /note >}} - -2. Add a new `service` mount, named `new-uploads`: - - ```yaml {configFile="app"} - mounts: - web/uploads: - source: storage - source_path: uploads - new-uploads: - source: service - service: files - source_path: uploads - ``` - - Note that each mount is on a different storage service, which is why they can have the same `source_path`. - -3. Deploy your changes. - -4. Copy all your files from the `storage` (`web/uploads`) mount to the `service` (`new-uploads`) mount using `rsync`: - - ```bash - rsync -avz web/uploads/* new-uploads/ - ``` - -5. Reverse the mounts. - To do so, rename the `storage` mount to `old-uploads`, and point the `web/uploads` directory to the `service` mount: - - ```yaml {configFile="app"} - mounts: - old-uploads: - source: storage - source_path: uploads - web/uploads: - source: service - service: files - source_path: uploads - ``` - -6. Push your changes and check that the files are now accessible from the `service` mount (now named `web/uploads`). - To check that no files were lost during the transfer, run the following command: - - ```bash - rsync -avz old-uploads/* web/uploads/ - ``` - -7. Delete the contents of the `old-uploads` `storage` mount before removing it. - -8. Push your changes again. diff --git a/sites/friday/src/get-started/here/_index.md b/sites/friday/src/get-started/here/_index.md deleted file mode 100644 index 013ab19841..0000000000 --- a/sites/friday/src/get-started/here/_index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebarTitle: Introduction -title: Getting started with Upsun -weight: -100 -layout: single -# aliases: -# - /get-started/_index.md ---- - -Welcome to Upsun! - -Follow this guide to set up your very first custom application on Upsun. -In the process, you will learn more about Upsun, what it does, and how you can work with it to your best advantage. - -{{< note title="Have you seen the Upsun demo?" theme="info" >}} - -Find out how Upsun works and gain a better understanding of what it provides. To check the demo out, [create a new project](https://console.upsun.com/projects/create-project) and select **Deploy demo project**. - -{{< /note >}} - -Once you have finished the demo, you'll go through the following steps to accomplish your custom deployment: - -{{< get-started/steps >}} - -{{< guide-buttons next="Setup" nextLink="/get-started/here/setup.md" type="*" >}} diff --git a/sites/friday/src/get-started/stacks/_index.md b/sites/friday/src/get-started/stacks/_index.md deleted file mode 100644 index cfa814898d..0000000000 --- a/sites/friday/src/get-started/stacks/_index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Frameworks -weight: -80 -layout: single -# aliases: -# - /get-started/_index.md ---- - -{{< get-started/steps >}} diff --git a/sites/friday/src/get-started/stacks/django.md b/sites/friday/src/get-started/stacks/django.md deleted file mode 100644 index 819f5b0a66..0000000000 --- a/sites/friday/src/get-started/stacks/django.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Deploying Django on Upsun -sidebarTitle: Django -sectionBefore: Python -layout: single -weight: -80 -description: | - Welcome to the Upsun documentation specific to the Django framework on Upsun. - It includes common reference materials useful for deploying Django, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [Python documentation](/languages/python/) -- [Managing dependencies](/languages/python/dependencies) -- [Configuring web servers](/languages/python/server) - -## Community content - -- [Django topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=django) -- [Python topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=python) - -## Blogs - -- [Up(sun) and running with Django](https://upsun.com/blog/setting-up-django-on-upsun/) - - diff --git a/sites/friday/src/get-started/stacks/express.md b/sites/friday/src/get-started/stacks/express.md deleted file mode 100644 index b0e2d9c4e7..0000000000 --- a/sites/friday/src/get-started/stacks/express.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Deploying Express on Upsun -sidebarTitle: Express -sectionBefore: Javascript/Node.js -weight: -100 -description: | - Welcome to the Upsun documentation specific to the Express framework on Upsun. - It includes common reference materials useful for deploying Express, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [JavaScript/Node.js documentation](/languages/nodejs/) -- [Managing dependencies](/languages/nodejs#dependencies) - -## Community content - -- [ExpressJS topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=express) -- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) -- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) - -## Blogs - -- [A quick-start guide on hosting Express on Upsun](https://upsun.com/blog/setting-up-express-on-upsun/) - - diff --git a/sites/friday/src/get-started/stacks/flask.md b/sites/friday/src/get-started/stacks/flask.md deleted file mode 100644 index 657d44e561..0000000000 --- a/sites/friday/src/get-started/stacks/flask.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Deploying Flask on Upsun -sidebarTitle: Flask -weight: -75 -description: | - Welcome to the Upsun documentation specific to the Flask framework on Upsun. - It includes common reference materials useful for deploying Flask, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [Python documentation](/languages/python/) -- [Managing dependencies](/languages/python/dependencies) -- [Configuring web servers](/languages/python/server) - -## Community content - -- [Django topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=django) -- [Python topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=python) - -## Blogs - -- [Up(sun) and running with Django](https://upsun.com/blog/setting-up-django-on-upsun/) - - diff --git a/sites/friday/src/get-started/stacks/laravel.md b/sites/friday/src/get-started/stacks/laravel.md deleted file mode 100644 index 1601c1bcea..0000000000 --- a/sites/friday/src/get-started/stacks/laravel.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Deploying Laravel on Upsun -sidebarTitle: Laravel -sectionBefore: PHP -weight: -70 -description: | - Welcome to the Upsun documentation specific to the Laravel framework on Upsun. - It includes common reference materials useful for deploying Laravel, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [PHP documentation](/languages/php/) -- [Extensions](/languages/php/extensions) -- [Performance tuning](/languages/php/tuning) -- [PHP-FPM sizing](/languages/php/fpm) -- [Swoole on Upsun](/languages/php/swoole) -- [Authenticated Composer](/languages/php/composer-auth) - -## Community content - -- [Laravel topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=laravel) -- [PHP topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=php) - -## Blogs - -- [Upsun: the missing PaaS to scale Laravel applications](https://upsun.com/blog/paas-to-scale-laravel-apps/) - - diff --git a/sites/friday/src/get-started/stacks/nextjs.md b/sites/friday/src/get-started/stacks/nextjs.md deleted file mode 100644 index e4420c918a..0000000000 --- a/sites/friday/src/get-started/stacks/nextjs.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Deploying Next.js on Upsun -sidebarTitle: Next.js -weight: -95 -description: | - Welcome to the Upsun documentation specific to the Next.js framework on Upsun. - It includes common reference materials useful for deploying Next.js, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [JavaScript/Node.js documentation](/languages/nodejs/) -- [Managing dependencies](/languages/nodejs#dependencies) - -## Community content - -- [Next.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=nextjs) -- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) -- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) - -## Blogs - -- [A quick-start guide on hosting Next.js on Upsun](https://upsun.com/blog/setting-up-next-js-on-upsun/) - - diff --git a/sites/friday/src/get-started/stacks/strapi.md b/sites/friday/src/get-started/stacks/strapi.md deleted file mode 100644 index 5b78f698d6..0000000000 --- a/sites/friday/src/get-started/stacks/strapi.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Deploying Strapi on Upsun -sidebarTitle: Strapi -weight: -90 -description: | - Welcome to the Upsun documentation specific to the Strapi framework on Upsun. - It includes common reference materials useful for deploying Strapi, but also external community and blog resources that cover more advanced topics relevant for the framework. ---- - -{{< note title="Hello, there!" theme="info" >}} - -{{% description %}} - -Before you proceed, be sure to checkout the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). These two resources provide all of the core concepts and common commands you'll need to know before using the materials below. - -{{< /note >}} - -## Getting started - -- [Upsun demo application](https://console.upsun.com/projects/create-project) -- [Upsun Getting started guide](/get-started/here/_index.md) -- [What is Upsun?](/learn/overview) - -## Documentation - -- [JavaScript/Node.js documentation](/languages/nodejs/) -- [Managing dependencies](/languages/nodejs#dependencies) - -## Community content - -- [Strapi topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=strapi) -- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) -- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) - - - - diff --git a/sites/friday/src/security/backups.md b/sites/friday/src/security/backups.md deleted file mode 100644 index 3e1aa07253..0000000000 --- a/sites/friday/src/security/backups.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Backup and restore" -description: See backup policies and the recovery point objective (RPO) and recovery time objective (RTO) for various schedules. ---- - - -The following standard backup policy is applied to your projects and defines how many backups you can take advantage of. - -**Production environments:** -- 1 automated backup per day, with a [2-day retention](/security/data-retention.md) (2 days worth of backups are retained at any given point). - Automated backups are always [live](/environments/backup.md#live-backups). -- 2 manual backups maximum at any given point (the third manual backup replaces the oldest manual backup). - -**Preview environments (development and staging):** -- No automated backups. -- 2 manual backups maximum at any given point (the third manual backup replaces the oldest manual backup). - -Note that the number of backups is limited per [environment **type**](/glossary/_index.md#preview-environment) and not per project. -Therefore, a {{< vendor/name >}} project can have up to 6 backups at once (2 automated backups and 2 manual backups of the production environment, -plus 2 manual backups of any preview environments). - -{{< note >}} - -This policy applies during the beta phase of {{< vendor/name >}}, -during which backups are provided free of charge. -In the future, you'll be able to customize your backup policy depending on your needs and budget. - -{{< /note >}} - diff --git a/sites/platform/config/_default/params.yaml b/sites/platform/config/_default/params.yaml index 3cc064a3e0..e3d29345ba 100644 --- a/sites/platform/config/_default/params.yaml +++ b/sites/platform/config/_default/params.yaml @@ -1,6 +1,6 @@ # Basics -version: "1.0.25" +version: "1.1.0" description: Platform.sh User Documentation author: Platform.sh title: User documentation @@ -20,8 +20,8 @@ vendor: active: true link: https://upsun.com/register/ cta: Get your Upsun free trial - title: Upsun Beta - description: "Access our newest offering - Upsun!

Get your free trial by clicking the link below.

" + title: Sign up for Upsun + description: "Get your free trial by clicking the link below.

" config: version: 1 dir: .platform @@ -58,7 +58,7 @@ gtm: "GTM-KRPJGT4" headerActions: headerActionPrimary: destination: https://auth.api.platform.sh/register - linkText: Free trial + linkText: Sign up headerActionSecondary: destination: https://console.platform.sh/ linkText: Log in diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index c553c372d1..e7c4c14f63 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -28,27 +28,27 @@ All service configuration happens in the `{{< vendor/configfile "services" >}}` Configure your service in the following pattern: ```yaml {configFile="services"} -{{% snippet name="SERVICE_NAME" config="service" %}} +# The name of the service container. Must be unique within a project. +SERVICE_NAME: type: {{}}:{{}} # Other options... -{{% /snippet %}} ``` An example service configuration for two databases might look like this: ```yaml {configFile="services"} -{{% snippet name="database1" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 -{{% /snippet %}} -{{% snippet name="database2" config="service" globKey="false" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: postgresql:{{% latest "postgresql" %}} disk: 1024 -{{% /snippet %}} ``` This YAML file is a dictionary defining all of the services you want to use. -The top-level key is a custom service name ({{}}; in the example, `database1` and `database2`), which you use to identify the service in step 2. +The top-level key is a custom service name ({{}}; in the example, `mariadb` and `postgresql`), which you use to identify the service in step 2. You can give it any name you want with lowercase alphanumeric characters, hyphens, and underscores. @@ -70,7 +70,7 @@ The following table presents the keys you can define for each service: | `disk` | `integer` | For some services | The size in [MB](/glossary.md#mb) of the [persistent disk](#disk) allocated to the service. Can't be set for memory-resident-only services such as `memcache` and `redis`. Limited by your plan settings. | | `size` | `string` | | How many CPU and memory [resources to allocate](#size) to the service. Possible values are `AUTO`, `S`, `M`, `L`, `XL`, `2XL`, and `4XL`. Limited by your plan settings.

When `AUTO` applies, available resources are automatically balanced out based on the number of containers on your plan, so that no container is oversized compared to the others. To view the actual sizes of your containers, check the **Environment Configuration** section in your deployment [activity logs](../increase-observability/logs/access-logs.md#activity-logs). | | `configuration` | dictionary | For some services | Some services have additional specific configuration options that can be defined here, such as specific endpoints. See the given service page for more details. | -| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](../create-apps/app-reference.md#relationships). The `endpoint_name` for apps is always `http`. | +| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). The `endpoint_name` for apps is always `http`. | ##### Disk @@ -91,45 +91,48 @@ Note that service containers in preview environments are always set to size `S`. ### 2. Connect the service Once you have configured a service, you need to create a relationship to connect it to an app. -This is done in your [app configuration for relationships](../create-apps/app-reference.md#relationships). +This is done in your [app configuration for relationships](/create-apps/app-reference/single-runtime-image.md#relationships). The relationship follows this pattern: ```yaml {configFile="app"} -{{% snippet name="" config="app" root="false"%}} - # Other options... # Relationships enable an app container's access to a service. +# The example below shows simplified configuration leveraging a default service (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - {{< variable "RELATIONSHIP_NAME" >}}: "{{< variable "SERVICE_NAME" >}}:{{< variable "ENDPOINT" >}}" -{{% /snippet %}} -{{% snippet name="SERVICE_NAME" config="service" placeholder="true"%}} - type: {{}}:{{}} - # Other options... -{{% /snippet %}} + {{}}: ``` +You can define `` as you like, so long as it's unique between all defined services +and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. +That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) +(the network address a service is accessible from) that is identical to the _name_ of that service. + +Depending on your needs, instead of default endpoint configuration, +you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + An example relationship to connect to the databases given in the [example in step 1](#1-configure-the-service): ```yaml {configFile="app"} -{{< snippet name="" config="app" root="false">}} - # Other options... -# Relationships enable an app container's to a service. +# Relationships enable an app container's access to a service. relationships: - mysql_database: "database1:mysql" - postgresql_database: "database2:postgresql" -{{% /snippet %}} -{{% snippet name="database1" config="service" placeholder="true" %}} + mariadb: + postgresql: +``` + +```yaml {configFile="services"} +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 -{{% /snippet %}} -{{% snippet name="database2" config="service" globKey="false" placeholder="true" %}} +postgresql: type: postgresql:{{% latest "postgresql" %}} disk: 1024 -{{% /snippet %}} ``` As with the service name, you can give the relationship any name you want @@ -201,17 +204,17 @@ To get the credentials for a given service, run the following command: You get output like the following: ```yaml -database: +mariadb: - username: user scheme: mysql - service: database + service: mariadb fragment: null ip: 198.51.100.37 - hostname: abcdefghijklm1234567890123.database.service._.eu.{{< vendor/urlraw "hostname" >}} + hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} public: false cluster: abcdefgh1234567-main-abcd123 - host: database.internal + host: mariadb.internal rel: mysql query: is_master: true @@ -220,10 +223,10 @@ database: type: 'mariadb:10.6' port: 3306 host_mapped: false - url: 'mysql://user:@database.internal:3306/main' + url: 'mysql://user:@mariadb.internal:3306/main' ``` -With this example, you can connect to the `database` relationship +With this example, you can connect to the `mariadb` relationship with the user `user`, an empty password, and the database name `main` (from the `path`). The `url` property shows a full database connection that can be used from your app. diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index e545d4315b..a6684f4589 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -42,7 +42,7 @@ Puppeteer can be used to generate PDFs and screenshots of web pages, automate fo "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "chromeheadlessbrowser.internal", + "host": "chromeheadless.internal", "rel": "http", "scheme": "http", "type": "chrome-headless:{{< latest "chrome-headless" >}}", @@ -103,7 +103,7 @@ Using the [Node.js Config Reader library](../development/variables/use-variables const platformsh = require('platformsh-config'); const config = platformsh.config(); -const credentials = config.credentials('chromeheadlessbrowser'); +const credentials = config.credentials('chromeheadless'); ``` and use them to define the `browserURL` parameter of `puppeteer.connect()` within an `async` function: @@ -112,7 +112,7 @@ and use them to define the `browserURL` parameter of `puppeteer.connect()` withi exports.getBrowser = async function (url) { try { // Connect to chrome-headless using pre-formatted puppeteer credentials - const formattedURL = config.formattedCredentials('chromeheadlessbrowser', 'puppeteer'); + const formattedURL = config.formattedCredentials('chromeheadless', 'puppeteer'); const browser = await puppeteer.connect({browserURL: formattedURL}); ... diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 74c27fba3f..a57129ef5f 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -65,7 +65,7 @@ See more information on [how to upgrade to version 2.3 or later](#upgrade-to-ver ```json { - "host": "influxdbdatabase.internal", + "host": "influxdb.internal", "hostname": "azertyuiopqsdfghjklm.influxdb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiopqsdf-main-bvxea6i", "service": "influxdb", @@ -93,29 +93,33 @@ See more information on [how to upgrade to version 2.3 or later](#upgrade-to-ver {{% endpoint-description type="influxdb" /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} +# The name of the app container. Must be unique within a project. +name: myapp + +[...] + # Relationships enable an app container's access to a service. relationships: - influxdbdatabase: "influxdb:influxdb" -{{% /snippet %}} -{{% snippet name="influxdb" config="service" placeholder="true" %}} + influxdb: +``` + +```yaml {configFile="services"} +influxdb: type: influxdb:{{% latest "influxdb" %}} - disk: 256 -{{% /snippet %}} ``` -{{% v2connect2app serviceName="influxdb" relationship="influxdbdatabase" var="INFLUX_HOST"%}} +{{% v2connect2app serviceName="influxdb" relationship="influxdb" var="INFLUX_HOST"%}} ```bash {location="myapp/.environment"} # Decode the built-in credentials object variable. export RELATIONSHIPS_JSON=$(echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 --decode) # Set environment variables for common InfluxDB credentials. -export INFLUX_USER=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdbdatabase[0].username") -export INFLUX_HOST=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdbdatabase[0].host") -export INFLUX_ORG=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdbdatabase[0].query.org") -export INFLUX_TOKEN=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdbdatabase[0].query.api_token") -export INFLUX_BUCKET=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdbdatabase[0].query.bucket") +export INFLUX_USER=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdb[0].username") +export INFLUX_HOST=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdb[0].host") +export INFLUX_ORG=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdb[0].query.org") +export INFLUX_TOKEN=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdb[0].query.api_token") +export INFLUX_BUCKET=$(echo $RELATIONSHIPS_JSON | jq -r ".influxdb[0].query.bucket") ``` {{% /v2connect2app %}} @@ -134,7 +138,7 @@ To export your data from InfluxDB, follow these steps: This opens an SSH tunnel to your InfluxDB service on your current environment and produces output like the following: ```bash - SSH tunnel opened to influxdbdatabase at: http://127.0.0.1:30000 + SSH tunnel opened to {{}} at: http://127.0.0.1:30000 ``` 3. Get the username, password and token from the [relationship](#relationship-reference) by running the following command: @@ -167,7 +171,7 @@ If you're relying on any other attributes connecting to InfluxDB, they remain ac ```json { - "host": "influxdbdatabase.internal", + "host": "influxdb.internal", "hostname": "azertyuiopqsdfghjklm.influxdb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiopqsdf-main-bvxea6i", "service": "influxdb", diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index 1c72c366c3..e8c0eeb495 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -41,7 +41,7 @@ It is a framework for storing, reading and analyzing streaming data. See the [Ka "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "kafkaqueue.internal", + "host": "kafka.internal", "rel": "kafka", "scheme": "kafka", "type": "kafka:{{< latest "kafka" >}}", @@ -80,7 +80,7 @@ highlight=ruby # Producer require "kafka" -kafka = Kafka.new(["kafkaqueue.internal:9092"], client_id: "my-application") +kafka = Kafka.new(["kafka.internal:9092"], client_id: "my-application") kafka.deliver_message("Hello, World!", topic: "greetings") # Consumer diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index 1bd7b2d8b3..7374bdf2e7 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -51,7 +51,7 @@ Both Memcached and Redis can be used for application caching. As a general rule, "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "memcachedcache.internal", + "host": "memcached.internal", "rel": "memcached", "scheme": "memcached", "type": "memcached:{{% latest "memcached" %}}", @@ -108,11 +108,11 @@ highlight=python ## Accessing Memcached directly To access the Memcached service directly you can use `netcat` as Memcached doesn't have a dedicated client tool. -Assuming your Memcached relationship is named `memcachedcache`, the host name and port number obtained from `{{< vendor/prefix >}}_RELATIONSHIPS` would be `memcachedcache.internal` and `11211`. +Assuming your Memcached relationship is named `memcached`, the host name and port number obtained from `{{< vendor/prefix >}}_RELATIONSHIPS` would be `memcached.internal` and `11211`.
Open an [SSH session](/development/ssh/_index.md) and access the Memcached server as follows: ```bash {location="Terminal"} -netcat memcachedcache.internal 11211 +netcat memcached.internal 11211 ``` {{% service-values-change %}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index e41d074cec..63ec4979af 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -91,7 +91,7 @@ If you want to experiment with a later version without committing to it use a pr "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "mongodbdatabase.internal", + "host": "mongodb.internal", "rel": "mongodb", "query": { "is_master": true @@ -162,13 +162,13 @@ Get the `host` from your [relationship](#relationship-reference). Then run the following command: ```bash -mongo {{< variable "MONGODBDATABASE_HOST" >}} +mongo {{< variable "MONGODB_HOST" >}} ``` With the example value, that would be the following: ```bash -mongo mongodbdatabase.internal +mongo mongodb.internal ``` {{% service-values-change %}} @@ -187,8 +187,7 @@ First, open an SSH tunnel with the {{% vendor/name %}} CLI: That opens an SSH tunnel to all services on your current environment and produce output like the following: ```bash -SSH tunnel opened on port 30000 to relationship: database -SSH tunnel opened on port 30001 to relationship: redis +SSH tunnel opened on port 30000 to relationship: mongodb ``` The port may vary in your case. diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 01774f71aa..9da1106e20 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -166,7 +166,8 @@ You can configure your MySQL service in the [services configuration](../_index.m Example configuration: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 configuration: @@ -179,7 +180,6 @@ Example configuration: main: admin properties: max_allowed_packet: 64 -{{% /snippet %}} ``` {{% relationship-ref-intro %}} @@ -198,7 +198,7 @@ Example configuration: "hostname": "azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 3306, "cluster": "azertyuiop-main-7rqtwti", - "host": "mariadbdatabase.internal", + "host": "mariadb.internal", "rel": "mysql", "path": "main", "query": { @@ -223,7 +223,7 @@ Example configuration: "hostname": "azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 3306, "cluster": "azertyuiop-main-afdwftq", - "host": "oracledatabase.internal", + "host": "oraclemysql.internal", "rel": "mysql", "path": "main", "query": { @@ -251,13 +251,13 @@ mysql -h {{< variable "HOST" >}} -P {{< variable "PORT" >}} -u {{< variable "USE Assuming the values from the [MariaDB reference](#mariadb-reference), that would be: ```bash -mysql -h mariadbdatabase.internal -P 3306 -u user main +mysql -h mariadb.internal -P 3306 -u user main ``` If your database relationship has a password, pass the `-p` switch and enter the password when prompted: ```bash -mysql -p -h mariadbdatabase.internal -P 3306 -u user main +mysql -p -h mariadb.internal -P 3306 -u user main ``` ## Define permissions @@ -290,7 +290,8 @@ You can also specify multiple `endpoints` for [permissions](#define-permissions) If neither `schemas` nor `endpoints` is included, it's equivalent to the following default: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 configuration: @@ -301,7 +302,6 @@ If neither `schemas` nor `endpoints` is included, it's equivalent to the followi default_schema: main privileges: main: admin -{{% /snippet %}} ``` If either `schemas` or `endpoints` are defined, no default is applied and you have to specify the full configuration. @@ -323,7 +323,8 @@ Access to the database is defined through three endpoints: * `importer` has SELECT/INSERT/UPDATE/DELETE (but not DDL) access to `legacy` but no access to `main`. ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 configuration: @@ -343,22 +344,20 @@ Access to the database is defined through three endpoints: default_schema: legacy privileges: legacy: rw -{{% /snippet %}} ``` Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} +name: myapp -# Other options... +[...] # Relationships enable an app container's access to a service. relationships: database: "mariadb:admin" reports: "mariadb:reporter" imports: "mariadb:importer" -{{% /snippet %}} ``` These relationships are then available in the [`{{< vendor/prefix >}}_RELATIONSHIPS` environment variable](#relationship-reference). @@ -388,7 +387,8 @@ It offers the following properties: An example of setting these properties: ```yaml {configFile="services"} -{{% snippet name="db" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 configuration: @@ -396,7 +396,6 @@ An example of setting these properties: max_allowed_packet: 64 default_charset: utf8mb4 default_collation: utf8mb4_unicode_ci -{{% /snippet %}} ``` You can also change a table's character set and collation through `ALTER TABLE` commands: diff --git a/sites/platform/src/add-services/mysql/mysql-replication.md b/sites/platform/src/add-services/mysql/mysql-replication.md index 947620d7a3..7c359dc146 100644 --- a/sites/platform/src/add-services/mysql/mysql-replication.md +++ b/sites/platform/src/add-services/mysql/mysql-replication.md @@ -18,7 +18,8 @@ To set up replication you need to create a replication-enabled user. For each database that you'd like to replicate, you need to assign a `replication` permission/role, under a corresponding `endpoint`: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} +# The name of the service container. Must be unique within a project. +mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 1024 configuration: @@ -33,7 +34,6 @@ For each database that you'd like to replicate, you need to assign a `replicatio replicator: privileges: main: replication -{{% /snippet %}} ``` This creates a `replicator` user, and grants read-only and table locking rights on the `main` database (namely `Select_priv`, `Show_view_priv`, `Create_tmp_table_priv`, `Lock_tables_priv` privileges) along with global replication rights (namely `Repl_slave_priv` and `Repl_client_priv` privileges) and flushing rights (`Reload_priv` used for flushing before reading the binary log position). If there is at least one `replication` permission defined, the bin-logging is enabled on the primary server, which is essential for the replication. @@ -44,15 +44,18 @@ Even if you won't be accessing the replication endpoint from your application, y Add a new relationship to your application container: ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} +name: myapp -# Other options... +[...] # Relationships enable an app container's access to a service. relationships: - database: mariadb:mysql - replication: mariadb:replicator -{{% /snippet %}} + database: + service: mariadb + endpoint: mysql + replication: + service: mariadb + endpoint: replicator ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/platform/src/add-services/network-storage.md b/sites/platform/src/add-services/network-storage.md index 763ce3bc4b..f4aa350257 100644 --- a/sites/platform/src/add-services/network-storage.md +++ b/sites/platform/src/add-services/network-storage.md @@ -5,7 +5,7 @@ weight: -30 {{% vendor/name %}} supports internal "storage as a service" to provide a file store that can be shared between different application containers. -The network storage service enables a new kind of [mount](../create-apps/app-reference.md#mounts) +The network storage service enables a new kind of [mount](/create-apps/app-reference/single-runtime-image.md#mounts) that refers to a shared service rather than to a local directory. Your apps can use any combination of `local` and `service` mounts. @@ -82,15 +82,15 @@ the files are shared between the two applications even if the mount location is It's also possible to have one app mount a `source_path` that's a subdirectory of another application's mount. For example: -`app1`: - ```yaml {configFile="apps"} # The name of the app container. Must be unique within a project. app1: # The location of the application's code. source: - root: "/" - ... + root: "app1" + + [...] + mounts: 'web/uploads': source: service @@ -101,8 +101,10 @@ app1: app2: # The location of the application's code. source: - root: "/" - ... + root: "app2" + + [...] + mounts: 'process': source: service @@ -121,7 +123,7 @@ and the `done` mount refers to the same directory as the `web/uploads/done` dire ## Worker instances -When defining a [worker](../create-apps/app-reference.md#workers) instance, +When defining a [worker](/create-apps/app-reference/single-runtime-image.md#workers) instance, keep in mind what mount behavior you want. `local` mounts are a separate storage area for each instance, @@ -140,6 +142,8 @@ You can then use this service to define a `network_dir` network mount and a `lo to be used by a `web` instance and a `queue` worker instance: ```yaml {configFile="app"} +name: myapp + # The type of the application to build. type: "nodejs:20" @@ -166,9 +170,6 @@ mounts: source: local source_path: my_stuff -# Define how much space is available to local mounts -disk: 512 - # Define a web instance web: locations: @@ -201,11 +202,13 @@ For example, the following `{{< vendor/configfile "app" >}}` file (fragment) kee (This assumes a Network Storage service named `files` has also been defined in `{{< vendor/configfile "services" >}}`.) ```yaml {configFile="app"} +name: myapp + # The type of the application to build. -"php:{{% latest "php" %}}" +type: "php:{{% latest "php" %}}" relationships: - mariadbdatabase: "mariadb:mysql" + mariadb: disk: 1024 diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 08798a787a..8c50c4322e 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -80,7 +80,7 @@ switch to [a supported version](#supported-versions). "hostname": "azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 9200, "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "ossearch.internal", + "host": "opensearch.internal", "rel": "opensearch", "path": null, "query": [], @@ -100,31 +100,28 @@ switch to [a supported version](#supported-versions). To use the configured service in your app, add a configuration file similar to the following to your project. ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. +name: myapp + +[...] + relationships: - ossearch: "opensearch:opensearch" -{{% /snippet %}} -{{% snippet name="opensearch" config="service" placeholder="true" %}} - type: opensearch:{{% latest "opensearch" %}} - disk: 256 -{{% /snippet %}} + opensearch: ``` -{{% v2connect2app serviceName="searchopen" relationship="searchopen" var="OPENSEARCH_HOSTS" %}} +{{% v2connect2app serviceName="opensearch" relationship="opensearch" var="OPENSEARCH_HOSTS" %}} ```bash {location="myapp/.environment"} # Decode the built-in credentials object variable. export RELATIONSHIPS_JSON=$(echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export OS_SCHEME=$(echo $RELATIONSHIPS_JSON | jq -r ".ossearch[0].scheme") -export OS_HOST=$(echo $RELATIONSHIPS_JSON | jq -r ".ossearch[0].host") -export OS_PORT=$(echo $RELATIONSHIPS_JSON | jq -r ".ossearch[0].port") +export OS_SCHEME=$(echo $RELATIONSHIPS_JSON | jq -r ".opensearch[0].scheme") +export OS_HOST=$(echo $RELATIONSHIPS_JSON | jq -r ".opensearch[0].host") +export OS_PORT=$(echo $RELATIONSHIPS_JSON | jq -r ".opensearch[0].port") # Surface more common OpenSearch connection string variables for use in app. -export OPENSEARCH_USERNAME=$(echo $RELATIONSHIPS_JSON | jq -r ".ossearch[0].username") -export OPENSEARCH_PASSWORD=$(echo $RELATIONSHIPS_JSON | jq -r ".ossearch[0].password") +export OPENSEARCH_USERNAME=$(echo $RELATIONSHIPS_JSON | jq -r ".opensearch[0].username") +export OPENSEARCH_PASSWORD=$(echo $RELATIONSHIPS_JSON | jq -r ".opensearch[0].password") export OPENSEARCH_HOSTS=[\"$OS_SCHEME://$OS_HOST:$OS_PORT\"] ``` @@ -147,35 +144,35 @@ You may optionally enable HTTP Basic authentication. To do so, include the following in your `{{< vendor/configfile "services" >}}` configuration: ```yaml {configFile="services"} -{{% snippet name="opensearch" config="service" %}} +# The name of the service container. Must be unique within a project. +opensearch: type: opensearch:{{% latest "opensearch" %}} disk: 2048 configuration: authentication: enabled: true -{{% /snippet %}} ``` That enables mandatory HTTP Basic auth on all requests. The credentials are available in any relationships that point at that service, in the `username` and `password` properties. + {{% service-values-change %}} This functionality is generally not required if OpenSearch isn't exposed on its own public HTTP route. However, certain applications may require it, or it allows you to safely expose OpenSearch directly to the web. To do so, add a route to `{{< vendor/configfile "routes" >}}` that has `opensearch:opensearch` as its upstream (where `opensearch` is whatever you named the service). + For example: ```yaml {configFile="routes"} -{{% snippet name="opensearch:opensearch" config="route" subDom="os" / %}} -{{% snippet name="opensearch" config="service" placeholder="true" %}} - type: opensearch:{{% latest "opensearch" %}} - disk: 2048 - configuration: - authentication: - enabled: true -{{% /snippet %}} +"https://www.os.{default}/": + type: redirect + to: "https://os.{default}/" +"https://os.{default}/": + type: upstream + upstream: "opensearch:opensearch" ``` ## Plugins @@ -184,14 +181,14 @@ OpenSearch offers a number of plugins. To enable them, list them under the `configuration.plugins` key in your `{{< vendor/configfile "services" >}}` file, like so: ```yaml {configFile="services"} -{{% snippet name="opensearch" config="service" %}} +# The name of the service container. Must be unique within a project. +opensearch: type: "opensearch:{{% latest "opensearch" %}}" disk: 1024 configuration: plugins: - analysis-icu - lang-python -{{% /snippet %}} ``` In this example you'd have the ICU analysis plugin and the size mapper plugin. diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index 4b1ffbb0b4..8062298f88 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -79,7 +79,7 @@ For more details, see how to [upgrade to PostgreSQL 12 with `postgis`](#upgrade- "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 5432, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "postgresqldatabase.internal", + "host": "postgresql.internal", "rel": "postgresql", "path": "main", "query": { @@ -154,7 +154,7 @@ psql -U {{< variable "USERNAME" >}} -h {{< variable "HOST" >}} -p {{< variable " Using the values from the [example](#relationship-reference), that would be: ```bash -psql -U main -h postgresqldatabase.internal -p 5432 +psql -U main -h postgresql.internal -p 5432 ``` {{% service-values-change %}} @@ -170,7 +170,7 @@ The easiest way to download all data in a PostgreSQL instance is with the {{< ve If you have multiple SQL databases it prompts you which one to export. You can also specify one by relationship name explicitly: ```bash -{{% vendor/cli %}} db:dump --relationship postgresqldatabase +{{% vendor/cli %}} db:dump --relationship postgresql ``` By default the file is uncompressed. If you want to compress it, use the `--gzip` (`-z`) option: @@ -205,7 +205,7 @@ That works for any SQL file, so the usual caveats about importing an SQL dump ap As with exporting, you can also specify a specific environment to use and a specific database relationship to use, if there are multiple. ```bash -{{% vendor/cli %}} sql --relationship postgresqldatabase -e {{< variable "BRANCH_NAME" >}} < my_database_backup.sql +{{% vendor/cli %}} sql --relationship postgresql -e {{< variable "BRANCH_NAME" >}} < my_database_backup.sql ``` {{< note >}} @@ -236,7 +236,8 @@ Under the `configuration` key of your service there are two additional keys: Consider the following illustrative example: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: "postgresql:{{% latest "postgresql" %}}" disk: 2048 configuration: @@ -256,7 +257,6 @@ Consider the following illustrative example: default_database: legacy privileges: legacy: rw -{{% /snippet %}} ``` This example creates a single PostgreSQL service named `postgresql`. The server has two databases, `main` and `legacy` with three endpoints created. @@ -270,34 +270,16 @@ If a given endpoint has access to multiple databases you should also specify whi Once these endpoints are defined, you need to expose them to your application as a relationship. Continuing with the above example, your `relationships` in `{{< vendor/configfile "app" >}}` might look like: ```yaml {configFile="app"} -{{% snippet name="false" config="app" root="false" %}} relationships: - database: "postgresql:admin" - reports: "postgresql:reporter" - imports: "postgresql:importer" -{{% /snippet %}} - -{{% snippet name="postgresql" config="service" placeholder="true" %}} - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw -{{% /snippet %}} + database: + service: postgresql + endpoint: admin + reports: + service: postgresql + endpoint: reporter + imports: + service: postgresql + endpoint: importer ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -306,7 +288,8 @@ They'll be available in the `{{< vendor/prefix >}}_RELATIONSHIPS` environment va A service configuration without the `configuration` block defined is equivalent to the following default values: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: "postgresql:{{% latest "postgresql" %}}" disk: 2048 configuration: @@ -317,26 +300,26 @@ A service configuration without the `configuration` block defined is equivalent default_database: main privileges: main: admin -{{% /snippet %}} ``` If you do not define `database` but `endpoints` are defined, then the single database `main` is created with the following assumed configuration: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: "postgresql:{{% latest "postgresql" %}}" disk: 2048 configuration: databases: - main endpoints: -{{% /snippet %}} ``` Alternatively, if you define multiple databases but no endpoints, a single user `main` is created with `admin` access to each of your databases, equivalent to the configuration below: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: "postgresql:{{% latest "postgresql" %}}" disk: 2048 configuration: @@ -349,7 +332,6 @@ Alternatively, if you define multiple databases but no endpoints, a single user firstdb: admin seconddb: admin thirddb: admin -{{% /snippet %}} ``` {{% databases-passwords %}} @@ -363,14 +345,14 @@ To change the timezone for the current session, run `SET TIME ZONE {{< variable {{% vendor/name %}} supports a number of PostgreSQL extensions. To enable them, list them under the `configuration.extensions` key in your `{{< vendor/configfile "services" >}}` file, like so: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} +# The name of the service container. Must be unique within a project. +postgresql: type: "postgresql:{{% latest "postgresql" %}}" disk: 2048 configuration: extensions: - pg_trgm - hstore -{{% /snippet %}} ``` In this case, you have `pg_trgm` installed, providing functions to determine the similarity of text based on trigram matching, and `hstore` providing a key-value store. diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index d875d3995a..79ef814be9 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -71,7 +71,7 @@ and your messages a safe place to live until they're received. "hostname": "azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 5672, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "rabbitmqqueue.internal", + "host": "rabbitmq.internal", "rel": "rabbitmq", "path": null, "query": [], @@ -184,14 +184,14 @@ which can be useful for separating resources, such as exchanges, queues, and bin To create virtual hosts, add them to your configuration as in the following example: ```yaml {configFile="services"} -{{% snippet name="rabbitmq" config="service" %}} +# The name of the service container. Must be unique within a project. +rabbitmq: type: "rabbitmq:{{% latest "rabbitmq" %}}" disk: 512 configuration: vhosts: - host1 - host2 -{{% /snippet %}} ``` ## Upgrading diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 9ab413d268..681427cd81 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -122,13 +122,22 @@ To define the relationship, use the `redis` endpoint : ```yaml {configFile="app"} # Relationships enable access from this app to a given service. +# The example below shows simplified configuration leveraging a default service +# (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - : ":redis" + : ``` -You can define `` and `` as you like, but it’s best if they’re distinct. -With this definition, the application container now has access to the service via the relationship ``. -For PHP, enable the extension for the service: +You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) (the network address a service is accessible from) that is identical to the name of that service. + +Depending on your needs, instead of default endpoint configuration, you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} # PHP extensions. @@ -152,7 +161,7 @@ redis: ```yaml {configFile="app"} relationships: - rediscache: "redis:redis" + redis: ``` ### Use in app @@ -229,13 +238,22 @@ To define the relationship, use the `redis` endpoint : ```yaml {configFile="app"} # Relationships enable access from this app to a given service. +# The example below shows simplified configuration leveraging a default service +# (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - : ":redis" + : ``` -You can define `` and `` as you like, but it’s best if they’re distinct. -With this definition, the application container now has access to the service via the relationship ``. -For PHP, enable the extension for the service: +You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) (the network address a service is accessible from) that is identical to the name of that service. + +Depending on your needs, instead of default endpoint configuration, you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} # PHP extensions. @@ -259,7 +277,7 @@ redis: ```yaml {configFile="app"} relationships: - rediscache: "redis:redis" + redis: ``` ### Use in app @@ -320,7 +338,7 @@ Use the Redis [`select` command](https://redis.io/commands/select): ```php connect(getenv('CACHE_HOST'), getenv('CACHE_PORT')); +$redis->connect(getenv('REDIS_HOST'), getenv('REDIS_PORT')); $redis->select(0); // switch to DB 0 $redis->set('x', '42'); // write 42 to x @@ -342,8 +360,8 @@ the Python library suggests using separate client instances for each database: import os from redis import Redis -database0 = Redis(host=os.getenv('CACHE_HOST'), port=os.getenv('CACHE_PORT'), db=0) -database1 = Redis(host=os.getenv('CACHE_HOST'), port=os.getenv('CACHE_PORT'), db=1) +database0 = Redis(host=os.getenv('REDIS_HOST'), port=os.getenv('REDIS_PORT'), db=0) +database1 = Redis(host=os.getenv('REDIS_HOST'), port=os.getenv('REDIS_PORT'), db=1) ``` <---> @@ -382,7 +400,7 @@ const value = await client.get('x'); // returns 42 "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 6379, "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "rediscache.internal", + "host": "redis.internal", "rel": "redis", "path": null, "query": [], @@ -402,11 +420,11 @@ it triggers a cache cleanup. To customize those cache cleanups, set up an eviction policy such as the following: ```yaml {configFile="services"} -{{% snippet name="redis" config="service" %}} +# The name of the service container. Must be unique within a project. +redis: type: "redis:{{% latest "redis" %}}" configuration: maxmemory_policy: allkeys-lfu -{{% /snippet %}} ``` The following table presents the possible values: @@ -458,18 +476,17 @@ which means Redis stores and retrieves the data saved into sessions. To set up Redis as your session handler, add a configuration similar to the following: ```yaml {configFile="services" v2Hide="true"} -{{% snippet name="data" config="service" %}} +# The name of the service container. Must be unique within a project. +redissessions: type: "redis-persistent:{{% latest "redis" %}}" disk: 256 -{{% /snippet %}} ``` ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="false" %}} type: "php:{{% latest "php" %}}" relationships: - sessionstorage: "data:redis" + redissessions: variables: php: @@ -481,10 +498,4 @@ web: '/': root: 'web' passthru: '/index.php' -{{% /snippet %}} - -{{% snippet name="data" config="service" placeholder="true" %}} - type: "redis-persistent:{{% latest "redis" %}}" - disk: 256 -{{% /snippet %}} ``` diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index a6e9a8826a..24202dc7f2 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -70,7 +70,7 @@ Solr search with generic schemas provided, and a custom schema is also supported "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 8080, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "solrsearch.internal", + "host": "solr.internal", "rel": "solr", "path": "solr\/collection1", "query": [], @@ -134,12 +134,12 @@ For Solr 4, {{% vendor/name %}} supports only a single core per server called `c You must provide your own Solr configuration via a `core_config` key in your `{{< vendor/configfile "services" >}}`: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: "solr:4.10" disk: 1024 configuration: core_config: !archive "{{< variable "DIRECTORY" >}}" -{{% /snippet %}} ``` {{< variable "DIRECTORY" >}} points to a directory in the Git repository, in or below the `{{< vendor/configdir >}}/` folder. This directory needs to contain everything that Solr needs to start a core. At the minimum, `solrconfig.xml` and `schema.xml`. @@ -147,12 +147,12 @@ You must provide your own Solr configuration via a `core_config` key in your `{{ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the `schema.xml` file is located at `{{< vendor/configdir >}}/solr/conf/schema.xml`. You can then reference that path like this - ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: "solr:4.10" disk: 1024 configuration: core_config: !archive "solr/conf/" -{{% /snippet %}} ``` ## Solr 6 and later @@ -160,7 +160,8 @@ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the ` For Solr 6 and later {{% vendor/name %}} supports multiple cores via different endpoints. Cores and endpoints are defined separately, with endpoints referencing cores. Each core may have its own configuration or share a configuration. It is best illustrated with an example. ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: solr:{{% latest "solr" %}} disk: 1024 configuration: @@ -174,7 +175,6 @@ For Solr 6 and later {{% vendor/name %}} supports multiple cores via different e core: mainindex extra: core: extraindex -{{% /snippet %}} ``` The above definition defines a single Solr {{% latest "solr" %}} server. That server has 2 cores defined: @@ -187,29 +187,19 @@ It then defines two endpoints: `main` is connected to the `mainindex` core while Each endpoint is then available in the relationships definition in `{{< vendor/configfile "app" >}}`. For example, to allow an application to talk to both of the cores defined above its configuration should contain the following: ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="false" %}} +name: myapp + type: "php:{{% latest "php" %}}" -relationships: - solrsearch1: 'solr:main' - solrsearch2: 'solr:extra' -{{% /snippet %}} +[...] -{{% snippet name="solr" config="service" placeholder="true" %}} - type: solr:{{% latest "solr" %}} - disk: 1024 - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex -{{% /snippet %}} +relationships: + solrsearch1: + service: solr + endpoint: main + solrsearch2: + service: solr + endpoint: extra ``` That is, the application's environment would include a `solrsearch1` relationship that connects to the `main` endpoint, which is the `mainindex` core, and a `solrsearch2` relationship that connects to the `extra` endpoint, which is the `extraindex` core. @@ -242,7 +232,8 @@ The relationships array would then look something like the following: For even more customizability, it's also possible to define Solr configsets. For example, the following snippet would define one configset, which would be used by all cores. Specific details can then be overridden by individual cores using `core_properties`, which is equivalent to the Solr `core.properties` file. ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: solr:8.4 disk: 1024 configuration: @@ -262,7 +253,6 @@ For even more customizability, it's also possible to define Solr configsets. For core: english_index arabic: core: arabic_index -{{% /snippet %}} ``` In this example, `{{< vendor/configdir >}}/configsets/solr8` contains the configuration definition for multiple cores. There are then two cores created: @@ -281,7 +271,8 @@ Note that not all core properties features make sense to specify in the `core_pr If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: solr:{{% latest "solr" %}} configuration: cores: @@ -290,7 +281,6 @@ If you don't specify any configuration, the following default is used: endpoints: solr: core: collection1 -{{% /snippet %}} ``` The example configuration directory is equivalent to the [Solr example configuration set](https://github.com/apache/solr/tree/main/solr/server/solr/configsets/sample_techproducts_configs/conf). @@ -302,7 +292,8 @@ You are strongly recommended to define your own configuration with a custom core If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} +# The name of the service container. Must be unique within a project. +solr: type: solr:{{% latest "solr" %}} configuration: cores: @@ -310,7 +301,6 @@ If you don't specify any configuration, the following default is used: endpoints: solr: core: collection1 -{{% /snippet %}} ``` The default configuration is based on an older version of the Drupal 8 Search API Solr module that is no longer in use. diff --git a/sites/platform/src/add-services/varnish.md b/sites/platform/src/add-services/varnish.md index 12307cb4b9..27f4156fb3 100644 --- a/sites/platform/src/add-services/varnish.md +++ b/sites/platform/src/add-services/varnish.md @@ -48,7 +48,7 @@ graph LR The `relationships` block defines the connection between Varnish and your app. You can define {{< variable "RELATIONSHIP_NAME" >}} as you like. -{{< variable "APP_NAME" >}} should match your app's `name` in the [app configuration](../create-apps/app-reference.md). +{{< variable "APP_NAME" >}} should match your app's `name` in the [app configuration](/create-apps/app-reference/single-runtime-image.md). The `configuration` block must reference a VCL file inside the `{{< vendor/configdir >}}` directory. The `path` defines the file relative to the `{{< vendor/configdir >}}` directory. @@ -114,25 +114,35 @@ your VCL templates needs logic to determine where each request is forwarded. For example, you might have the following configuration for two apps: ```yaml {configFile="services"} -{{% snippet name="varnish" config="service" %}} +varnish: type: varnish:{{% latest "varnish" %}} relationships: - blog: 'blog:http' - main: 'app:http' + blog: + service: blog + endpoint: http + main: + service: app + endpoint: http configuration: vcl: !include type: string path: config.vcl -{{% /snippet %}} -{{% snippet name="blog" config="apps" placeholder="true" root="backends/blog" %}} -# The type of the application to build. -type: "php:{{% latest "php" %}}" -{{% /snippet %}} - -{{% snippet name="app" config="apps" globKey="false" placeholder="true" root="backends/main" %}} -# The type of the application to build. -type: "nodejs:{{% latest "nodejs" %}}" -{{% /snippet %}} +``` + +```yaml {configFile="apps"} +blog: + # The location of the application's code. + source: + root: "backends/blog" + # The type of the application to build. + type: "php:{{% latest "php" %}}" + +app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" ``` You could then define that all requests to `/blog/` go to the `blog` app and all other requests to the other app: @@ -155,10 +165,11 @@ Also disable the router cache as Varnish now provides caching. To forward all incoming requests to Varnish rather than your app, you could have the following: ```yaml {configFile="routes"} -{{% snippet name="varnish:http" config="route" redirect="false" %}} -cache: - enabled: false -{{% /snippet %}} +"https://{default}/": + type: upstream + upstream: "varnish:http" + cache: + enabled: false ``` Varnish forwards requests to your app based on the specified VCL template. @@ -274,46 +285,45 @@ which provides access to some Varnish analysis and debugging tools. You can't use it from an app fronted by Varnish because of the restriction with [circular relationships](#circular-relationships). To access the stats, create a **separate app** (`stats-app`) with a relationship *to* Varnish, but not *from* it. -Define [app configuration](../create-apps/app-reference.md) similar to the following: +Define [app configuration](/create-apps/app-reference/single-runtime-image.md) similar to the following: ```yaml {configFile="apps"} -{{% snippet name="stats-app" config="apps" root="stats" %}} -# The type of the application to build. -type: "python:{{% latest "python" %}}" -# Unique relationship _to_ Varnish from 'stats-app', where no relationship -# is defined _from_ Varnish to the same app, to avoid circular relationships. -relationships: - varnishstats: "varnish:http+stats" -{{% /snippet %}} -{{% snippet name="main-app" config="apps" globKey="false" root="backends/main" %}} -# The type of the application to build. -type: "nodejs:{{% latest "nodejs" %}}" -{{% /snippet %}} -{{% snippet name="varnish" config="service" placeholder="true" %}} - type: varnish:{{% latest "varnish" %}} - # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship - # is defined _to_ Varnish to the same app, to avoid circular relationships. +# The name of the app container. Must be unique within a project. +stats-app: + # The location of the application's code. + source: + root: "stats" + # The type of the application to build. + type: "python:{{% latest "python" %}}" + # Unique relationship _to_ Varnish from 'stats-app', where no relationship + # is defined _from_ Varnish to the same app, to avoid circular relationships. relationships: - main: 'main-app:http' - configuration: - vcl: !include - type: string - path: config.vcl -{{% /snippet %}} + varnishstats: + service: varnish + endpoint: "http+stats" +# The name of the app container. Must be unique within a project. +main-app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" ``` ```yaml {configFile="services" v2Hide="true"} -{{% snippet name="varnish" config="service" %}} +# The name of the service container. Must be unique within a project. +varnish: type: varnish:{{% latest "varnish" %}} # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship # is defined _to_ Varnish to the same app, to avoid circular relationships. relationships: - main: 'app:http' + main: + service: "main-app" + endpoint: http configuration: vcl: !include type: string path: config.vcl -{{% /snippet %}} ``` @@ -330,5 +340,5 @@ To access the Varnish stats endpoint from the command line: 1. Connect to your stats app [using SSH](../development/ssh/_index.md): `{{% vendor/cli %}} ssh --app stats-app` (replace `stats-app` with the name you gave the app). -2. Display the [relationships array](../create-apps/app-reference.md#relationships) with `echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 -d | jq .`, +2. Display the [relationships array](/create-apps/app-reference/single-runtime-image.md#relationships) with `echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 -d | jq .`, 3. Query Varnish with `curl {{< variable "HOST" >}}:{{}}/stats`, replacing `{{< variable "HOST" >}}` and `{{< variable "PATH" >}}` with the values from Step 2. diff --git a/sites/platform/src/administration/cli/_index.md b/sites/platform/src/administration/cli/_index.md index 7b84af58ac..b051e48778 100644 --- a/sites/platform/src/administration/cli/_index.md +++ b/sites/platform/src/administration/cli/_index.md @@ -211,8 +211,8 @@ eval $({{% vendor/cli %}} completion) ### Run commands on your container You can use the {{% vendor/name %}} CLI to run commands on your container. -You can use any command you've added in [dependencies](../../create-apps/app-reference.md#dependencies) -or a [hook](../../create-apps/app-reference.md#hooks). +You can use any command you've added in [dependencies](/create-apps/app-reference/single-runtime-image.md#dependencies) +or a [hook](/create-apps/app-reference/single-runtime-image.md#hooks). The syntax looks like the following: diff --git a/sites/platform/src/administration/users.md b/sites/platform/src/administration/users.md index 32e3898941..0644c8598b 100644 --- a/sites/platform/src/administration/users.md +++ b/sites/platform/src/administration/users.md @@ -5,7 +5,7 @@ sidebarTitle: Users description: Manage user access and permissions across all your projects and organizations. --- -{{% vendor/name %}} offers very granular and flexible user permissions across projects and organizations. +{{% vendor/name %}} offers very granular and flexible user permissions across projects and organizations. When a user is added to a project, they are automatically added to your organization. ## Manage project access @@ -42,7 +42,7 @@ A user can have one of the following roles on an environment type which grants t | Contributor | Yes | Yes | Yes | Yes | No | No | | Viewer | Yes | No | Yes | No | No | No | -To customize which roles can use SSH, set [`access` in your app configuration](../create-apps/app-reference.md#access). +To customize which roles can use SSH, set [`access` in your app configuration](/create-apps/app-reference/single-runtime-image.md#access). ### View a user's permissions across all of the projects in your organization @@ -170,7 +170,7 @@ title=In the Console {{< /codetabs >}} To apply SSH access changes after you add a remove a user from a project or environment type, -[trigger a redeploy](../development/troubleshoot.md#force-a-redeploy). +[trigger a redeploy](../development/troubleshoot.md#force-a-redeploy). ### Remove a user from a project @@ -243,7 +243,7 @@ you can invite other users to your organization and grant them the following per Users with the **Manage users** (`members`) permission can add, edit, or remove _any_ user's permissions except their own. -Users with the **Manage billing** (`billing`) permission automatically are granted **List projects** (`projects:list`) permission. +Users with the **Manage billing** (`billing`) permission automatically are granted **List projects** (`projects:list`) permission. That is, they are able to see all organization projects once given billing rights. {{< /note >}} diff --git a/sites/platform/src/administration/web/configure-environment.md b/sites/platform/src/administration/web/configure-environment.md index a4f8efb44d..5d31b2f580 100644 --- a/sites/platform/src/administration/web/configure-environment.md +++ b/sites/platform/src/administration/web/configure-environment.md @@ -41,7 +41,7 @@ There are also additional options: * **Code** * **CLI** for the command to get your project set up locally with the [{{% vendor/name %}} CLI](../cli/_index.md). * **Git** for the command to clone the codebase via Git. - + If you're using {{% vendor/name %}} as your primary remote repository, the command clones from the project. If you have set up an [external integration](../../integrations/source/_index.md), the command clones directly from the integrated remote repository. @@ -61,7 +61,7 @@ If this message isn't updated once your [default environment](../../environments follow these steps: 1. Check that [you have defined routes](../../define-routes/_index.md) for your default environment. -2. Verify that your [application](../../create-apps/app-reference.md), [services](../../add-services/_index.md), and [routes](../../define-routes/_index.md) configurations are correct. +2. Verify that your [application](/create-apps/app-reference/single-runtime-image.md), [services](../../add-services/_index.md), and [routes](../../define-routes/_index.md) configurations are correct. 3. Check that your default environment is [active](../../environments/deactivate-environment.md#reactivate-an-environment). ## Environment settings diff --git a/sites/platform/src/create-apps/_index.md b/sites/platform/src/create-apps/_index.md index cdd75080c3..015fab179c 100644 --- a/sites/platform/src/create-apps/_index.md +++ b/sites/platform/src/create-apps/_index.md @@ -16,7 +16,7 @@ Within a single project, you can have one or more apps and each app can have mul Instances are where the same code can be run with different configurations, such as one for external communication and one for background processes. All of the apps and instances are configured with the same syntax. -You can find a [complete reference](./app-reference.md) of all possible settings. +You can find a [complete reference](/create-apps/app-reference/single-runtime-image.md) of all possible settings. ## A minimal application @@ -69,15 +69,15 @@ If you want to use one of the [databases or other services {{% vendor/name %}} p set it up by following these steps: 1. Configure the service based on the documentation for that service. -1. Use the information from that service inside your app's [`relationships` definition](./app-reference.md#relationships) +1. Use the information from that service inside your app's [`relationships` definition](/create-apps/app-reference/single-runtime-image.md#relationships) to configure how your app communicates with the service. ## Control the build and deploy process Your app generally needs to undergo some steps to be turned from the code in your Git repository into a running app. -If you're running a PHP or Node.js app, this starts with the [build flavor](./app-reference.md#build), +If you're running a PHP or Node.js app, this starts with the [build flavor](/create-apps/app-reference/single-runtime-image.md#build), which runs a default set of tasks. -Then any [global dependencies](./app-reference.md#dependencies) can be installed. +Then any [global dependencies](/create-apps/app-reference/single-runtime-image.md#dependencies) can be installed. Once these optional tasks are done, you can run [hooks](./hooks/_index.md) at various points in the process. Hooks are places for your custom scripts to control how your app is built and deployed. @@ -85,7 +85,7 @@ Hooks are places for your custom scripts to control how your app is built and de ## Configure what's served Once your app is built, it needs a defined way to communicate with the outside world. -Define its behavior with a [`web` instance](./app-reference.md#web). +Define its behavior with a [`web` instance](/create-apps/app-reference/single-runtime-image.md#web). There you can set what command runs every time your app is restarted, how dynamic requests are handled, and how to respond with static files. @@ -134,11 +134,12 @@ dependencies: php: composer/composer: '^2' -# The app's relationships (connections) with services or other applications. -# The key is the relationship name that can be viewed in the app. -# The value is specific to how the service is configured. +# Relationships enable an app container's access to a service or another app. +# The example below shows simplified configuration leveraging a default service +# (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - database: 'mysqldb:mysql' + mysql: # Scripts that are run as part of the build and deploy process. hooks: diff --git a/sites/platform/src/create-apps/app-reference/_index.md b/sites/platform/src/create-apps/app-reference/_index.md new file mode 100644 index 0000000000..c76a52b910 --- /dev/null +++ b/sites/platform/src/create-apps/app-reference/_index.md @@ -0,0 +1,32 @@ +--- +title: "App reference" +weight: 4 +description: Configure your app and control how it's built and deployed on {{% vendor/name %}}. +layout: single +--- + +To define your app, you can either use one of {{% vendor/name %}}'s [single-runtime image](/create-apps/app-reference/single-runtime-image.md) +or its [composable image (BETA)](/create-apps/app-reference/composable-image.md). + +## Single-runtime image + +{{% vendor/name %}} provides and maintains a list of single-runtime images you can use for each of your application containers.
+See [all of the options you can use](/create-apps/app-reference/single-runtime-image.md) to define your app using a single-runtime image. + +## Composable image (BETA) + +The {{% vendor/name %}} composable image provides more flexibility than single-runtime images. +When using a composable image, you can define a stack (or group of packages) for your application container to use. + +There are over 80,000 packages available from the [Nix Packages collection](https://search.nixos.org/) that you can add to your stack. +You can add as many packages to your application container as you need. + +{{% note %}} + +{{% vendor/name %}} guarantees optimal user experience with the specific [set of packages](/create-apps/app-reference/composable-image.md#supported-nix-packages) it supports. +You can use any other package available from the [Nix Packages collection](https://search.nixos.org/), including unstable ones, +but NixOs is responsible for their support. + +{{% /note %}} + +See [all of the options you can use](/create-apps/app-reference/composable-image.md) to define your app using the composable image. diff --git a/sites/platform/src/create-apps/app-reference/composable-image.md b/sites/platform/src/create-apps/app-reference/composable-image.md new file mode 100644 index 0000000000..8e32430912 --- /dev/null +++ b/sites/platform/src/create-apps/app-reference/composable-image.md @@ -0,0 +1,1137 @@ +--- +title: "Composable image" +weight: 4 +description: Use {{% vendor/name %}}'s composable image to build and deploy your app. +beta: true +banner: + title: Beta Feature + body: The {{% vendor/name %}} composable image is currently available in Beta. + This feature as well as its documentation is subject to change. +--- + +The {{% vendor/name %}} composable image provides enhanced flexibility when defining your app. +It allows you to install several runtimes and tools in your application container, +in a **"one image to rule them all"** approach. + +The composable image is built on [Nix](https://nix.dev), which offers the following benefits: + +- You can add as many packages to your application container as you need, + choosing from over 80,000 packages from [the Nixpkgs collection](https://search.nixos.org/packages). +- The packages you add are built in total isolation, so you can install different versions of the same package. +- With [Nix](https://nix.dev/reference/glossary#term-Nix), there are no undeclared dependencies in your source code. + What works on your local machine is guaranteed to work on any other machine. + +This page introduces all the settings available to configure your composable image from your `{{< vendor/configfile "app" >}}` file +(usually located at the root of your Git repository).
+Note that multi-app projects can be [set in various ways](../multi-app/_index.md). + +{{% note theme="info" title="Further resources"%}} + +For a more detailed introduction to the composable image, check out [this video](https://www.youtube.com/watch?v=emOt32DVl28).
+If you're pressed for time, jump to this comprehensive [configuration example](../_index.md#comprehensive-example). + +{{% /note %}} + +## Top-level properties + +The following table presents all the properties you can use at the top level of your app's YAML configuration file. + +The column _Set in instance?_ defines whether the given property can be overridden within a `web` or `workers` instance. +To override any part of a property, you have to provide the entire property. + +| Name | Type | Required | Set in instance? | Description | +|--------------------|-----------------------------------------------------|----------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `name` | `string` | Yes | No | A unique name for the app. Must be lowercase alphanumeric characters. Changing the name destroys data associated with the app. | +| `stack` | An array of [Nix packages](#stack) | Yes | No | A list of packages from the {{% vendor/name %}} collection of [supported runtimes](#supported-nix-packages) and/or from [Nixpkgs](https://search.nixos.org/packages). | +| `size` | A [size](#sizes) | | Yes | How much resources to devote to the app. Defaults to `AUTO` in production environments. | +| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | +| `disk` | `integer` or `null` | | Yes | The size of the disk space for the app in [MB](/glossary.md#mb). Minimum value is `128`. Defaults to `null`, meaning no disk is available. See [note on available space](#available-disk-space) | +| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. If set as a local source, `disk` is required. | +| `web` | A [web instance](#web) | | N/A | How the web application is served. | +| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | +| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](../timezone.md) | +| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | +| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | +| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | +| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | +| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | +| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | +| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | +{{% note %}} +The ``type``, ``build``, ``dependencies``, and ``runtime`` keys are only supported when using a [single-runtime image](/create-apps/app-reference/single-runtime-image.md). +They are **not** supported when using the composable image. +They are replaced by the `stack` key. +{{% /note %}} + +## Stack + +Use the ``stack`` key to define which runtimes and binaries you want to install in your application container. +Define them as a YAML array as follows: + +```yaml {configFile="apps"} +myapp: + stack: [ "@" ] + # OR + stack: + - "@" +``` + +To add a language to your stack, use the `@` format.
+To add a tool to your stack, use the `` format, as no version is needed. + +#### Primary runtime + +If you add multiple runtimes to your application container, +the first declared runtime becomes the primary runtime. +The primary runtime is the one that is automatically started. + +To start other declared runtimes, you need to start them manually, using [web commands](#web-commands). +To find out which start command to use, go to the [Languages](/languages/_index.md) section, +and visit the documentation page dedicated to your runtime. + +{{% note %}} +If you use PHP, note that PHP-FPM is only started automatically if PHP is defined as the primary runtime. +{{% /note %}} + +### Supported Nix packages + +{{% note %}} +The Nix packages listed in the following table are officially supported by {{% vendor/name %}} to provide optimal user experience.
+However, you can add any other packages from [the Nixpkgs collection](https://search.nixos.org/) to your `stack`. +This includes packages from the ``unstable`` channel, +like [FrankenPHP](https://search.nixos.org/packages?channel=unstable&show=frankenphp&from=0&size=50&sort=relevance&type=packages&query=frankenphp).
+While available for you to install, packages that aren't listed in the following table are supported by Nix itself, not {{% vendor/name %}}. +{{% /note %}} + +Depending on the Nix package, you can select only the major runtime version, +or the major and minor runtime versions as shown in the table. +Security and other patches are applied automatically. + +| **Language** | **Nix package** | **Supported version(s)** | +|----------------------------------------------|---------------|----------------------------| +| [Clojure](https://clojure.org/) | `clojure` | 1 | +| [Common Lisp (SBCL)](/languages/lisp.html) | `sbcl` | 2 | +| [Elixir](/languages/elixir.html) | `elixir` | 1.15, 1.14 | +| [Go](/languages/go.html) | `golang` | 1.22, 1.21, 1.20 | +| [Java](/languages/java.html) | `java` | 21 | +| [Javascript/Bun](https://bun.sh/) | `bun` | 1 | +| [JavaScript/Node.js](/languages/nodejs.html) | `nodejs` | 21, 20, 18 | +| [Perl](https://www.perl.org/) | `perl` | 5 | +| [PHP](/languages/php.html) | `php` | 8.3, 8.2, 8.1 | +| [Python](/languages/python.html) | `python` | 3.12, 3.11, 3.10, 3.9, 2.7 | + +**Example:** + +You want to add PHP version {{% latest php %}} and ``facedetect`` to your application container. +To do so, use the following configuration: + +```yaml {configFile="apps"} +myapp: + stack: [ "php@{{% latest php %}}", "facedetect" ] + # OR + stack: + - "php@{{% latest php %}}" + - "facedetect" +``` + +### PHP extensions and Python packages + +When you add PHP or Python to your application container, +you can define which extensions (for PHP) or packages (for Python) you also want to add to your stack. + +To find out which extensions you can install with your runtime, +follow these steps: + +1. Go to the [NixOS search](https://search.nixos.org/). +2. Enter a runtime and click **Search**. +3. In the **Package sets** side bar, select the right set of extensions/packages for your runtime version.
+ You can choose the desired extensions/packages from the filtered results. + +![Screenshot of the Nix package sets selection for PHP@8.3](/images/nixos/nixos-packages.png "0.5") + +#### Install PHP extensions + +To enable [PHP extensions](/languages/php/extensions.md), +specify a list of `extensions` below the language definition.
+To disable [PHP extensions](/languages/php/extensions.md), +specify a list of `disabled_extensions` below the language definition.
+For instance: + +```yaml {configFile="apps"} +myapp: + source: + root: "/" + stack: + - "php@{{% latest "php" %}}": + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + disabled_extensions: + - gd +``` + +{{% note %}} +To help you find out the name of the PHP package you want to use, +some maintainers provide a ``PHP upstream extension`` value in the [NixOS search engine](https://search.nixos.org/packages?channel=unstable&show=php82Extensions.gd). + +![Screenshot of an upstream extension value shown in the NixOS search](/images/nixos/nixossearch-upstream-value.png "0.5") + +If this information is not provided, note that PHP package names on NixOS always respect the ``Extensions.`` format.
+Therefore, you can copy the ```` as shown in the NixOS search results, and use it in your configuration. + +{{% /note %}} + +Note that you can use environment variables or your `php.ini` file to [include further configuration options](/languages/php/_index.md#customize-php-settings) for your PHP extensions. + +#### Install Python packages + +To install Python packages, add them to your stack as new packages. +To do so, use the full name of the package. + +For instance, to install [``python312Packages.yq``](https://search.nixos.org/packages?channel=unstable&show=python312Packages.yq), +use the following configuration: + +```yaml {configFile="apps"} +myapp: + stack: + - "python@3.12" + - "python312Packages.yq" # python package specific +``` + +Alternatively, if you need to include configuration options for your extensions, use either your ``php.ini`` file or [environment variables](/development/variables/set-variables.md). + +### Example configuration + +Here is a full composable image configuration example. Note the use of the `@` format. + +```yaml {configFile="apps"} +myapp: + stack: + - "php@{{% latest "php" %}}" + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "python@3.12" + - "python312Packages.yq" # python package specific + - "yq" # tool +``` + +### Combine single-runtime and composable images + +In a [multiple application context](/create-apps/multi-app/_index.md), +you can use a mix of [single-runtime images](/create-apps/app-reference/single-runtime-image.md) +and [composable images](/create-apps/app-reference/composable-image.md). +Here is an example configuration including a ``frontend`` app and a ``backend`` app: + +```yaml {configFile="apps"} +app1: + stack: + - "php@{{% latest "php" %}}" + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "python@3.12" + - "python312Packages.yq" # python package specific +app2: + type: 'nodejs:{{% latest "nodejs" %}} +``` + +{{% note %}} +If you add multiple runtimes to your application container, +the first declared runtime becomes the primary runtime. +The primary runtime is the one that is automatically started. + +To start other declared runtimes, you need to start them manually, using [web commands](#web-commands). +To find out which start command to use, go to the [Languages](/languages/_index.md) section, +and visit the documentation page dedicated to your language. + +If you use PHP, note that PHP-FPM is only started automatically if PHP is defined as the primary runtime. +{{% /note %}} + +## Sizes + +Resources are distributed across all containers in an environment from the total available from your [plan size](/administration/pricing/_index.md). +So if you have more than just a single app, it doesn't get all of the resources available. +Each environment has its own resources and there are different [sizing rules for preview environments](#sizes-in-preview-environments). + +By default, resource sizes (CPU and memory) are chosen automatically for an app +based on the plan size and the number of other containers in the cluster. +Most of the time, this automatic sizing is enough. + +You can set sizing suggestions for production environments when you know a given container has specific needs. +Such as a worker that doesn't need much and can free up resources for other apps. +To do so, set `size` to one of the following values: + +- `S` +- `M` +- `L` +- `XL` +- `2XL` +- `4XL` + +The total resources allocated across all apps and services can't exceed what's in your plan. + +### Sizes in preview environments + +Containers in preview environments don't follow the `size` specification. +Application containers are set based on the plan's setting for **Environments application size**. +The default is size **S**, but you can increase it by editing your plan. +(Service containers in preview environments are always set to size **S**.) + +## Relationships + +To access another container within your project, you need to define a relationship to it. + +![Relationships Diagram](/images/management-console/relationships.png "0.5") + +You can give each relationship any name you want. +This name is used in the `PLATFORM_RELATIONSHIPS` environment variable, +which gives you credentials for accessing the service. + +The relationship is specified in the form `service_name:endpoint_name`. +The `service_name` is the name of the service given in the [services configuration](/add-services/_index.md) +or the name of another application in the same project specified as the `name` in that app's configration. + +The `endpoint_name` is the exposed functionality of the service to use. +For most services, the endpoint is the same as the service type. +For some services (such as [MariaDB](/add-services/mysql/_index.md#multiple-databases) and [Solr](/add-services/solr.md#solr-6-and-later)), +you can define additional explicit endpoints for multiple databases and cores in the [service's configuration](/add-services/_index.md). + +The following example shows a single MySQL service named `mysqldb` offering two databases, +a Redis cache service named `rediscache`, and an Elasticsearch service named `searchserver`. + +```yaml {configFile="app"} +relationships: + database: 'mysqldb:db1' + database2: 'mysqldb:db2' + cache: 'rediscache:redis' + search: 'searchserver:elasticsearch' +``` + +## Available disk space + +The maximum total space available to all apps and services is set by the storage in your plan settings. +When deploying your project, the sum of all `disk` keys defined in app and service configurations +must be *equal or less* than the plan storage size. + +So if your *plan storage size* is 5 GB, you can, for example, assign it in one of the following ways: + +- 2 GB to your app, 3 GB to your database +- 1 GB to your app, 4 GB to your database +- 1 GB to your app, 1 GB to your database, 3 GB to your OpenSearch service + +If you exceed the total space available, you receive an error on pushing your code. +You need to either increase your plan's storage or decrease the `disk` values you've assigned. + +{{% disk-space-mb %}} + +### Downsize a disk + +{{% disk-downsize type="app" %}} + +## Mounts + +After your app is built, its file system is read-only. +To make changes to your app's code, you need to use Git. + +For enhanced flexibility, {{% vendor/name %}} allows you to define and use writable directories called "mounts". +Mounts give you write access to files generated by your app (such as cache and log files) +and uploaded files without going through Git. + +When you define a mount, you are mounting an external directory to your app container, +much like you would plug a hard drive into your computer to transfer data. + +{{% note %}} + +- Mounts aren't available during the build +- When you [back up an environment](/environments/backup.md), the mounts on that environment are backed up too + +{{% /note %}} + +### Define a mount + +To define a mount, use the following configuration: + +```yaml {configFile="app"} +mounts: + '{{< variable "MOUNT_PATH" >}}': + source: {{< variable "MOUNT_TYPE" >}} + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} +``` + +{{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). +If you already have a directory with that name, you get a warning that it isn't accessible after the build. +See how to [troubleshoot the warning](../troubleshoot-mounts.md#overlapping-folders). + +| Name | Type | Required | Description | +| ------------- |-------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `source` | `local`, `service`, or `tmp` | Yes | Specifies the type of the mount:

- `local` mounts are unique to your app. They can be useful to store files that remain local to the app instance, such as application logs.
`local` mounts require disk space. To successfully set up a local mount, set the `disk` key in your app configuration.

- `service` mounts point to [Network Storage](/add-services/network-storage.md) services that can be shared between several apps.

- `tmp` mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**. | +| `source_path` | `string` | No | Specifies where the mount points **inside the [external directory](#mounts)**.

- If you explicitly set a `source_path`, your mount points to a specific subdirectory in the external directory.

- If the `source_path` is an empty string (`""`), your mount points to the entire external directory.

- If you don't define a `source_path`, {{% vendor/name %}} uses the {{< variable "MOUNT_PATH" >}} as default value, without leading or trailing slashes.
For example, if your mount lives in the `/web/uploads/` directory in your app container, it will point to a directory named `web/uploads` in the external directory.

**WARNING:** Changing the name of your mount affects the `source_path` when it's undefined. See [how to ensure continuity](#ensure-continuity-when-changing-the-name-of-your-mount) and maintain access to your files. | +| `service` | `string` | | Only for `service` mounts: the name of the [Network Storage service](/add-services/network-storage.md). | + + +The accessibility to the web of a mounted directory depends on the [`web.locations` configuration](#web). +Files can be all public, all private, or with different rules for different paths and file types. + +Note that when you remove a `local` mount from your `{{< vendor/configfile "app" >}}` file, +the mounted directory isn't deleted. +The files still exist on disk until manually removed +(or until the app container is moved to another host during a maintenance operation in the case of a `tmp` mount). + +### Example configuration + +```yaml {configFile="app"} +mounts: + 'web/uploads': + source: local + source_path: uploads + '/.tmp_platformsh': + source: tmp + source_path: files/.tmp_platformsh + '/build': + source: local + source_path: files/build + '/.cache': + source: tmp + source_path: files/.cache + '/node_modules/.cache': + source: tmp + source_path: files/node_modules/.cache +``` + +For examples of how to set up a `service` mount, see the dedicated [Network Storage page](/add-services/network-storage.md). + +### Ensure continuity when changing the name of your mount + +Changing the name of your mount affects the default `source_path`. + +Say you have a `/my/cache/` mount with an undefined `source_path`: + +```yaml {configFile="app"} +mounts: + '/my/cache/': + source: tmp +``` + +If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. + +To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading or trailing slashes: + + ```yaml {configFile="app"} +mounts: + '/cache/files/': + source: tmp + source_path: my/cache +``` + +The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing files in that directory. + +## Web + +Use the `web` key to configure the web server running in front of your app. + +| Name | Type | Required | Description | +|-------------|--------------------------------------------|-------------------------------|------------------------------------------------------| +| `commands` | A [web commands dictionary](#web-commands) | See [note](#required-command) | The command to launch your app. | +| `upstream` | An [upstream dictionary](#upstream) | | How the front server connects to your app. | +| `locations` | A [locations dictionary](#locations) | | How the app container responds to incoming requests. | + +See some [examples of how to configure what's served](../web/_index.md). + +### Web commands + +| Name | Type | Required | Description | +|-------------|----------|-------------------------------|-----------------------------------------------------------------------------------------------------| +| `pre_start` | `string` | | Command run just prior to `start`, which can be useful when you need to run _per-instance_ actions. | +| `start` | `string` | See [note](#required-command) | The command to launch your app. If it terminates, it's restarted immediately. | + +Example: + +```yaml {configFile="app"} +web: + commands: + start: 'uwsgi --ini conf/server.ini' +``` + +This command runs every time your app is restarted, regardless of whether or not new code is deployed. + +{{< note >}} + +Never "background" a start process using `&`. +That's interpreted as the command terminating and the supervisor process starts a second copy, +creating an infinite loop until the container crashes. +Just run it as normal and allow the {{% vendor/name %}} supervisor to manage it. + +{{< /note >}} + +#### Required command + +On all containers other than PHP, the value for `start` should be treated as required. + +On PHP containers, it's optional and defaults to starting PHP-FPM (`/usr/bin/start-php-app`). +It can also be set explicitly on a PHP container to run a dedicated process, +such as [React PHP](https://github.com/platformsh-examples/platformsh-example-reactphp) +or [Amp](https://github.com/platformsh-examples/platformsh-example-amphp). +See how to set up [alternate start commands on PHP](/languages/php/_index.md#alternate-start-commands). + +### Upstream + +| Name | Type | Required | Description | Default | +|-----------------|---------------------|----------|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [primary runtimes](#primary-runtime) except PHP; for PHP the default is `unix`. | +| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on the [primary runtimes](#primary-runtime). | + +For PHP, the defaults are configured for PHP-FPM and shouldn't need adjustment. +For all other containers, the default for `protocol` is `http`. + +The following example is the default on non-PHP containers: + +```yaml {configFile="app"} +web: + upstream: + socket_family: tcp + protocol: http +``` + +#### Where to listen + +Where to listen depends on your setting for `web.upstream.socket_family` (defaults to `tcp`). + +| `socket_family` | Where to listen | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------| +| `tcp` | The port specified by the [`PORT` environment variable](/development/variables/use-variables.md#use-provided-variables) | +| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](/development/variables/use-variables.md#use-provided-variables) | + +If your application isn't listening at the same place that the runtime is sending requests, +you see `502 Bad Gateway` errors when you try to connect to your website. + +### Locations + +Each key in the `locations` dictionary is a path on your site with a leading `/`. +For `example.com`, a `/` matches `example.com/` and `/admin` matches `example.com/admin`. +When multiple keys match an incoming request, the most-specific applies. + +The following table presents possible properties for each location: + +| Name | Type | Default | Description | +|---------------------|------------------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `root` | `string` | | The directory to serve static assets for this location relative to the app's root directory ([see `source.root`](#source)). Must be an actual directory inside the root directory. | +| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered. | +| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | +| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | +| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | +| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | +| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | +| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | +| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | + +#### Rules + +The rules dictionary can override most other keys according to a regular expression. +The key of each item is a regular expression to match paths exactly. +If an incoming request matches the rule, it's handled by the properties under the rule, +overriding any conflicting rules from the rest of the `locations` dictionary. + +Under `rules`, you can set all of the other possible [`locations` properties](#locations) +except `root`, `index` and `request_buffering`. + +In the following example, the `allow` key disallows requests for static files anywhere in the site. +This is overridden by a rule that explicitly allows common image file formats. + +```yaml {configFile="app"} +web: + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/index.php' + # Disallow static files + allow: false + rules: + # Allow common image files only. + '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': + allow: true +``` + +#### Request buffering + +Request buffering is enabled by default to handle chunked requests as most app servers don't support them. +The following table shows the keys in the `request_buffering` dictionary: + +| Name | Type | Required | Default | Description | +|--------------------|-----------|----------|---------|-------------------------------------------| +| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | +| `max_request_size` | `string` | | `250m` | The maximum size to allow in one request. | + +The default configuration would look like this: + +```yaml {configFile="app"} +web: + locations: + '/': + passthru: true + request_buffering: + enabled: true + max_request_size: 250m +``` + +## Workers + +Workers are exact copies of the code and compilation output as a `web` instance after a [`build` hook](#hooks). +They use the same container image. + +Workers can't accept public requests and so are suitable only for background tasks. +If they exit, they're automatically restarted. + +The keys of the `workers` definition are the names of the workers. +You can then define how each worker differs from the `web` instance using +the [top-level properties](#top-level-properties). + +Each worker can differ from the `web` instance in all properties _except_ for: + +- `build` and `dependencies` properties, which must be the same +- `crons` as cron jobs don't run on workers +- `hooks` as the `build` hook must be the same + and the `deploy` and `post_deploy` hooks don't run on workers. + +A worker named `queue` that was small and had a different start command could look like this: + +```yaml {configFile="app"} +workers: + queue: + size: S + commands: + start: | + ./worker.sh +``` + +For resource allocation, using workers in your project requires a [{{< partial "plans/multiapp-plan-name" >}} plan or larger](https://platform.sh/pricing/). + +## Access + +The `access` dictionary has one allowed key: + +| Name | Allowed values | Default | Description | +|-------|-------------------------------------|---------------|-----------------------------------------------------------------------| +| `ssh` | `admin`, `contributor`, or `viewer` | `contributor` | Defines the minimum role required to access app environments via SSH. | + +In the following example, only users with `admin` permissions for the +given [environment type](/administration/users.md#environment-type-roles) +can access the deployed environment via SSH: + +```yaml {configFile="app"} +access: + ssh: admin +``` + +## Variables + +{{% vendor/name %}} provides a number of ways to set [variables](/development/variables/_index.md). +Variables set in your app configuration have the lowest precedence, +meaning they're overridden by any conflicting values provided elsewhere. + +All variables set in your app configuration must have a prefix. +Some [prefixes have specific meanings](/development/variables/_index.md#variable-prefixes). + +Variables with the prefix `env` are available as a separate environment variable. +All other variables are available in +the [`PLATFORM_VARIABLES` environment variable](/development/variables/use-variables.md#use-provided-variables). + +The following example sets two variables: + +- A variable named `env:AUTHOR` with the value `Juan` that's available in the environment as `AUTHOR` +- A variable named `d8config:system.site:name` with the value `My site rocks` + that's available in the `PLATFORM_VARIABLES` environment variable + +```yaml {configFile="app"} +variables: + env: + AUTHOR: 'Juan' + d8config: + "system.site:name": 'My site rocks' +``` + +You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). + +## Firewall + +{{< premium-features/tiered "Elite and Enterprise" >}} + +Set limits in outbound traffic from your app with no impact on inbound requests. + +The `outbound` key is required and contains one or more rules. +The rules define what traffic is allowed; anything unspecified is blocked. + +Each rule has the following properties where at least one is required and `ips` and `domains` can't be specified +together: + +| Name | Type | Default | Description | +|-----------|---------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | +| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | +| `ports` | Array of `integer`s | | Ports from 1 to 65535 that are allowed. If any ports are specified, all unspecified ports are blocked. If no ports are specified, all ports are allowed. Port `25`, the SMTP port for sending email, is always blocked. | + +The default settings would look like this: + +```yaml {configFile="app"} +firewall: + outbound: + - ips: [ "0.0.0.0/0" ] +``` + +### Support for rules + +Where outbound rules for firewalls are supported in all environments. +For {{% names/dedicated-gen-2 %}} projects, contact support for configuration. + +### Multiple rules + +Multiple firewall rules can be specified. +In such cases, a given outbound request is allowed if it matches _any_ of the defined rules. + +So in the following example requests to any IP on port 80 are allowed +and requests to 1.2.3.4 on either port 80 or 443 are allowed: + +```yaml {configFile="app"} +firewall: + outbound: + - ips: [ "1.2.3.4/32" ] + ports: [ 443 ] + - ports: [ 80 ] +``` + +### Outbound traffic to CDNs + +Be aware that many services are behind a content delivery network (CDN). +For most CDNs, routing is done via domain name, not IP address, +so thousands of domain names may share the same public IP addresses at the CDN. +If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that +CDN. + +### Outbound traffic by domain + +You can filter outbound traffic by domain. +Using domains in your rules rather than IP addresses is generally more specific and secure. +For example, if you use an IP address for a service with a CDN, +you have to allow the IP address for the CDN. +This means that you allow potentially hundreds or thousands of other servers also using the CDN. + +An example rule filtering by domain: + +```yaml {configFile="app"} +firewall: + outbound: + - protocol: tcp + domains: ["api.stripe.com", "api.twilio.com"] + ports: [80, 443] + - protocol: tcp + ips: ["1.2.3.4/29","2.3.4.5"] + ports: [22] +``` + +#### Determine which domains to allow + +To determine which domains to include in your filtering rules, +find the domains your site has requested the DNS to resolve. +Run the following command to parse your server’s `dns.log` file +and display all Fully Qualified Domain Names that have been requested: + +```bash +awk '/query\[[^P]\]/ { print $6 | "sort -u" }' /var/log/dns.log +``` + +The output includes all DNS requests that were made, including those blocked by your filtering rules. +It doesn't include any requests made using an IP address. + +Example output: + +```bash +facebook.com +fastly.com +platform.sh +www.google.com +www.platform.sh +``` + +## Build + +The only property of the `build` dictionary is `flavor`, which specifies a default set of build tasks to run. +Flavors are language-specific. + +See what the build flavor is for your language: + +- [Node.js](/languages/nodejs/_index.md#dependencies) +- [PHP](/languages/php/_index.md#dependencies) + +In all languages, you can also specify a flavor of `none` to take no action at all +(which is the default for any language other than PHP and Node.js). + +```yaml {configFile="app"} +build: + flavor: none +``` +## Dependencies + +Installs global dependencies as part of the build process. +They're independent of your app's dependencies +and are available in the `PATH` during the build process and in the runtime environment. +They're installed before the `build` hook runs using a package manager for the language. + +| Language | Key name | Package manager | +| -------- | --------------------- |--------------------------------------------------------------------------------------------------------------------| +| PHP | `php` | [Composer](https://getcomposer.org/) | +| Python 2 | `python` or `python2` | [Pip 2](https://packaging.python.org/tutorials/installing-packages/) | +| Python 3 | `python3` | [Pip 3](https://packaging.python.org/tutorials/installing-packages/) | +| Ruby | `ruby` | [Bundler](https://bundler.io/) | +| Node.js | `nodejs` | [npm](https://www.npmjs.com/) (see [how to use yarn](/languages/nodejs/_index.md#use-yarn-as-a-package-manager)) | +| Java | `java` | [Apache Maven](https://maven.apache.org/), [Gradle](https://gradle.org/), or [Apache Ant](https://ant.apache.org/) | + +The format for package names and version constraints are defined by the specific package manager. + +An example of dependencies in multiple languages: + +```yaml {configFile="app"} +dependencies: + php: # Specify one Composer package per line. + drush/drush: '8.0.0' + composer/composer: '^2' + python2: # Specify one Python 2 package per line. + behave: '*' + requests: '*' + python3: # Specify one Python 3 package per line. + numpy: '*' + ruby: # Specify one Bundler package per line. + sass: '3.4.7' + nodejs: # Specify one NPM package per line. + pm2: '^4.5.0' +``` +## Hooks + +There are three different hooks that run as part of the process of building and deploying your app. +These are places where you can run custom scripts. +They are: the `build` hook, the `deploy` hook, and the `post_deploy` hook. +Only the `build` hook is run for [worker instances](#workers), while [web instances](#web) run all three. + +The process is ordered as: + +1. Variables accessible at build time become available. +1. [Build flavor](#build) runs if applicable. +1. Any [dependencies](#dependencies) are installed. +1. The `build` hook is run. +1. The file system is changed to read only (except for any [mounts](#mounts)). +1. The app container starts. Variables accessible at runtime and services become available. +1. The `deploy` hook is run. +1. The app container begins accepting requests. +1. The `post_deploy` hook is run. + +Note that if an environment changes by no code changes, only the last step is run. +If you want the entire process to run, see how to [manually trigger builds](/development/troubleshoot.md#manually-trigger-builds). + +### Writable directories during build + +During the `build` hook, there are three writeable directories: + +- `PLATFORM_APP_DIR`: + Where your code is checked out and the working directory when the `build` hook starts. + Becomes the app that gets deployed. +- `PLATFORM_CACHE_DIR`: + Persists between builds, but isn't deployed. + Shared by all builds on all branches. +- `/tmp`: + Isn't deployed and is wiped between each build. + Note that `PLATFORM_CACHE_DIR` is mapped to `/tmp` + and together they offer about 8GB of free space. + +### Hook failure + +Each hook is executed as a single script, so they're considered to have failed only if the final command in them fails. +To cause them to fail on the first failed command, add `set -e` to the beginning of the hook. + +If a `build` hook fails for any reason, the build is aborted and the deploy doesn't happen. +Note that this only works for `build` hooks -- +if other hooks fail, the app is still deployed. + +#### Automated testing + +It’s preferable that you set up and run automated tests in a dedicated CI/CD tool. +Relying on {{% vendor/name %}} hooks for such tasks can prove difficult. + +During the `build` hook, you can halt the deployment on a test failure but the following limitations apply: + +- Access to services such as databases, Redis, Vault KMS, and even writable mounts is disabled. + So any testing that relies on it is sure to fail. +- If you haven’t made changes to your app, an existing build image is reused and the build hook isn’t run. +- Test results are written into your app container, so they might get exposed to a third party. + +During the `deploy` hook, you can access services but **you can’t halt the deployment based on a test failure**. +Note that there are other downsides: + +- Your app container is read-only during the deploy hook, + so if your tests need to write reports and other information, you need to create a file mount for them. +- Your app can only be deployed once the deploy hook has been completed. + Therefore, running automated testing via the deploy hook generates slower deployments. +- Your environment isn’t available externally during the deploy hook. + Unit and integration testing might work without the environment being available, + but you can’t typically perform end-to-end testing until after the environment is up and available. + +## Crons + +The keys of the `crons` definition are the names of the cron jobs. +The names must be unique. + +If an application defines both a `web` instance and `worker` instances, cron jobs run only on the `web` instance. + +See how to [get cron logs](/increase-observability/logs/access-logs.md#container-logs). + +The following table shows the properties for each job: + +| Name | Type | Required | Description | +|--------------------|----------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `spec` | `string` | Yes | The [cron specification](https://en.wikipedia.org/wiki/Cron#Cron_expression). To prevent competition for resources that might hurt performance, use `H` in definitions to indicate an unspecified but invariant time. For example, instead of using `0 * * * *` to indicate the cron job runs at the start of every hour, you can use `H * * * *` to indicate it runs every hour, but not necessarily at the start. This prevents multiple cron jobs from trying to start at the same time. | +| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | +| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | +| `timeout` | `integer` | No | The maximum amount of time a cron can run before it's terminated. Defaults to the maximum allowed value of `86400` seconds (24 hours). | + +Note that you can [cancel pending or running crons](/environments/cancel-activity.md). + +### Cron commands + +| Name | Type | Required | Description | +|---------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `start` | `string` | Yes | The command that's run. It's run in [Dash](https://en.wikipedia.org/wiki/Almquist_shell). | +| `stop` | `string` | No | The command that's issued to give the cron command a chance to shutdown gracefully, such as to finish an active item in a list of tasks. Issued when a cron task is interrupted by a user through the CLI or Console. If not specified, a `SIGTERM` signal is sent to the process. | + +```yaml {configFile="app"} +crons: + mycommand: + spec: 'H * * * *' + commands: + start: sleep 60 && echo sleep-60-finished && date + stop: killall sleep + shutdown_timeout: 18 +``` + +In this example configuration, the [cron specification](#crons) uses the `H` syntax. + +Note that this syntax is only supported on Grid and {{% names/dedicated-gen-3 %}} projects. +On {{% names/dedicated-gen-2 %}} projects, use the [standard cron syntax](https://en.wikipedia.org/wiki/Cron#Cron_expression). + +### Example cron jobs + + +{{< codetabs >}} + ++++ +title=Drupal ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Run Drupal's cron tasks every 19 minutes. + drupal: + spec: '*/19 * * * *' + commands: + start: 'cd web ; drush core-cron' + # But also run pending queue tasks every 7 minutes. + # Use an odd number to avoid running at the same time as the `drupal` cron. + drush-queue: + spec: '*/7 * * * *' + commands: + start: 'cd web ; drush queue-run aggregator_feeds' +{{< /snippet >}} +``` + +<---> + ++++ +title=Ruby on Rails ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "ruby@{{% latest ruby %}}" ] +crons: + # Execute a rake script every 19 minutes. + ruby: + spec: '*/19 * * * *' + commands: + start: 'bundle exec rake some:task' +{{< /snippet >}} +``` + +<---> + ++++ +title=Laravel ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Run Laravel's scheduler every 5 minutes. + scheduler: + spec: '*/5 * * * *' + cmd: 'php artisan schedule:run' +{{< /snippet >}} +``` + +<---> + ++++ +title=Symfony ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Take a backup of the environment every day at 5:00 AM. + snapshot: + spec: 0 5 * * * + cmd: | + # Only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi +{{< /snippet >}} +``` + +{{< /codetabs >}} + + +### Conditional crons + +If you want to set up customized cron schedules depending on the environment type, +define conditional crons. +To do so, use a configuration similar to the following: + +```yaml {configFile="app"} +crons: + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi +``` + +### Cron job timing + +Minimum time between cron jobs being triggered: + +| Plan | Time | +|-------------------- | --------- | +| Professional | 5 minutes | +| Elite or Enterprise | 1 minute | + +For each app container, only one cron job can run at a time. +If a new job is triggered while another is running, the new job is paused until the other completes. + +To minimize conflicts, a random offset is applied to all triggers. +The offset is a random number of seconds up to 20 minutes or the cron frequency, whichever is smaller. + +Crons are also paused while activities such as [backups](/environments/backup) are running. +The crons are queued to run after the other activity finishes. + +To run cron jobs in a timezone other than UTC, set the [timezone property](#top-level-properties). + +### Paused crons + +[Preview environments](/glossary.md#preview-environment) are often used for a limited time and then abandoned. +While it's useful for environments under active development to have scheduled tasks, +unused environments don't need to run cron jobs. +To minimize unnecessary resource use, +crons on environments with no deployments are paused. + +This affects all environments that aren't live environments. +This means all environments on Development plans +and all preview environments on higher plans. + +Such environments with deployments within 14 days have crons with the status `running`. +If there haven't been any deployments within 14 days, the status is `paused`. + +You can see the status in the Console +or using the CLI by running `{{% vendor/cli %}} environment:info` and looking under `deployment_state`. + +#### Restarting paused crons + +If the crons on your preview environment are paused but you're still using them, +you can push changes to the environment or redeploy it. + +To restart crons without changing anything: + +{{< codetabs >}} + ++++ +title=In the Console ++++ + +1. In the Console, navigate to your project. +1. Open the environment where you'd like the crons to run. +1. Click `Redeploy` next to the cron status of `Paused`. + +<---> + ++++ +title=Using the CLI ++++ + +Run the following command: + +```bash +{{% vendor/cli %}} redeploy +``` + +{{< /codetabs >}} + +### Sizing hints + +The following table shows the properties that can be set in `sizing_hints`: + +| Name | Type | Default | Minimum | Description | +|-------------------|-----------|---------|---------|------------------------------------------------| +| `request_memory` | `integer` | 45 | 10 | The average memory consumed per request in MB. | +| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | + +See more about [PHP-FPM workers and sizing](/languages/php/fpm.md). + +{{% note title="TODO" %}} +Not sure if applicable. +{{% /note %}} + +## Source + +The following table shows the properties that can be set in `source`: + +| Name | Type | Required | Description | +|--------------|--------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------| +| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](../source-operations.md) | +| `root` | `string` | | The path where the app code lives. Defaults to the root project directory. Useful for [multi-app setups](../multi-app/_index.md). | + +## Additional hosts + +If you're using a private network with specific IP addresses you need to connect to, +you might want to map those addresses to hostnames to better remember and organize them. +In such cases, you can add a map of those IP addresses to whatever hostnames you like. +Then when your app tries to access the hostname, it's sent to the proper IP address. + +So in the following example, if your app tries to access `api.example.com`, it's sent to `192.0.2.23`. + +```yaml {configFile="app"} +additional_hosts: + api.example.com: "192.0.2.23" + web.example.com: "203.0.113.42" +``` + +This is equivalent to adding the mapping to the `/etc/hosts` file for the container. diff --git a/sites/platform/src/create-apps/app-reference.md b/sites/platform/src/create-apps/app-reference/single-runtime-image.md similarity index 53% rename from sites/platform/src/create-apps/app-reference.md rename to sites/platform/src/create-apps/app-reference/single-runtime-image.md index 6e3c2a4dbb..5025e9f667 100644 --- a/sites/platform/src/create-apps/app-reference.md +++ b/sites/platform/src/create-apps/app-reference/single-runtime-image.md @@ -1,5 +1,5 @@ --- -title: "App reference" +title: "Single-runtime image" weight: 4 description: See all of the options for controlling your apps and how they're built and deployed on {{% vendor/name %}}. --- @@ -8,12 +8,11 @@ description: See all of the options for controlling your apps and how they're bu For single-app projects, the configuration is all done in a `{{< vendor/configfile "app" >}}` file, usually located at the root of your app folder in your Git repository. -[Multi-app projects](./multi-app/_index.md) can be set up in various ways. +[Multi-app projects](../multi-app/_index.md) can be set up in various ways. +See a [comprehensive example](../_index.md#comprehensive-example) of a configuration in a `{{< vendor/configfile "app" >}}` file. -See a [comprehensive example](./_index.md#comprehensive-example) of a configuration in a `{{< vendor/configfile "app" >}}` file. - -For reference, see a [log of changes to app configuration](./upgrading.md). +For reference, see a [log of changes to app configuration](../upgrading.md). ## Top-level properties @@ -23,38 +22,46 @@ The column _Set in instance?_ defines whether the given property can be overridd To override any part of a property, you have to provide the entire property. -| Name | Type | Required | Set in instance? | Description | -| ------------------ | --------------------------------------------------- | -------- | ---------------- | ----------- | -| `name` | `string` | Yes | No | A unique name for the app. Must be lowercase alphanumeric characters. Changing the name destroys data associated with the app. | -| `type` | A [type](#types) | Yes | No | The base image to use with a specific app language. Format: `runtime:version`. | -| `size` | A [size](#sizes) | | Yes | How much resources to devote to the app. Defaults to `AUTO` in production environments. | -| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | -| `disk` | `integer` or `null` | | Yes | The size of the disk space for the app in [MB](/glossary.md#mb). Minimum value is `128`. Defaults to `null`, meaning no disk is available. See [note on available space](#available-disk-space) | -| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. If set as a local source, `disk` is required. | -| `web` | A [web instance](#web) | | N/A | How the web application is served. | -| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | -| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](./timezone.md) | -| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | -| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | -| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | -| `build` | A [build dictionary](#build) | | No | What happens when the app is built. | -| `dependencies` | A [dependencies dictionary](#dependencies) | | No | What global dependencies to install before the `build` hook is run. | -| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | -| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | -| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | -| `runtime` | A [runtime dictionary](#runtime) | | No | Customizations to your PHP or Lisp runtime. | -| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | +| Name | Type | Required | Set in instance? | Description | +| ------------------ | --------------------------------------------------- | -------- | ---------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `name` | `string` | Yes | No | A unique name for the app. Must be lowercase alphanumeric characters. Changing the name destroys data associated with the app. | +| `type` | A [type](#types) | Yes | No | The base image to use with a specific app language. Format: `runtime:version`. | +| `size` | A [size](#sizes) | | Yes | How much resources to devote to the app. Defaults to `AUTO` in production environments. | +| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | +| `disk` | `integer` or `null` | | Yes | The size of the disk space for the app in [MB](/glossary.md#mb). Minimum value is `128`. Defaults to `null`, meaning no disk is available. See [note on available space](#available-disk-space) | +| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. If set as a local source, `disk` is required. | +| `web` | A [web instance](#web) | | N/A | How the web application is served. | +| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | +| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](../timezone.md) | +| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | +| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | +| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | +| `build` | A [build dictionary](#build) | | No | What happens when the app is built. | +| `dependencies` | A [dependencies dictionary](#dependencies) | | No | What global dependencies to install before the `build` hook is run. | +| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | +| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | +| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | +| `runtime` | A [runtime dictionary](#runtime) | | No | Customizations to your PHP or Lisp runtime. | +| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | ## Root directory Some of the properties you can define are relative to your app's root directory. The root defaults to the location of your `{{< vendor/configfile "app" >}}` file. -To specify another directory, for example for a [multi-app project](./multi-app/_index.md), +That is, if a custom value for `source.root` is not provided in your configuration, the default behavior is equivalent to the above. + +To specify another directory, for example for a [multi-app project](../multi-app/_index.md), use the [`source.root` property](#source). ## Types +{{% note theme="info" %}} +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +If you've reached this section from another page, you may be interested in supported `stacks` where `type` was referenced. +See [supported Nix packages for the `stack` key](/create-apps/app-reference/composable-image#supported-nix-packages) for more information. +{{% /note %}} + The `type` defines the base container image used to run the application. The version is the major (`X`) and sometimes minor (`X.Y`) version numbers, depending on the service, as in the following table. @@ -74,7 +81,7 @@ type: 'php:{{% latest "php" %}}' ## Sizes -Resources are distributed across all containers in an environment from the total available from your [plan size](../administration/pricing/_index.md). +Resources are distributed across all containers in an environment from the total available from your [plan size](/administration/pricing/_index.md). So if you have more than just a single app, it doesn't get all of the resources available. Each environment has its own resources and there are different [sizing rules for preview environments](#sizes-in-preview-environments). @@ -104,34 +111,181 @@ The default is size **S**, but you can increase it by editing your plan. ## Relationships -To access another container within your project, you need to define a relationship to it. +To allow containers in your project to communicate with one another, +you need to define relationships between them. +You can define a relationship between an app and a service, or [between two apps](/create-apps/multi-app/relationships.md). + +The quickest way to define a relationship between your app and a service +is to use the service's default endpoint.
+However, some services allow you to define multiple databases, cores, and/or permissions. +In these cases, you can't rely on default endpoints. +Instead, you can explicitly define multiple endpoints when setting up your relationships. + +{{< note >}} +App containers don't have a default endpoint like services. +To connect your app to another app in your project, +you need to explicitly define the `http` endpoint as the endpoint to connect both apps.
+For more information, see how to [define relationships between your apps](/create-apps/multi-app/relationships.md). +{{< /note >}} + +{{< note title="Availability" theme="info">}} + +New syntax (default and explicit endpoints) described below is supported by most, but not all, image types +(`Relationship 'SERVICE_NAME' of application 'app' ... targets a service without a valid default endpoint configuration.`). +This syntax is currently being rolled out for all images. +If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. + +{{< /note >}} + +To define a relationship between your app and a service: + +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +Use the following configuration: + +```yaml {configFile="app"} +relationships: + {{% variable "SERVICE_NAME" %}}: +``` + +The `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). +It is used as the relationship name, and associated with a `null` value. +This instructs {{% vendor/name %}} to use the service's default endpoint to connect your app to the service. + +For example, if you define the following configuration: + +```yaml {configFile="app"} +relationships: + mariadb: +``` + +{{% vendor/name %}} looks for a service named `mariadb` in your `{{% vendor/configfile "services" %}}` file, +and connects your app to it through the service's default endpoint. + +For reference, the equivalent configuration using explicit endpoints would be the following: + +```yaml {configFile="app"} +relationships: + mariadb: + service: mariadb + endpoint: mysql +``` + +You can define any number of relationships in this way: + +```yaml {configFile="app"} +relationships: + mariadb: + redis: + elasticsearch: +``` + +{{< note title="Tip" theme="info" >}} + +An even quicker way to define many relationships is to use the following single-line configuration: + +```yaml {configFile="app"} +relationships: {{{< variable "SERVICE_NAME_A" >}}, {{< variable "SERVICE_NAME_B" >}}, {{< variable "SERVICE_NAME_C" >}}} +``` + +where + +```yaml {configFile="services"} +{{< variable "SERVICE_NAME_A" >}}: + type: mariadb:{{% latest "mariadb" %}} + disk: 256 +{{< variable "SERVICE_NAME_B" >}}: + type: redis:{{% latest "redis" %}} + disk: 256 +{{< variable "SERVICE_NAME_C" >}}: + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 256 +``` + +{{< /note >}} + +<---> -![Relationships Diagram](/images/management-console/relationships.png "0.5") ++++ +title=Using explicit endpoints ++++ -You can give each relationship any name you want. -This name is used in the `PLATFORM_RELATIONSHIPS` environment variable, -which gives you credentials for accessing the service. +Use the following configuration: -The relationship is specified in the form `service_name:endpoint_name`. -The `service_name` is the name of the service given in the [services configuration](../add-services/_index.md) -or the name of another application in the same project specified as the `name` in that app's configration. +```yaml {configFile="app"} +relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} +``` -The `endpoint_name` is the exposed functionality of the service to use. -For most services, the endpoint is the same as the service type. -For some services (such as [MariaDB](../add-services/mysql/_index.md#multiple-databases) and [Solr](../add-services/solr.md#solr-6-and-later)), -you can define additional explicit endpoints for multiple databases and cores in the [service's configuration](../add-services/_index.md). +- `RELATIONSHIP_NAME` is the name you want to give to the relationship. +- `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). +- `ENDPOINT_NAME` is the endpoint your app will use to connect to the service (refer to the service reference to know which value to use). -The following example shows a single MySQL service named `mysqldb` offering two databases, -a Redis cache service named `rediscache`, and an Elasticsearch service named `searchserver`. +For example, to define a relationship named `database` that connects your app to a service called `mariadb` through the `db1` endpoint, +use the following configuration: ```yaml {configFile="app"} relationships: - database: 'mysqldb:db1' - database2: 'mysqldb:db2' - cache: 'rediscache:redis' - search: 'searchserver:elasticsearch' + database: # The name of the relationship. + service: mariadb + endpoint: db1 ``` +For more information on how to handle multiple databases, multiple cores, +and/or different permissions with services that support such features, +see each service's dedicated page: + + - [MariaDB/MySQL](/add-services/mysql/_index.md#multiple-databases) (multiple databases and permissions) + - [PostgreSQL](/add-services/postgresql/_index.md#multiple-databases) (multiple databases and permissions) + - [Redis](/add-services/redis/_index.md#multiple-databases) (multiple databases) + - [Solr](add-services/solr/_index.md#solr-6-and-later) (multiple cores) + - [Vault KMS](add-services/vault/_index.md#multiple-endpoints-example) (multiple permissions) + + You can add as many relationships as you want to your app configuration, + using both default and explicit endpoints according to your needs: + +```yaml {configFile="app"} +relationships: + database1: + service: mariadb + endpoint: admin + database2: + service: mariadb + endpoint: legacy + cache: + service: redis + search: + service: elasticsearch +``` + +{{< /codetabs >}} + +{{< note theme="info" title="Legacy" >}} + +The following legacy syntax for specifying relationships is still supported by {{% vendor/name %}}: + +```yaml +relationships: + : ":" +``` + +For example: + +```yaml +relationships: + database: "mariadb:mysql" +``` + +Feel free to use this until the default and explicit endpoint syntax is supported on all images. + +{{< /note >}} + ## Available disk space The maximum total space available to all apps and services is set by the storage in your plan settings. @@ -183,17 +337,15 @@ mounts: source_path: {{< variable "SOURCE_PATH_LOCATION" >}} ``` - - {{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). If you already have a directory with that name, you get a warning that it isn't accessible after the build. -See how to [troubleshoot the warning](./troubleshoot-mounts.md#overlapping-folders). +See how to [troubleshoot the warning](/troubleshoot-mounts.md#overlapping-folders). -| Name | Type | Required | Description | -| ------------- | -------------------- | -------- | ----------- | -| `source` | `local`, `service`, or `tmp` | Yes | Specifies the type of the mount:

- `local` mounts are unique to your app. They can be useful to store files that remain local to the app instance, such as application logs.
`local` mounts require disk space. To successfully set up a local mount, set the `disk` key in your app configuration.

- `service` mounts point to [Network Storage](add-services/network-storage.md) services that can be shared between several apps.

- `tmp` mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**. | -| `source_path` | `string` | No | Specifies where the mount points **inside the [external directory](#mounts)**.

- If you explicitly set a `source_path`, your mount points to a specific subdirectory in the external directory.

- If the `source_path` is an empty string (`""`), your mount points to the entire external directory.

- If you don't define a `source_path`, {{% vendor/name %}} uses the {{< variable "MOUNT_PATH" >}} as default value, without leading or trailing slashes.
For example, if your mount lives in the `/web/uploads/` directory in your app container, it will point to a directory named `web/uploads` in the external directory.

**WARNING:** Changing the name of your mount affects the `source_path` when it's undefined. See [how to ensure continuity](#ensure-continuity-when-changing-the-name-of-your-mount) and maintain access to your files. | -| `service` | `string` | | Only for `service` mounts: the name of the [Network Storage service](../add-services/network-storage.md). | +| Name | Type | Required | Description | +| ------------- |-------------------------------| -------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `source` | `local`, `service`, or `tmp` | Yes | Specifies the type of the mount:

- `local` mounts are unique to your app. They can be useful to store files that remain local to the app instance, such as application logs.
`local` mounts require disk space. To successfully set up a local mount, set the `disk` key in your app configuration.

- `service` mounts point to [Network Storage](/add-services/network-storage.md) services that can be shared between several apps.

- `tmp` mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**. | +| `source_path` | `string` | No | Specifies where the mount points **inside the [external directory](#mounts)**.

- If you explicitly set a `source_path`, your mount points to a specific subdirectory in the external directory.

- If the `source_path` is an empty string (`""`), your mount points to the entire external directory.

- If you don't define a `source_path`, {{% vendor/name %}} uses the {{< variable "MOUNT_PATH" >}} as default value, without leading or trailing slashes.
For example, if your mount lives in the `/web/uploads/` directory in your app container, it will point to a directory named `web/uploads` in the external directory.

**WARNING:** Changing the name of your mount affects the `source_path` when it's undefined. See [how to ensure continuity](#ensure-continuity-when-changing-the-name-of-your-mount) and maintain access to your files. | +| `service` | `string` | | Only for `service` mounts: the name of the [Network Storage service](/add-services/network-storage.md). | The accessibility to the web of a mounted directory depends on the [`web.locations` configuration](#web). @@ -239,9 +391,9 @@ mounts: source: tmp ``` - If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. +If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. - To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading or trailing slashes: +To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading or trailing slashes: ```yaml {configFile="app"} mounts: @@ -263,7 +415,7 @@ Defaults may vary with a different [image `type`](#types). | `upstream` | An [upstream dictionary](#upstream) | | How the front server connects to your app. | | `locations` | A [locations dictionary](#locations) | | How the app container responds to incoming requests. | -See some [examples of how to configure what's served](./web/_index.md). +See some [examples of how to configure what's served](../web/_index.md). ### Web commands @@ -300,14 +452,14 @@ On PHP containers, it's optional and defaults to starting PHP-FPM (`/usr/bin/sta It can also be set explicitly on a PHP container to run a dedicated process, such as [React PHP](https://github.com/platformsh-examples/platformsh-example-reactphp) or [Amp](https://github.com/platformsh-examples/platformsh-example-amphp). -See how to set up [alternate start commands on PHP](../languages/php/_index.md#alternate-start-commands). +See how to set up [alternate start commands on PHP](/languages/php/_index.md#alternate-start-commands). ### Upstream -| Name | Type | Required | Description | Default | -| --------------- | ------------------- | -------- | ----------- | ----------- | -| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [image types](#types) except PHP; for PHP image types the default is `unix`. | -| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on [image `type`](#types). | +| Name | Type | Required | Description | Default | +| --------------- |---------------------| -------- |-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [image types](#types) except PHP; for PHP image types the default is `unix`. | +| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on [image `type`](#types). | For PHP, the defaults are configured for PHP-FPM and shouldn't need adjustment. For all other containers, the default for `protocol` is `http`. @@ -324,10 +476,10 @@ web: Where to listen depends on your setting for `web.upstream.socket_family` (defaults to `tcp`). -| `socket_family` | Where to listen | -| --------------- | --------------- | -| `tcp` | The port specified by the [`PORT` environment variable](../development/variables/use-variables.md#use-provided-variables) | -| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](../development/variables/use-variables.md#use-provided-variables) | +| `socket_family` | Where to listen | +|------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| `tcp` | The port specified by the [`PORT` environment variable](/development/variables/use-variables.md#use-provided-variables) | +| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](/development/variables/use-variables.md#use-provided-variables) | If your application isn't listening at the same place that the runtime is sending requests, you see `502 Bad Gateway` errors when you try to connect to your website. @@ -340,17 +492,17 @@ When multiple keys match an incoming request, the most-specific applies. The following table presents possible properties for each location: -| Name | Type | Default | Description | -| ------------------- | ---------------------------------------------------- | --------- | ----------- | -| `root` | `string` | | The directory to serve static assets for this location relative to the [app's root directory](#root-directory). Must be an actual directory inside the root directory. | -| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered.| -| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | -| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | -| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | -| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | -| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | -| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | -| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | +| Name | Type | Default | Description | +| ------------------- | ---------------------------------------------------- |------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `root` | `string` | | The directory to serve static assets for this location relative to the [app's root directory](#root-directory). Must be an actual directory inside the root directory. | +| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered. | +| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | +| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | +| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | +| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | +| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | +| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | +| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | #### Rules @@ -384,9 +536,9 @@ web: Request buffering is enabled by default to handle chunked requests as most app servers don't support them. The following table shows the keys in the `request_buffering` dictionary: -| Name | Type | Required | Default | Description | -| ------------------ | --------- | -------- | ------- | ----------- | -| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | +| Name | Type | Required | Default | Description | +| ------------------ | --------- |----------| ------- |-------------------------------------------| +| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | | `max_request_size` | `string` | | `250m` | The maximum size to allow in one request. | The default configuration would look like this: @@ -409,7 +561,8 @@ Workers can't accept public requests and so are suitable only for background tas If they exit, they're automatically restarted. The keys of the `workers` definition are the names of the workers. -You can then define how each worker differs from the `web` instance using the [top-level properties](#top-level-properties). +You can then define how each worker differs from the `web` instance using +the [top-level properties](#top-level-properties). Each worker can differ from the `web` instance in all properties _except_ for: @@ -439,7 +592,7 @@ The `access` dictionary has one allowed key: | ----- | ----------------------------------- | ------------- | ----------- | | `ssh` | `admin`, `contributor`, or `viewer` | `contributor` | Defines the minimum role required to access app environments via SSH. | -In the following example, only users with `admin` permissions for the given [environment type](../administration/users.md#environment-type-roles) +In the following example, only users with `admin` permissions for the given [environment type](/administration/users.md#environment-type-roles) can access the deployed environment via SSH: ```yaml {configFile="app"} @@ -448,15 +601,15 @@ access: ``` ## Variables -{{% vendor/name %}} provides a number of ways to set [variables](../development/variables/_index.md). +{{% vendor/name %}} provides a number of ways to set [variables](/development/variables/_index.md). Variables set in your app configuration have the lowest precedence, meaning they're overridden by any conflicting values provided elsewhere. All variables set in your app configuration must have a prefix. -Some [prefixes have specific meanings](../development/variables/_index.md#variable-prefixes). +Some [prefixes have specific meanings](/development/variables/_index.md#variable-prefixes). Variables with the prefix `env` are available as a separate environment variable. -All other variables are available in the [`PLATFORM_VARIABLES` environment variable](../development/variables/use-variables.md#use-provided-variables). +All other variables are available in the [`PLATFORM_VARIABLES` environment variable](/development/variables/use-variables.md#use-provided-variables). The following example sets two variables: @@ -471,7 +624,8 @@ variables: d8config: "system.site:name": 'My site rocks' ``` -You can also define and access more [complex values](../development/variables/use-variables.md#access-complex-values). + +You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). ## Firewall @@ -484,10 +638,10 @@ The rules define what traffic is allowed; anything unspecified is blocked. Each rule has the following properties where at least one is required and `ips` and `domains` can't be specified together: -| Name | Type | Default | Description | -| --------- | ------------------- | --------------- | ----------- | -| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | -| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | +| Name | Type | Default | Description | +| --------- |---------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | +| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | | `ports` | Array of `integer`s | | Ports from 1 to 65535 that are allowed. If any ports are specified, all unspecified ports are blocked. If no ports are specified, all ports are allowed. Port `25`, the SMTP port for sending email, is always blocked. | The default settings would look like this: @@ -497,6 +651,7 @@ firewall: outbound: - ips: ["0.0.0.0/0"] ``` + ### Support for rules Where outbound rules for firewalls are supported in all environments. @@ -523,7 +678,8 @@ firewall: Be aware that many services are behind a content delivery network (CDN). For most CDNs, routing is done via domain name, not IP address, so thousands of domain names may share the same public IP addresses at the CDN. -If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that CDN. +If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that +CDN. ### Outbound traffic by domain @@ -576,8 +732,8 @@ Flavors are language-specific. See what the build flavor is for your language: -- [Node.js](../languages/nodejs/_index.md#dependencies) -- [PHP](../languages/php/_index.md#dependencies) +- [Node.js](/languages/nodejs/_index.md#dependencies) +- [PHP](/languages/php/_index.md#dependencies) In all languages, you can also specify a flavor of `none` to take no action at all (which is the default for any language other than PHP and Node.js). @@ -593,13 +749,13 @@ They're independent of your app's dependencies and are available in the `PATH` during the build process and in the runtime environment. They're installed before the `build` hook runs using a package manager for the language. -| Language | Key name | Package manager | -| -------- | --------------------- | --------------- | -| PHP | `php` | [Composer](https://getcomposer.org/) | -| Python 2 | `python` or `python2` | [Pip 2](https://packaging.python.org/tutorials/installing-packages/) | -| Python 3 | `python3` | [Pip 3](https://packaging.python.org/tutorials/installing-packages/) | -| Ruby | `ruby` | [Bundler](https://bundler.io/) | -| Node.js | `nodejs` | [npm](https://www.npmjs.com/) (see [how to use yarn](../languages/nodejs/_index.md#use-yarn-as-a-package-manager))| +| Language | Key name | Package manager | +|----------|-----------------------|--------------------------------------------------------------------------------------------------------------------| +| PHP | `php` | [Composer](https://getcomposer.org/) | +| Python 2 | `python` or `python2` | [Pip 2](https://packaging.python.org/tutorials/installing-packages/) | +| Python 3 | `python3` | [Pip 3](https://packaging.python.org/tutorials/installing-packages/) | +| Ruby | `ruby` | [Bundler](https://bundler.io/) | +| Node.js | `nodejs` | [npm](https://www.npmjs.com/) (see [how to use yarn](/languages/nodejs/_index.md#use-yarn-as-a-package-manager)) | | Java | `java` | [Apache Maven](https://maven.apache.org/), [Gradle](https://gradle.org/), or [Apache Ant](https://ant.apache.org/) | The format for package names and version constraints are defined by the specific package manager. @@ -621,6 +777,7 @@ dependencies: nodejs: # Specify one NPM package per line. pm2: '^4.5.0' ``` + ## Hooks There are three different hooks that run as part of the process of building and deploying your app. @@ -641,7 +798,8 @@ The process is ordered as: 1. The `post_deploy` hook is run. Note that if an environment changes by no code changes, only the last step is run. -If you want the entire process to run, see how to [manually trigger builds](../development/troubleshoot.md#manually-trigger-builds). +If you want the entire process to run, see how +to [manually trigger builds](/development/troubleshoot.md#manually-trigger-builds). ### Writable directories during build @@ -697,18 +855,18 @@ The names must be unique. If an application defines both a `web` instance and `worker` instances, cron jobs run only on the `web` instance. -See how to [get cron logs](../increase-observability/logs/access-logs.md#container-logs). +See how to [get cron logs](/increase-observability/logs/access-logs.md#container-logs). The following table shows the properties for each job: -| Name | Type | Required | Description | -| ------------------ | -------------------------------------------- | -------- | ----------- | -| `spec` | `string` | Yes | The [cron specification](https://en.wikipedia.org/wiki/Cron#Cron_expression). To prevent competition for resources that might hurt performance, on **Grid or {{% names/dedicated-gen-3 %}}** projects use `H` in definitions to indicate an unspecified but invariant time. For example, instead of using `0 * * * *` to indicate the cron job runs at the start of every hour, you can use `H * * * *` to indicate it runs every hour, but not necessarily at the start. This prevents multiple cron jobs from trying to start at the same time. **The `H` syntax isn't available on {{% names/dedicated-gen-2 %}} projects.**| -| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | -| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | +| Name | Type | Required | Description | +| ------------------ | -------------------------------------------- | -------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `spec` | `string` | Yes | The [cron specification](https://en.wikipedia.org/wiki/Cron#Cron_expression). To prevent competition for resources that might hurt performance, on **Grid or {{% names/dedicated-gen-3 %}}** projects use `H` in definitions to indicate an unspecified but invariant time. For example, instead of using `0 * * * *` to indicate the cron job runs at the start of every hour, you can use `H * * * *` to indicate it runs every hour, but not necessarily at the start. This prevents multiple cron jobs from trying to start at the same time. **The `H` syntax isn't available on {{% names/dedicated-gen-2 %}} projects.** | +| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | +| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | | `timeout` | `integer` | No | The maximum amount of time a cron can run before it's terminated. Defaults to the maximum allowed value of `86400` seconds (24 hours). -Note that you can [cancel pending or running crons](../environments/cancel-activity.md). +Note that you can [cancel pending or running crons](/environments/cancel-activity.md). ### Cron commands @@ -825,14 +983,14 @@ To do so, use a configuration similar to the following: ```yaml {configFile="app"} crons: - update: - spec: '0 0 * * *' - commands: - start: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - {{% vendor/cli %}} backup:create --yes --no-wait - {{% vendor/cli %}} source-operation:run update --no-wait --yes - fi + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi ``` ### Cron job timing @@ -843,8 +1001,6 @@ Minimum time between cron jobs being triggered: | Professional | 5 minutes | | Elite or Enterprise | 1 minute | - - For each app container, only one cron job can run at a time. If a new job is triggered while another is running, the new job is paused until the other completes. @@ -909,20 +1065,26 @@ Run the following command: The following table presents the various possible modifications to your PHP or Lisp runtime: -| Name | Type | Language | Description | -| --------------------------- | ---------------------------------------------------------- | -------- | ----------- | -| `extensions` | List of `string`s OR [extensions definitions](#extensions) | PHP | [PHP extensions](../languages/php/extensions.md) to enable. | -| `disabled_extensions` | List of `string`s | PHP | [PHP extensions](../languages/php/extensions.md) to disable. | +| Name | Type | Language | Description | +|-----------------------------|------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------| +| `extensions` | List of `string`s OR [extensions definitions](#extensions) | PHP | [PHP extensions](/languages/php/extensions.md) to enable. | +| `disabled_extensions` | List of `string`s | PHP | [PHP extensions](/languages/php/extensions.md) to disable. | | `request_terminate_timeout` | `integer` | PHP | The timeout for serving a single request after which the PHP-FPM worker process is killed. | -| `sizing_hints` | A [sizing hints definition](#sizing-hints) | PHP | The assumptions for setting the number of workers in your PHP-FPM runtime. | -| `xdebug` | An Xdebug definition | PHP | The setting to turn on [Xdebug](../languages/php/xdebug.md). | -| `quicklisp` | Distribution definitions | Lisp | [Distributions for QuickLisp](../languages/lisp.md#quicklisp-options) to use. | +| `sizing_hints` | A [sizing hints definition](#sizing-hints) | PHP | The assumptions for setting the number of workers in your PHP-FPM runtime. | +| `xdebug` | An Xdebug definition | PHP | The setting to turn on [Xdebug](/languages/php/xdebug.md). | +| `quicklisp` | Distribution definitions | Lisp | [Distributions for QuickLisp](/languages/lisp.md#quicklisp-options) to use. | -You can also set your [app's runtime timezone](../create-apps/timezone.md). +You can also set your [app's runtime timezone](/create-apps/timezone.md). ### Extensions -You can enable [PHP extensions](../languages/php/extensions.md) just with a list of extensions: +{{% note theme="info" %}} +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +If you've reached this section from another page and are using the composable image, enabling/disabling extensions should be placed under the `stack` key instead of what is listed below. +See [how to configure extensions with the composable image](/create-apps/app-reference/composable-image#top-level-properties). +{{% /note %}} + +You can enable [PHP extensions](/languages/php/extensions.md) just with a list of extensions: ```yaml {configFile="app"} runtime: @@ -930,6 +1092,7 @@ runtime: - geoip - tidy ``` + Alternatively, if you need to include configuration options, use a dictionary for that extension: ```yaml {configFile="app"} @@ -948,22 +1111,22 @@ In this case, the `name` property is required. The following table shows the properties that can be set in `sizing_hints`: -| Name | Type | Default | Minimum | Description | -| ----------------- | --------- | ------- | ------- | ----------- | +| Name | Type | Default | Minimum | Description | +|-------------------|-----------|---------|---------|------------------------------------------------| | `request_memory` | `integer` | 45 | 10 | The average memory consumed per request in MB. | -| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | +| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | -See more about [PHP-FPM workers and sizing](../languages/php/fpm.md). +See more about [PHP-FPM workers and sizing](/languages/php/fpm.md). ## Source The following table shows the properties that can be set in `source`: -| Name | Type | Required | Description | -| ------------ | ------------------------ | -------- | ----------- | -| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](./source-operations.md) | -| `root` | `string` | | The path where the app code lives. Defaults to the directory of the `{{< vendor/configfile "app" >}}` file. Useful for [multi-app setups](./multi-app/_index.md). | +| Name | Type | Required | Description | +| ------------ | ------------------------ | -------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](../source-operations.md) | +| `root` | `string` | | The path where the app code lives. Defaults to the directory of the `{{< vendor/configfile "app" >}}` file. Useful for [multi-app setups](../multi-app/_index.md). | ## Additional hosts @@ -976,8 +1139,8 @@ So in the following example, if your app tries to access `api.example.com`, it's ```yaml {configFile="app"} additional_hosts: - api.example.com: "192.0.2.23" - web.example.com: "203.0.113.42" + api.example.com: "192.0.2.23" + web.example.com: "203.0.113.42" ``` This is equivalent to adding the mapping to the `/etc/hosts` file for the container. diff --git a/sites/platform/src/create-apps/hooks/_index.md b/sites/platform/src/create-apps/hooks/_index.md index 28b9d9409d..7e30ac1f62 100644 --- a/sites/platform/src/create-apps/hooks/_index.md +++ b/sites/platform/src/create-apps/hooks/_index.md @@ -2,6 +2,7 @@ title: Use build and deploy hooks description: Add custom scripts at different stages in the build and deploy process. layout: single +weight: 13 --- As your app goes through the [build and deploy process](/learn/overview/build-deploy.md), @@ -33,7 +34,7 @@ In this case, the app has two sets of dependencies: Create your `build` hook to install them all: -1. Create a `build` hook in your [app configuration](../app-reference.md): +1. Create a `build` hook in your [app configuration](/create-apps/app-reference/single-runtime-image.md): ```yaml {configfile="app" dir="client" } hooks: @@ -66,7 +67,7 @@ Create your `build` hook to install them all: Copy the files in this directory into a `client/platformsh-scripts/test` directory. This script debugs the connection between Next.js and Drupal. 4. In the hook, switch to the directory with the testing script. - Each hook starts in the [app root](../app-reference.md#root-directory). + Each hook starts in the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). In this case, the app root is `client`. To run commands from a different directory, you need to change directories (relative to the app root): @@ -112,12 +113,12 @@ Because these steps should be done before the site accepts request, they should All of this configuration and preparation can be handled in a bash script. -1. Copy the [preparation script from the Platform.sh template](https://github.com/platformsh-templates/nextjs-drupal/blob/master/api/platformsh-scripts/hooks.deploy.sh) +1. Copy the [preparation script from the {{% vendor/name %}} template](https://github.com/platformsh-templates/nextjs-drupal/blob/master/api/platformsh-scripts/hooks.deploy.sh) into a file called `hooks.deploy.sh` in a `api/platformsh-scripts` directory. Note that hooks are executed using the dash shell, not the bash shell used by SSH logins. 2. Copy the [Drush configuration script from the template](https://github.com/platformsh-templates/nextjs-drupal/blob/master/api/drush/platformsh_generate_drush_yml.php) into a `drush/platformsh_generate_drush_yml.php` file. -3. Set a [mount](../app-reference.md#mounts). +3. Set a [mount](/create-apps/app-reference/single-runtime-image.md#mounts). Unlike in the `build` hook, in the `deploy` hook the system is generally read-only. So create a mount where you can write the Drush configuration: @@ -163,7 +164,7 @@ So you don't have to rebuild Drupal but you still get fresh content. api: 'api:http' ``` -2. Set [mounts](../app-reference.md#mounts). +2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). Like the [`deploy` hook](#configure-drush-and-drupal), the `post_deploy` hook has a read-only file system. Create mounts for your Next.js files: diff --git a/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md b/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md index 37015eaa99..d67cc8138e 100644 --- a/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md +++ b/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md @@ -5,7 +5,7 @@ description: Manage dependencies for your hooks, such as compiling Sass files as If you use a specific package in a hook, you may want to manage dependencies for it. For example, you may want to compile Sass files as part of your build process. -You can set dependencies along with hooks in your [app configuration](../app-reference.md#dependencies). +You can set dependencies along with hooks in your [app configuration](/create-apps/app-reference/single-runtime-image.md#dependencies). The following example assumes you have some Sass source files, such as a `index.scss` file. You also need a script to compile the files, such as the following: diff --git a/sites/platform/src/create-apps/hooks/hooks-comparison.md b/sites/platform/src/create-apps/hooks/hooks-comparison.md index 5123185ee6..f8096ee769 100644 --- a/sites/platform/src/create-apps/hooks/hooks-comparison.md +++ b/sites/platform/src/create-apps/hooks/hooks-comparison.md @@ -8,15 +8,15 @@ The following table presents the main differences among the three available hook | Hook name | Failures stop build | Variables available | Services available | Timeout | Run on `worker` instances | Writable directories | Blocks requests | Runs on all redeploys\* | | ------------- | ------------------- |-------------------- | ------------------ | ------- | ------------------------- | -------------------- | --------------- | --------------- | | `build` | Yes | Build variables | No | 1 hour | Yes | `$PLATFORM_APP_DIR`, `$PLATFORM_CACHE_DIR`, and `/tmp` | No | No | -| `deploy` | No | Runtime variables | Yes | None | No | [Mounts](../app-reference.md#mounts) | Yes | No | -| `post_deploy` | No | Runtime variables | Yes | None | No | [Mounts](../app-reference.md#mounts) | No | Yes | +| `deploy` | No | Runtime variables | Yes | None | No | [Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) | Yes | No | +| `post_deploy` | No | Runtime variables | Yes | None | No | [Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) | No | Yes | \* All of the hooks run with changes to the code or environment. This column indicates which hooks run on a redeploy without any code changes. ## Build hook -The `build` hook is run after any [build flavor](../app-reference.md#build). +The `build` hook is run after any [build flavor](/create-apps/app-reference/single-runtime-image.md#build). During this hook, no services (such as a database) or any persistent file mounts are available as the application hasn't yet been deployed. @@ -40,7 +40,7 @@ During the `build` hook, there are three writeable directories: The only constraint on what can be downloaded during a `build` hook is the disk space available for builds. -This is _not_ the `disk` specified in your [app configuration](../app-reference.md#top-level-properties). +This is _not_ the `disk` specified in your [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties). If you exceed this limit, you receive a `No space left on device` error. See how to [troubleshoot this error](../troubleshoot-disks.md#no-space-left-on-device). @@ -63,8 +63,8 @@ So if you accidentally add an unbroken loop, it gets cut off and you can continu ## Deploy hook The `deploy` hook is run after the app container has been started but before it has started accepting requests. -Note that the deploy hook only runs on [`web` instances](../app-reference.md#web), -not [`worker` instances](../app-reference.md#workers). +Note that the deploy hook only runs on [`web` instances](/create-apps/app-reference/single-runtime-image.md#web), +not [`worker` instances](/create-apps/app-reference/single-runtime-image.md#workers). You can access other services at this stage (such as MySQL, Solr, Redis). The disk where the application lives is read-only at this point. @@ -72,7 +72,7 @@ The disk where the application lives is read-only at this point. This hook should be used when something needs to run once when new code is deployed. It isn't run when a host is restarted (such as during region maintenance), so anything that needs to run each time an instance of an app starts (regardless of whether there's new code) -should go in the `pre_start` key in [your `web` configuration](../app-reference.md#web-commands). +should go in the `pre_start` key in [your `web` configuration](/create-apps/app-reference/single-runtime-image.md#web-commands). For example, clearing the cache. Be aware: The deploy hook blocks the site accepting new requests. diff --git a/sites/platform/src/create-apps/multi-app/_index.md b/sites/platform/src/create-apps/multi-app/_index.md index 78ade6159d..f8e673c246 100644 --- a/sites/platform/src/create-apps/multi-app/_index.md +++ b/sites/platform/src/create-apps/multi-app/_index.md @@ -6,6 +6,7 @@ banner: title: Feature availability type: tiered-feature body: This page applies to Grid and {{% names/dedicated-gen-3 %}} projects. To ensure you have enough resources to support multiple apps, you need at least a [{{< partial "plans/multiapp-plan-name" >}} plan](/administration/pricing/_index.md#multiple-apps-in-a-single-project). To set up multiple apps on {{% names/dedicated-gen-2 %}} environments, [contact Sales](https://platform.sh/contact/). +weight: 8 --- {{% multi-app-intro %}} diff --git a/sites/platform/src/create-apps/multi-app/project-structure.md b/sites/platform/src/create-apps/multi-app/project-structure.md index bfd1408c26..c77fe8b1e4 100644 --- a/sites/platform/src/create-apps/multi-app/project-structure.md +++ b/sites/platform/src/create-apps/multi-app/project-structure.md @@ -302,7 +302,7 @@ make sure you [change the source root](#change-the-source-root-of-your-app) for ## Change the source root of your app When your app's code base and configuration file aren't located at the same directory level in your project repository, -you need to [define a root directory](../app-reference.md#root-directory) for your app. +you need to [define a root directory](/create-apps/app-reference/single-runtime-image.md#root-directory) for your app. To do so, add a new `source.root` property in your app configuration. diff --git a/sites/platform/src/create-apps/multi-app/routes.md b/sites/platform/src/create-apps/multi-app/routes.md index fdc6dba78b..9c1e8d441e 100644 --- a/sites/platform/src/create-apps/multi-app/routes.md +++ b/sites/platform/src/create-apps/multi-app/routes.md @@ -50,7 +50,7 @@ You don't need to define a route for each app in the repository. If an app isn't specified, then it isn't accessible to the web. One good example of defining an app with no route is when you [use Git submodules](/create-apps/multi-app/project-structure.html#split-your-code-source-into-multiple-git-submodule-repositories) and want to [use a source operation to update your submodules](/development/submodules.html#update-submodules). -You can also achieve the same thing by defining the app as a [`worker`](../app-reference.md#workers). +You can also achieve the same thing by defining the app as a [`worker`](/create-apps/app-reference/single-runtime-image.md#workers). {{< /note >}} diff --git a/sites/platform/src/create-apps/runtime-operations.md b/sites/platform/src/create-apps/runtime-operations.md index 32a34cb990..861776a4d2 100644 --- a/sites/platform/src/create-apps/runtime-operations.md +++ b/sites/platform/src/create-apps/runtime-operations.md @@ -5,8 +5,8 @@ weight: 6 --- Runtime operations allow you to trigger one-off commands or scripts on your project. -Similar to [crons](../create-apps/app-reference.md#crons), they run in the app container but not on a specific schedule. -You can [define runtime operations](#define-a-runtime-operation) in your [app configuration](../create-apps/app-reference.md) +Similar to [crons](/create-apps/app-reference/single-runtime-image.md#crons), they run in the app container but not on a specific schedule. +You can [define runtime operations](#define-a-runtime-operation) in your [app configuration](/create-apps/app-reference/single-runtime-image.md) and [trigger them](#run-a-runtime-operation) at any time through the {{% vendor/name %}} CLI. For example, if you have a static website, @@ -117,7 +117,7 @@ but want to avoid going through the whole {{% vendor/name %}} [build and deploy The following examples assume that the frontend and backend containers are included in the same environment. This isn’t necessary for the commands to run successfully.
What _is_ necessary is that the build destination for your frontend **is writable at runtime** -(meaning, you must [define a mount](../create-apps/app-reference.md#mounts) for it). +(meaning, you must [define a mount](/create-apps/app-reference/single-runtime-image.md#mounts) for it). If you don’t want to include a build within a mount (especially if your data source **isn’t** on {{% vendor/name %}}), you can use [source operations](../create-apps/source-operations.md) to achieve a similar effect, but through generating a new commit. diff --git a/sites/platform/src/create-apps/source-operations.md b/sites/platform/src/create-apps/source-operations.md index ed659a6fb4..ededb41b64 100644 --- a/sites/platform/src/create-apps/source-operations.md +++ b/sites/platform/src/create-apps/source-operations.md @@ -21,7 +21,7 @@ or [revert to the last commit](#revert-to-the-last-commit) pushed to your Git re To run your source operations, you can use the [{{% vendor/name %}} CLI](../administration/cli/_index.md) or the [Console](https://console.platform.sh). If you want to run your source operations and update your code automatically, -you can also define [cron jobs](./app-reference.md#crons). +you can also define [cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). ## How source operations work @@ -50,7 +50,7 @@ When you trigger a source operation, the following happens in order: A source operation requires two things: - A name that must be unique within the application. - The name is the key of the block defined under `source.operations` in your [app configuration](./app-reference.md#source). + The name is the key of the block defined under `source.operations` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#source). - A `command` that defines what's run when the operation is triggered. diff --git a/sites/platform/src/create-apps/timezone.md b/sites/platform/src/create-apps/timezone.md index 56a955a716..c28e00b2cc 100644 --- a/sites/platform/src/create-apps/timezone.md +++ b/sites/platform/src/create-apps/timezone.md @@ -1,6 +1,7 @@ --- title: "Timezones" description: Learn more about the different timezones on {{% vendor/name %}} and when you can customize them. +weight: 9 --- On {{% vendor/name %}}, there are several timezones you might want to keep in mind. @@ -79,4 +80,4 @@ title=Java ## Set a cron timezone You can set a specific timezone for your crons so they don't run in your app runtime timezone (or container timezone if no app runtime timezone is set on your project). -To do so, [set the `timezone` top-level property](../create-apps/app-reference.md#top-level-properties) in your app configuration. \ No newline at end of file +To do so, [set the `timezone` top-level property](/create-apps/app-reference/single-runtime-image.md#top-level-properties) in your app configuration. diff --git a/sites/platform/src/create-apps/troubleshoot-disks.md b/sites/platform/src/create-apps/troubleshoot-disks.md index f1b8ea40b7..8c2275d1b4 100644 --- a/sites/platform/src/create-apps/troubleshoot-disks.md +++ b/sites/platform/src/create-apps/troubleshoot-disks.md @@ -1,5 +1,6 @@ --- title: "Troubleshoot disks" +weight: 10 --- {{% troubleshoot %}} @@ -22,7 +23,7 @@ Error: Resources exceeding plan limit; disk: 8192.00MB > 5120.00MB; try removing To fix the error, do one of the following: * Lower the `disk` parameters to a value within your plan's storage limits. - Note the [limits to downsizing disks](./app-reference.md#downsize-a-disk). + Note the [limits to downsizing disks](/create-apps/app-reference/single-runtime-image.md#downsize-a-disk). * Increase your plan's storage limits. This can only be done by people with the [manage plans permission](../administration/users.md#organization-permissions). diff --git a/sites/platform/src/create-apps/troubleshoot-mounts.md b/sites/platform/src/create-apps/troubleshoot-mounts.md index 30ddee39bb..302bb9ca0d 100644 --- a/sites/platform/src/create-apps/troubleshoot-mounts.md +++ b/sites/platform/src/create-apps/troubleshoot-mounts.md @@ -1,5 +1,6 @@ --- title: "Troubleshoot mounts" +weight: 11 --- {{% troubleshoot %}} @@ -41,7 +42,7 @@ You can then put the mount back in place. ## Mounted files not publicly accessible If you've set up mounts to handle files like user uploads, you want to make sure the files are accessible. -Do so by managing their [location](./app-reference.md#locations). +Do so by managing their [location](/create-apps/app-reference/single-runtime-image.md#locations). This example defines two mounts, one named `private` and one `upload`: diff --git a/sites/platform/src/create-apps/upgrading.md b/sites/platform/src/create-apps/upgrading.md index c54acafd6f..34594edc7c 100644 --- a/sites/platform/src/create-apps/upgrading.md +++ b/sites/platform/src/create-apps/upgrading.md @@ -1,5 +1,6 @@ --- title: "Upgrading" +weight: 12 --- ## Changes in version 2022.02 @@ -25,7 +26,7 @@ title: "Upgrading" ``` The new syntax offers greater flexibility and configuration. - For more details, see the [full specification for cron jobs](./app-reference.md#crons). + For more details, see the [full specification for cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). ## Changes in version 2019.05 @@ -57,7 +58,7 @@ For example, the following `{{< vendor/configfile "services" >}}` snippet: ``` * The syntax for the `mounts` key in `{{< vendor/configfile "app" >}}` has changed. -Rather than a parsed string, the value of each mount is a [multi-key definition](./app-reference.md#mounts). +Rather than a parsed string, the value of each mount is a [multi-key definition](/create-apps/app-reference/single-runtime-image.md#mounts). That is, the following example: ```yaml @@ -97,7 +98,7 @@ disable client-side caching. This change only affects static files served directly by the web server. Responses served from `passthru` URLs continue to use whatever caching headers were set by the application.. -To enable caching on your static files, make sure you include an `expires` key in your [web configuration](./app-reference.md), as shown below: +To enable caching on your static files, make sure you include an `expires` key in your [web configuration](/create-apps/app-reference/single-runtime-image.md), as shown below: ```yaml web: diff --git a/sites/platform/src/create-apps/web/_index.md b/sites/platform/src/create-apps/web/_index.md index cd141d0a93..75140a4af1 100644 --- a/sites/platform/src/create-apps/web/_index.md +++ b/sites/platform/src/create-apps/web/_index.md @@ -1,6 +1,7 @@ --- title: Configure what's served +weight: 7 --- How you should configure your web server depends a lot on what you want to serve. -The following examples show how in specific scenarios you might define [your web server](../app-reference.md#web). +The following examples show how in specific scenarios you might define [your web server](/create-apps/app-reference/single-runtime-image.md#web). diff --git a/sites/platform/src/create-apps/web/custom-headers.md b/sites/platform/src/create-apps/web/custom-headers.md index 85a9ac21c9..d188699e5c 100644 --- a/sites/platform/src/create-apps/web/custom-headers.md +++ b/sites/platform/src/create-apps/web/custom-headers.md @@ -5,7 +5,7 @@ description: Set custom headers for your static content such as custom content-t --- When your app responds to dynamic requests, it can generate headers on the fly. -To set headers for static content, add them in [your `web` configuration](../app-reference.md#web). +To set headers for static content, add them in [your `web` configuration](/create-apps/app-reference/single-runtime-image.md#web). You might want to do so to add custom content-type headers, limit what other sites can embed your content, or allow cross origin requests. @@ -29,7 +29,7 @@ web: This sets the `X-Frame-Options` header to `SAMEORIGIN` for all static files. Now your files can only be embedded within your site. -Now set up an exception for MP3 files using a [rule](../app-reference.md#rules): +Now set up an exception for MP3 files using a [rule](/create-apps/app-reference/single-runtime-image.md#rules): ```yaml {configFile="app"} web: diff --git a/sites/platform/src/create-apps/web/php-basic.md b/sites/platform/src/create-apps/web/php-basic.md index 1f60b9ef52..3479c71ce8 100644 --- a/sites/platform/src/create-apps/web/php-basic.md +++ b/sites/platform/src/create-apps/web/php-basic.md @@ -5,7 +5,7 @@ description: Start with a basic PHP app with a front controller for dynamic requ --- To handle dynamic requests to your PHP app, you might want to use a [front controller](https://en.wikipedia.org/wiki/Front_controller). -The following example shows how for such an app you might start defining [your web server](../app-reference.md#web). +The following example shows how for such an app you might start defining [your web server](/create-apps/app-reference/single-runtime-image.md#web). ## Define a document root diff --git a/sites/platform/src/create-apps/web/rewrite-requests.md b/sites/platform/src/create-apps/web/rewrite-requests.md index cd2fb8540b..8a0afbe339 100644 --- a/sites/platform/src/create-apps/web/rewrite-requests.md +++ b/sites/platform/src/create-apps/web/rewrite-requests.md @@ -10,7 +10,7 @@ For example, you might want to make URLs seem semantic to users without having t In such a case, you might want requests to `/shoes/great-shoe/` to be served as if they were requests to `/?category=shoes&product=great-shoe`. -If so, add a [rule](../app-reference.md#rules) similar to the following: +If so, add a [rule](/create-apps/app-reference/single-runtime-image.md#rules) similar to the following: ```yaml {configFile="app"} web: diff --git a/sites/platform/src/create-apps/web/serve-different-directories.md b/sites/platform/src/create-apps/web/serve-different-directories.md index e4b24bc5b8..bccc21dc76 100644 --- a/sites/platform/src/create-apps/web/serve-different-directories.md +++ b/sites/platform/src/create-apps/web/serve-different-directories.md @@ -25,7 +25,7 @@ And your build process might build the documentation with an output folder such If so, you can serve all requests by your app code except for those that start with `/docs`, which you serve with your generated docs. -Use a [`web` configuration](../app-reference.md#web) similar to the following: +Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#web) similar to the following: ```yaml {configfile="apps"} web: diff --git a/sites/platform/src/create-apps/web/static.md b/sites/platform/src/create-apps/web/static.md index 6d301a3bf7..d899bbe2eb 100644 --- a/sites/platform/src/create-apps/web/static.md +++ b/sites/platform/src/create-apps/web/static.md @@ -39,9 +39,9 @@ app: ``` See more information on the required minimal settings: -- [Top-level properties](../app-reference.md#top-level-properties). -- [`web` property](../app-reference.md#web). -- [`locations` properties](../app-reference.md#locations). +- [Top-level properties](/create-apps/app-reference/single-runtime-image.md#top-level-properties). +- [`web` property](/create-apps/app-reference/single-runtime-image.md#web). +- [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). ## Add more features @@ -62,7 +62,7 @@ web: allow: true ``` -See more information on [`locations` properties](../app-reference.md#locations). +See more information on [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). ### Create cache rules diff --git a/sites/platform/src/create-apps/workers.md b/sites/platform/src/create-apps/workers.md index 6c20760c56..c461b04e73 100644 --- a/sites/platform/src/create-apps/workers.md +++ b/sites/platform/src/create-apps/workers.md @@ -1,11 +1,12 @@ --- title: "Work with workers" description: Interact with your worker instances to handle background tasks for your apps. +weight: 15 --- Workers are instances of your code that aren't open to connections from other apps or services or the outside world. They're good for handling background tasks. -See how to [configure a worker](./app-reference.md#workers) for your app. +See how to [configure a worker](/create-apps/app-reference/single-runtime-image.md#workers) for your app. Note that to have enough resources to support a worker and a service, you need at least a [{{< partial "plans/multiapp-plan-name" >}} plan](../administration/pricing/_index.md#multiple-apps-in-a-single-project). @@ -72,13 +73,13 @@ The `start` key specifies the command to use to launch your worker application. It may be any valid shell command, although most often it runs a command in your application in the language of your application. If the command specified by the `start` key terminates, it's restarted automatically. -Note that [`deploy` and `post_deploy` hooks](./hooks/_index.md) as well as [`cron` commands](./app-reference.md#crons) -run only on the [`web`](./app-reference.md#web) container, not on workers. +Note that [`deploy` and `post_deploy` hooks](./hooks/_index.md) as well as [`cron` commands](/create-apps/app-reference/single-runtime-image.md#crons) +run only on the [`web`](/create-apps/app-reference/single-runtime-image.md#web) container, not on workers. ## Inheritance -Any top-level definitions for [`size`](./app-reference.md#sizes), [`relationships`](./app-reference.md#relationships), -[`access`](./app-reference.md#access), [`disk`](./app-reference.md), [`mount`](./app-reference.md#mounts), and [`variables`](./app-reference.md#variables) +Any top-level definitions for [`size`](/create-apps/app-reference/single-runtime-image.md#sizes), [`relationships`](/create-apps/app-reference/single-runtime-image.md#relationships), +[`access`](/create-apps/app-reference/single-runtime-image.md#access), [`disk`](/create-apps/app-reference/single-runtime-image.md), [`mount`](/create-apps/app-reference/single-runtime-image.md#mounts), and [`variables`](/create-apps/app-reference/single-runtime-image.md#variables) are inherited by every worker, unless overridden explicitly. That means, for example, that the following two `{{< vendor/configfile "app" >}}` definitions produce identical workers. @@ -92,7 +93,7 @@ mounts: source: local source_path: test relationships: - database: 'mysqldb:mysql' + mysql: workers: queue: commands: @@ -117,7 +118,7 @@ workers: source: local source_path: test relationships: - database: 'mysqldb:mysql' + mysql: mail: commands: start: | @@ -128,7 +129,7 @@ workers: source: local source_path: test relationships: - database: 'mysqldb:mysql' + mysql: ``` In both cases, there are two worker instances named `queue` and `mail`. @@ -145,10 +146,10 @@ while `variables` lets you instruct the application to run differently as a work For example, consider the following configuration: ```yaml {configFile="services"} -mysqldb: +mysql: type: "mariadb:{{% latest "mariadb" %}}" disk: 2048 -rabbitqueue: +rabbitmq: type: rabbitmq:{{% latest "rabbitmq" %}} disk: 512 ``` @@ -162,8 +163,8 @@ hooks: pip install -e . pip install gunicorn relationships: - database: 'mysqldb:mysql' - messages: 'rabbitqueue:rabbitmq' + mysql: + rabbitmq: variables: env: type: 'none' @@ -210,7 +211,7 @@ workers: disk: 256 mounts: {} relationships: - emails: 'rabbitqueue:rabbitmq' + rabbitmq: ``` There's a lot going on here, but it's all reasonably straightforward. diff --git a/sites/platform/src/dedicated-gen-2/overview/grid.md b/sites/platform/src/dedicated-gen-2/overview/grid.md index 15aeff17a1..26d952fa4d 100644 --- a/sites/platform/src/dedicated-gen-2/overview/grid.md +++ b/sites/platform/src/dedicated-gen-2/overview/grid.md @@ -78,7 +78,7 @@ This shouldn't affect you most of the time, but may influence certain advanced u ## Cron tasks interrupted by deploys -How [cron tasks](../../create-apps/app-reference.md#crons) interact with deploys changes based on the environment. +How [cron tasks](/create-apps/app-reference/single-runtime-image.md#crons) interact with deploys changes based on the environment. On Grid environments, a running cron task blocks a deploy until the cron is complete. On {{% names/dedicated-gen-2 %}} environments, a deploy terminates a running cron task. @@ -98,14 +98,14 @@ It's assumed you want the settings the same, unless you state otherwise in the t The following settings require a [support ticket](/learn/overview/get-support): -* [Worker instances](../../create-apps/app-reference.md#workers) +* [Worker instances](/create-apps/app-reference/single-runtime-image.md#workers) * [Service configuration](../../add-services/_index.md) * Relationships among services and apps * Plan upsizing * Increasing storage * Allocating storage among mounts and services * [PHP extensions](../../languages/php/extensions.md) -* Web server configuration (the [`web.locations` section of your app configuration](../../create-apps/app-reference.md#locations)) +* Web server configuration (the [`web.locations` section of your app configuration](/create-apps/app-reference/single-runtime-image.md#locations)) ## Logs diff --git a/sites/platform/src/define-routes/_index.md b/sites/platform/src/define-routes/_index.md index a66775e9d5..c2a6ecce07 100644 --- a/sites/platform/src/define-routes/_index.md +++ b/sites/platform/src/define-routes/_index.md @@ -455,7 +455,7 @@ which is a requirement for the router caching. enabled: false # Below HTTP config may not be necessary for every Websocket client. -# It is required for some, as only defining an HTTPS config may trigger an automatic redirect to HTTP. +# It is required for some, as only defining an HTTPS config may trigger an automatic redirect to HTTP. "http://{default}/ws": type: upstream upstream: "app:http" @@ -463,7 +463,7 @@ which is a requirement for the router caching. enabled: false ``` -2. [Disable request buffering](../create-apps/app-reference.md#locations) in your app configuration. +2. [Disable request buffering](../create-apps/app-reference/single-runtime-image.md#locations) in your app configuration. ```yaml {configFile="app"} web: diff --git a/sites/platform/src/define-routes/cache.md b/sites/platform/src/define-routes/cache.md index 2012267a71..3ec8a296d0 100644 --- a/sites/platform/src/define-routes/cache.md +++ b/sites/platform/src/define-routes/cache.md @@ -199,7 +199,7 @@ The cache duration is decided based on the `Cache-Control` response header value The `default_ttl` only applies to **non-static responses**, that is, those generated by your application. -To set a cache lifetime for static resources configure that in your [app configuration](../create-apps/app-reference.md#locations). +To set a cache lifetime for static resources configure that in your [app configuration](/create-apps/app-reference/single-runtime-image.md#locations). All static assets have a Cache-Control header with a max age defaulting to 0 (which is the default for `expires`). {{< note title="none">}} @@ -275,4 +275,4 @@ Set the Vary header to `X-Forwarded-Proto` [custom request header](/development/ ### Cache zipped content separately -Use `Vary: Accept-Encoding` to serve different content depending on the encoding. Useful for ensuring that gzipped content isn't served to clients that can't read it. \ No newline at end of file +Use `Vary: Accept-Encoding` to serve different content depending on the encoding. Useful for ensuring that gzipped content isn't served to clients that can't read it. diff --git a/sites/platform/src/development/file-transfer.md b/sites/platform/src/development/file-transfer.md index f6408d311e..c4dd1a36fb 100644 --- a/sites/platform/src/development/file-transfer.md +++ b/sites/platform/src/development/file-transfer.md @@ -17,7 +17,7 @@ This means that the only way you can edit your app's code is through Git. However, you can transfer files to and from your built app without using Git. To do so, you need to configure mounts or use an SSH client. -[Mounts](../create-apps/app-reference.md#mounts) let you set up directories that remain writable after the build is complete. +[Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) let you set up directories that remain writable after the build is complete. You can then transfer files directly to and from mounts inside your app with a single command via the [{{% vendor/name %}} CLI](../administration/cli/_index.md). @@ -112,7 +112,7 @@ Another way to transfer files to and from your built app is to use an SSH client You can use `scp` to copy files to and from a remote environment. For example, to download a `diagram.png` file from the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)), +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)), run the following command: ```bash @@ -188,7 +188,7 @@ The `sftp` connection is open once the `sftp>` prompt is displayed in your termi #### Download a file Say you want to download a `diagram.png` file from the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)). +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)). To do so, run the following command: ``` @@ -200,7 +200,7 @@ The `diagram.png` file is copied to the current local directory. #### Upload a file Say you want to upload a `diagram.png` file to the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)). +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)). To do so, run the following command: ```bash diff --git a/sites/platform/src/development/local/docksal.md b/sites/platform/src/development/local/docksal.md index ec3a230366..dca0d005c7 100644 --- a/sites/platform/src/development/local/docksal.md +++ b/sites/platform/src/development/local/docksal.md @@ -56,7 +56,7 @@ These files are ignored by {{% vendor/name %}}. ## 5. Add commands -Docksal doesn't automatically copy over any commands you have in your [build flavor](../../create-apps/app-reference.md#build) +Docksal doesn't automatically copy over any commands you have in your [build flavor](/create-apps/app-reference/single-runtime-image.md#build) and [hooks](../../create-apps/hooks/_index.md). To get your project running like on {{% vendor/name %}}, you have to add the commands to Docksal. diff --git a/sites/platform/src/development/sanitize-db/postgresql.md b/sites/platform/src/development/sanitize-db/postgresql.md index 619602576a..75c849cd6e 100644 --- a/sites/platform/src/development/sanitize-db/postgresql.md +++ b/sites/platform/src/development/sanitize-db/postgresql.md @@ -64,7 +64,7 @@ Set up a script by following these steps: ``` To sanitize only on the initial deploy and not all future deploys, - on sanitization create a file on a [mount](/create-apps/app-reference.md#mounts). + on sanitization create a file on a [mount](/create-apps/app-reference/single-runtime-image.md#mounts). Then add a check for the file as in the following example: ```bash {location="sanitize.sh"} diff --git a/sites/platform/src/development/ssh/_index.md b/sites/platform/src/development/ssh/_index.md index aae3b7eb7f..d7943162ab 100644 --- a/sites/platform/src/development/ssh/_index.md +++ b/sites/platform/src/development/ssh/_index.md @@ -3,7 +3,7 @@ title: Connect securely with SSH weight: 12 description: Keep your project and apps safe by connecting with SSH when you're interacting with your deployed environments or using the {{% vendor/name %}} CLI. layout: single -keywords: +keywords: - 2fa - twofactor - two factor @@ -60,7 +60,7 @@ Once you've connected, you get a welcome message detailing which environment you Now you can interact with the environment as you want. Note that your app's file system is read-only, -except for any [mounts you've defined](../../create-apps/app-reference.md#mounts). +except for any [mounts you've defined]/create-apps/app-reference/single-runtime-image.md#mounts). ## Connect to services diff --git a/sites/platform/src/development/submodules.md b/sites/platform/src/development/submodules.md index 6584a6c5d4..8f4055a19b 100644 --- a/sites/platform/src/development/submodules.md +++ b/sites/platform/src/development/submodules.md @@ -129,13 +129,13 @@ source: fi {{< /snippet >}} ``` - + For multiple app projects, make sure you define your source operation in the configuration of an app whose source code **is not** in a submodule. If you use [Git submodules for each of your apps](/create-apps/multi-app/project-structure.md#split-your-code-source-into-multiple-git-submodule-repositories), define a new app at the top level of your project repository. Don't define routes so your app isn't exposed to the web. - To define a source operation, add the following configuration to your [app configuration](/create-apps/app-reference): + To define a source operation, add the following configuration to your [app configuration](/create-apps/app-reference/single-runtime-image.md): ```yaml {configFile="app"} {{< snippet name="update-submodule" config="app" root="false" >}} diff --git a/sites/platform/src/development/troubleshoot.md b/sites/platform/src/development/troubleshoot.md index 7c80d8b8fe..55a3365a2c 100644 --- a/sites/platform/src/development/troubleshoot.md +++ b/sites/platform/src/development/troubleshoot.md @@ -111,7 +111,7 @@ it indicates your application is crashing or unavailable. Typical causes and potential solutions include: - Your app is listening at the wrong place. - - Check your app's [upstream properties](../create-apps/app-reference.md#upstream). + - Check your app's [upstream properties](../create-apps/app-reference/single-runtime-image.md#upstream). - If your app listening at a port, make sure it's using the [`PORT` environment variable](./variables/use-variables.md#use-provided-variables). - Your `{{< vendor/configfile "app" >}}` configuration has an error and a process isn't starting or requests can't be forwarded to it correctly. @@ -201,8 +201,8 @@ If you attempt to write to disk outside a `build` hook, you may encounter a `rea Except where you define it, the file system is all read-only, with code changes necessary through git. This gives you benefits like repeatable deployments, consistent backups, and traceability. -To generate anything you need later, [write to disk during a `build` hook](../create-apps/app-reference.md#writable-directories-during-build). -Or [declare mounts](../create-apps/app-reference.md#mounts), +To generate anything you need later, [write to disk during a `build` hook](/create-apps/app-reference/single-runtime-image.md#writable-directories-during-build). +Or [declare mounts](/create-apps/app-reference/single-runtime-image.md#mounts), which are writable even during and after deploy. They can be used for your data: file uploads, logs, and temporary files. @@ -233,7 +233,7 @@ To determine if your environment is being stuck in the build or the deployment, If the activity has the result `success`, the build has completed successfully and the system is trying to deploy. If the result is still `running`, the build is stuck. -In most regions, stuck builds terminate after one hour. +In most regions, stuck builds terminate after one hour. When a deployment is blocked, you should try the following: @@ -244,7 +244,7 @@ When a deployment is blocked, you should try the following: If a `sync` of `activate` process is stuck, try the above on the parent environment. -Note that, for PHP apps, +Note that, for PHP apps, you can [restart processes that get stuck during a build or deployment](../languages/php/troubleshoot.md#restart-php-processes-stuck-during-a-build-or-deployment) from your app container. @@ -278,7 +278,7 @@ strace -T {{< variable "YOUR_HOOK_COMMAND" >}} # Print a system call report ### Cron jobs -Containers can't be shutdown while long-running [cron jobs and scheduled tasks](../create-apps/app-reference.md#crons) are active. +Containers can't be shutdown while long-running [cron jobs and scheduled tasks](/create-apps/app-reference/single-runtime-image.md#crons) are active. That means long-running cron jobs block a container from being shut down to make way for a new deploy. Make sure your custom cron jobs run quickly and properly. @@ -298,7 +298,7 @@ and [cookie entry](../define-routes/cache.md#cookies). Because the router cache follows cache headers from your app, your app needs to send the correct `cache-control` header. -For static assets, set cache headers using the `expires` key in your [app configuration](../create-apps/app-reference.md#locations). +For static assets, set cache headers using the `expires` key in your [app configuration](/create-apps/app-reference/single-runtime-image.md#locations). ## Language-specific troubleshooting diff --git a/sites/platform/src/development/variables/set-variables.md b/sites/platform/src/development/variables/set-variables.md index 8c2606df88..a9b58cd61b 100644 --- a/sites/platform/src/development/variables/set-variables.md +++ b/sites/platform/src/development/variables/set-variables.md @@ -11,7 +11,7 @@ All of the variables can also be [overridden via script](#set-variables-via-scri ## Set variables in your app -Set variables [in code](../../create-apps/app-reference.md#variables) using the `{{< vendor/configfile "app" >}}` file. +Set variables [in code](/create-apps/app-reference/single-runtime-image.md#variables) using the `{{< vendor/configfile "app" >}}` file. These values are the same across all environments and present in the Git repository, which makes them a poor fit for API keys and other such secrets. @@ -179,7 +179,7 @@ value updates trigger a rebuild of the application in the same way that a commit ## Set variables via script -You can also provide a `.environment` file as in [your app root](../../create-apps/app-reference.md#root-directory). +You can also provide a `.environment` file as in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). This file runs as a script in dash when the container starts and on all SSH logins. It can be used to set any environment variables directly, such as the PATH variable. @@ -213,7 +213,7 @@ The following example looks for a `deploy/environment.tracker.txt` file. It displays a different message if it's found or not, which helps you track what variables are being set. ```bash {location=".environment"} -if [ -f "deploy/environment.tracker.txt" ]; then +if [ -f "deploy/environment.tracker.txt" ]; then echo "File found." export DEPLOY='Friday' else @@ -233,8 +233,8 @@ protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at .../rsync/compat.c(61) [receiver=2.6.9] -[ProcessFailedException] -The command failed with the exit code: 2 +[ProcessFailedException] +The command failed with the exit code: 2 ``` This failure comes because `mount:download` and `rsync` don't expect output when the SSH connection is made. diff --git a/sites/platform/src/development/variables/use-variables.md b/sites/platform/src/development/variables/use-variables.md index 546213d52b..bdb79c3852 100644 --- a/sites/platform/src/development/variables/use-variables.md +++ b/sites/platform/src/development/variables/use-variables.md @@ -171,7 +171,7 @@ public class App { ### Access complex values Variables can have nested structures. -The following example shows nested structures in an [app configuration](../../create-apps/app-reference.md#variables): +The following example shows nested structures in an [app configuration](/create-apps/app-reference/single-runtime-image.md#variables): ```yaml {configFile="app"} variables: @@ -348,8 +348,8 @@ and at runtime. | `{{< vendor/prefix >}}_SOURCE_DIR` | Yes | No | The path to the root directory of your code repository in the context of a running [source operation](../../create-apps/source-operations.md). The directory contains a writable copy of your repository that you can commit to during the operation. | | `{{< vendor/prefix >}}_TREE_ID` | Yes | Yes | The ID of the tree the application was built from, essentially the SHA hash of the tree in Git. Use when you need a unique ID for each build. | | `{{< vendor/prefix >}}_VARIABLES` | Some | Some | A base64-encoded JSON object with all user-defined project and environment variables that don't use a [prefix](./_index.md#variable-prefixes). The keys are the variable names and the values are the variable values. Availability during builds and at runtime depends on the settings for each variable. See how to [access individual variables](#access-variables-in-a-shell). | -| `PORT` | No | Yes | A `string` representing the port to which requests are sent if the [`web.upstream.socket_family` property](../../create-apps/app-reference.md#upstream) is unset or set to `tcp`. | -| `SOCKET` | No | Yes | A `string` representing the path to the Unix socket file to use if the [`web.upstream.socket_family` property](../../create-apps/app-reference.md#upstream) is set to `unix`. | +| `PORT` | No | Yes | A `string` representing the port to which requests are sent if the [`web.upstream.socket_family` property](/create-apps/app-reference/single-runtime-image.md#upstream) is unset or set to `tcp`. | +| `SOCKET` | No | Yes | A `string` representing the path to the Unix socket file to use if the [`web.upstream.socket_family` property](/create-apps/app-reference/single-runtime-image.md#upstream) is set to `unix`. | ### Variables on {{% names/dedicated-gen-2 %}} environments @@ -458,7 +458,7 @@ The following example shows the process, though you have to modify it to fit you ``` 5. Call the script from the `deploy` hook your [app configuration](../../create-apps/_index.md): - + ```yaml {configFile="app"} hooks: deploy: | diff --git a/sites/platform/src/domains/cdn/managed-fastly.md b/sites/platform/src/domains/cdn/managed-fastly.md index befd340619..387b9d67c7 100644 --- a/sites/platform/src/domains/cdn/managed-fastly.md +++ b/sites/platform/src/domains/cdn/managed-fastly.md @@ -3,7 +3,7 @@ title: "Managed Fastly CDN" sidebarTitle: "Managed Fastly CDN" weight: 2 description: Bring your content closer to users with a Fastly CDN fully managed by {{% vendor/name %}}. -banner: +banner: type: tiered-feature --- @@ -33,10 +33,10 @@ This allows for encryption of all traffic between your users and your app. If you use a Fastly CDN provided by {{% vendor/name %}}, you can provide your own third-party TLS certificates for an additional fee. -To do so, if you don't have one, -set up a [mount](../../create-apps/app-reference.md#mounts) that isn't accessible to the web. +To do so, if you don't have one, +set up a [mount](/create-apps/app-reference/single-runtime-image.md#mounts) that isn't accessible to the web. Use an environment with access limited to {{% vendor/name %}} support and trusted users. -[Transfer](../../development/file-transfer.md) each certificate, its unencrypted private key, +[Transfer](../../development/file-transfer.md) each certificate, its unencrypted private key, and the intermediate certificate to the mount. To notify {{% vendor/name %}} that a certificate is to be added to your CDN configuration, open a [support ticket](/learn/overview/get-support). @@ -47,4 +47,4 @@ To add it to your CDN configuration, open a [support ticket](/learn/overview/get Note that when you add your own third-party TLS certificates, you are responsible for renewing them in due time. -Failure to do so may result in outages and compromised security for your site. \ No newline at end of file +Failure to do so may result in outages and compromised security for your site. diff --git a/sites/platform/src/environments/backup.md b/sites/platform/src/environments/backup.md index cdf0e0c1d2..79519ad9b3 100644 --- a/sites/platform/src/environments/backup.md +++ b/sites/platform/src/environments/backup.md @@ -22,7 +22,7 @@ To work with an [inactive environment](/glossary.md#inactive-environment), first 1. As an [admin user](../administration/users.md), you can do a backup of your environment. This backup includes the complete data and code of the environment. All persistent data from all running [services](../add-services/_index.md) - and any files stored on [mounts](../create-apps/app-reference.md#mounts) are included. + and any files stored on [mounts](/create-apps/app-reference/single-runtime-image.md#mounts) are included. The backup is stored internally on {{% vendor/name %}}. That is, the backup can be applied to environments on {{% vendor/name %}}, but it can't be downloaded. If you need to download backups, instead [export your mount and service data](/learn/tutorials/exporting.md)). @@ -181,7 +181,7 @@ title=In the Console ### Automate manual backups -You can also automate the process of creating manual backups through [cron jobs](../create-apps/app-reference.md#crons). +You can also automate the process of creating manual backups through [cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). The cron job uses the CLI command to back up the environment. It requires you to [set up the CLI on the environment with an API token](../administration/cli/api-tokens.md#authenticate-in-an-environment). diff --git a/sites/platform/src/environments/scalability.md b/sites/platform/src/environments/scalability.md index 8aa887f062..a683a4f433 100644 --- a/sites/platform/src/environments/scalability.md +++ b/sites/platform/src/environments/scalability.md @@ -4,7 +4,7 @@ sidebarTitle: Scalability description: Learn how to scale your live site. --- -Your production environment gets a [pool of resources](../create-apps/app-reference.md#sizes) +Your production environment gets a [pool of resources](/create-apps/app-reference/single-runtime-image.md#sizes) based on your [plan size](../administration/pricing/_index.md). These resources are split up between the apps and services you've defined. diff --git a/sites/platform/src/environments/search-engine-visibility.md b/sites/platform/src/environments/search-engine-visibility.md index c7ff88cc00..c6260f78fb 100644 --- a/sites/platform/src/environments/search-engine-visibility.md +++ b/sites/platform/src/environments/search-engine-visibility.md @@ -59,7 +59,7 @@ It's automatically on for all `{{% vendor/cli %}}.site` domains. You can also send instructions to search engine indexers using a `robots.txt` file. Your app can serve this as a static file from its disk or as a dynamic response from its `passthru`. -Control either with the [`location` section of your app configuration](../create-apps/app-reference.md#locations). +Control either with the [`location` section of your app configuration](/create-apps/app-reference/single-runtime-image.md#locations). If your `robots.txt` file includes instructions to ignore a page, search engine indexers may ignore it even if you have configured {{% vendor/name %}} to not send the header. diff --git a/sites/platform/src/guides/django/deploy/customize.md b/sites/platform/src/guides/django/deploy/customize.md index 65b57f944f..ad769280c1 100644 --- a/sites/platform/src/guides/django/deploy/customize.md +++ b/sites/platform/src/guides/django/deploy/customize.md @@ -136,7 +136,7 @@ You can determine the deploy phase using the `PLATFORM_ENVIRONMENT` variable, wh ## `.environment` and Poetry -`source .environment` is run in the [app root](../../../create-apps/app-reference.md#root-directory) +`source .environment` is run in the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory) when a project starts, before cron commands are run, and when you log into an environment over SSH. So you can use the `.environment` file to make further changes to environment variables before the app runs, including modifying the system `$PATH` and other shell level customizations. diff --git a/sites/platform/src/guides/django/deploy/deploy.md b/sites/platform/src/guides/django/deploy/deploy.md index 32162b1a40..2668545268 100644 --- a/sites/platform/src/guides/django/deploy/deploy.md +++ b/sites/platform/src/guides/django/deploy/deploy.md @@ -15,7 +15,7 @@ description: | The example Django app used in this guide can be migrated solely by importing data into the database. Other forms of data, such as user uploads, also need to be migrated in the way described above. -To see how to define directories that are writable at runtime, see the [mounts reference](../../../create-apps/app-reference#mounts). +To see how to define directories that are writable at runtime, see the [mounts reference](/create-apps/app-reference/single-runtime-image#mounts). Then adjust the previous commands to upload files to them. {{< /note >}} diff --git a/sites/platform/src/guides/drupal/deploy/customize.md b/sites/platform/src/guides/drupal/deploy/customize.md index 7d5fc0cb6f..80f69a49ee 100644 --- a/sites/platform/src/guides/drupal/deploy/customize.md +++ b/sites/platform/src/guides/drupal/deploy/customize.md @@ -39,7 +39,7 @@ you would add configuration for those services to the `settings.platformsh.php` ## `.environment` -{{% vendor/name %}} runs `source .environment` in the [app root](../../../create-apps/app-reference.md#root-directory) +{{% vendor/name %}} runs `source .environment` in the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory) when a project starts, before cron commands are run, and when you log into an environment over SSH. That gives you a place to do extra environment variable setup before the app runs, including modifying the system `$PATH` and other shell level customizations. diff --git a/sites/platform/src/guides/drupal/faq.md b/sites/platform/src/guides/drupal/faq.md index 94b5c8e794..311d407f52 100644 --- a/sites/platform/src/guides/drupal/faq.md +++ b/sites/platform/src/guides/drupal/faq.md @@ -41,4 +41,4 @@ For Drupal sites, the name of the session cookie is based on a hash of the domai If you see a bare "File not found" error when accessing your Drupal site with a browser, you've pushed your code as a vanilla project but no `index.php` has been found. -Make sure your repository contains an `index.php` file in the [web location root](../../create-apps/app-reference.md#locations). +Make sure your repository contains an `index.php` file in the [web location root](/create-apps/app-reference/single-runtime-image.md#locations). diff --git a/sites/platform/src/guides/drupal/redis.md b/sites/platform/src/guides/drupal/redis.md index ee10a4733c..e95cb079fd 100644 --- a/sites/platform/src/guides/drupal/redis.md +++ b/sites/platform/src/guides/drupal/redis.md @@ -41,71 +41,7 @@ to [persistent Redis](../../add-services/redis.md#persistent-redis) (`redis-pers ## Add a Redis service -### 1. Configure the service - -To define the service, use the `redis-persistent` type: - -```yaml {configFile="services"} -# The name of the service container. Must be unique within a project. -: - type: redis-persistent: - disk: 256 -``` - -Note that persistent Redis requires `disk` to store data. -For more information, refer to the [dedicated Redis page](../../add-services/redis.md). - -If want to use ephemeral Redis instead, use the `redis` type: - -```yaml {configFile="services"} -# The name of the service container. Must be unique within a project. -: - type: redis: -``` - -Note that changing the name of the service replaces it with a brand new service and all existing data is lost. -Back up your data before changing the service. - -### 2. Add the relationship - -To define the relationship, use the `redis` endpoint : - -```yaml {configFile="app"} -# Relationships enable access from this app to a given service. -relationships: - : ":redis" -``` - -You can define `` and `` as you like, but it’s best if they’re distinct. -With this definition, the application container now has access to the service via the relationship ``. - -For PHP, enable the extension for the service: - -```yaml {configFile="app"} -# PHP extensions. -runtime: - extensions: - - redis -``` - -### Example Configuration - -#### [Service definition](../../add-services/_index.md) - -```yaml {configFile="services"} -# The name of the service container. Must be unique within a project. -cacheredis: - type: redis-persistent:7.0 - disk: 256 -``` - -#### [App configuration](../../add-services/_index.md) - -```yaml {configFile="app"} -# Relationships enable access from this app to a given service. -relationships: - rediscache: "cacheredis:redis" -``` +{{% endpoint-description type="redis-persistent" noApp=true /%}} ### 3. Add the Drupal module diff --git a/sites/platform/src/guides/drupal/simplesaml.md b/sites/platform/src/guides/drupal/simplesaml.md index 55960e4f9e..73503c4be5 100644 --- a/sites/platform/src/guides/drupal/simplesaml.md +++ b/sites/platform/src/guides/drupal/simplesaml.md @@ -67,7 +67,7 @@ Your SimpleSAMLphp configuration needs to be outside of the `vendor` directory. The `composer require` downloads a template configuration file to `vendor/simplesamlphp/simplesamlphp/config`. Rather than modifying that file in place (as it isn't included in Git), -copy the `vendor/simplesamlphp/simplesamlphp/config` directory to `simplesamlphp/config` (in [your app root](../../create-apps/app-reference.md#root-directory)). +copy the `vendor/simplesamlphp/simplesamlphp/config` directory to `simplesamlphp/config` (in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory)). It should contain two files, `config.php` and `authsources.php`. Additionally, create a `simplesamlphp/metadata` directory. diff --git a/sites/platform/src/guides/laravel/deploy/scheduling.md b/sites/platform/src/guides/laravel/deploy/scheduling.md index ca68923c1b..98d2ff2730 100644 --- a/sites/platform/src/guides/laravel/deploy/scheduling.md +++ b/sites/platform/src/guides/laravel/deploy/scheduling.md @@ -14,7 +14,7 @@ Laravel offers a very convenient and flexible way of scheduling tasks. A large s Once the scheduled tasks are defined, they need to be effectively executed at the right time and pace. The recommended way is a cron configuration entry running the `artisan schedule:run` command schedule for every minute. -However, on {{% vendor/name %}} the [minimum time between cron jobs](../../../create-apps/app-reference.md#cron-job-timing) +However, on {{% vendor/name %}} the [minimum time between cron jobs](/create-apps/app-reference/single-runtime-image.md#cron-job-timing) depends on your plan. Task scheduling may then be contradicted by the cron minimum frequency. Schedules outside the specified cron frequency are ignored and the related tasks aren't triggered. diff --git a/sites/platform/src/guides/micronaut/elasticsearch.md b/sites/platform/src/guides/micronaut/elasticsearch.md index 01162d0e4c..6b75a56660 100644 --- a/sites/platform/src/guides/micronaut/elasticsearch.md +++ b/sites/platform/src/guides/micronaut/elasticsearch.md @@ -7,10 +7,10 @@ description: | Configure a Micronaut application with Elasticsearch. --- -Micronaut provides two ways of accessing Elasticsearch: via the lower level `RestClient` or via the `RestHighLevelClient`. To initialize Elasticsearch in your project's cluster so that it can be accessed by a Micronaut application, it is necessary to modify two files. +Micronaut provides two ways of accessing Elasticsearch: via the lower level `RestClient` or via the `RestHighLevelClient`. To initialize Elasticsearch in your project's cluster so that it can be accessed by a Micronaut application, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Elasticsearch service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include Elasticse ## 2. Add the Elasticsearch relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/elasticsearch.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/micronaut/jpa.md b/sites/platform/src/guides/micronaut/jpa.md index 8c05cfcb13..0e7583e1ee 100644 --- a/sites/platform/src/guides/micronaut/jpa.md +++ b/sites/platform/src/guides/micronaut/jpa.md @@ -10,7 +10,7 @@ description: | To activate JPA and then have it accessed by the Micronoaut application already configured for {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Micronoaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Micronoaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add a SQL database service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include a SQL dat ## 2. Grant access to the service through a relationship -To access the new service, set a `relationship` in your [app configuration](../../create-apps/app-reference.md#relationships). +To access the new service, set a `relationship` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). {{< readFile file="registry/images/examples/full/postgresql.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/micronaut/micronaut-data.md b/sites/platform/src/guides/micronaut/micronaut-data.md index 9563c8851f..5f3f550dc9 100644 --- a/sites/platform/src/guides/micronaut/micronaut-data.md +++ b/sites/platform/src/guides/micronaut/micronaut-data.md @@ -10,7 +10,7 @@ description: | [Micronaut Data](https://micronaut-projects.github.io/micronaut-data/latest/guide/) is a database access toolkit that uses Ahead of Time (AoT) compilation to pre-compute queries for repository interfaces that are then executed by a thin, lightweight runtime layer. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add a SQL database service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include a SQL dat ## 2. Grant access to the service through a relationship -To access the new service, set a `relationship` in your [app configuration](../../create-apps/app-reference.md#relationships). +To access the new service, set a `relationship` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). {{< readFile file="registry/images/examples/full/postgresql.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/micronaut/mongodb.md b/sites/platform/src/guides/micronaut/mongodb.md index 4a89acfb5d..f6f8fd07c6 100644 --- a/sites/platform/src/guides/micronaut/mongodb.md +++ b/sites/platform/src/guides/micronaut/mongodb.md @@ -25,7 +25,7 @@ dbmongo: ## 2. Grant access to MongoDb through a relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: {{< readFile file="registry/images/examples/full/mongodb.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/micronaut/redis.md b/sites/platform/src/guides/micronaut/redis.md index e1090289cd..e4548aa8e5 100644 --- a/sites/platform/src/guides/micronaut/redis.md +++ b/sites/platform/src/guides/micronaut/redis.md @@ -7,10 +7,10 @@ description: | Configure a Micronaut application with Redis. --- -To activate Redis and then have it accessed by the Micronaut application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate Redis and then have it accessed by the Micronaut application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Micronaut project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/micronaut/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Redis service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include Persisten ## 2. Add the Redis relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `redisdata` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `redisdata` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/redis-persistent.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/quarkus/elasticsearch.md b/sites/platform/src/guides/quarkus/elasticsearch.md index 57a679ec06..41ca648520 100644 --- a/sites/platform/src/guides/quarkus/elasticsearch.md +++ b/sites/platform/src/guides/quarkus/elasticsearch.md @@ -7,10 +7,10 @@ description: | Configure a Quarkus application with Elasticsearch. --- -Quarkus provides two ways of accessing Elasticsearch: via the lower level `RestClient` or via the `RestHighLevelClient`. To initialize Elasticsearch in your project's cluster so that it can be accessed by a Quarkus application, it is necessary to modify two files. +Quarkus provides two ways of accessing Elasticsearch: via the lower level `RestClient` or via the `RestHighLevelClient`. To initialize Elasticsearch in your project's cluster so that it can be accessed by a Quarkus application, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Elasticsearch service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include Elasticse ## 2. Add the Elasticsearch relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/elasticsearch.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/quarkus/jpa.md b/sites/platform/src/guides/quarkus/jpa.md index a72b964856..b69a637bab 100644 --- a/sites/platform/src/guides/quarkus/jpa.md +++ b/sites/platform/src/guides/quarkus/jpa.md @@ -10,7 +10,7 @@ description: | Hibernate ORM is a standard [JPA](https://jakarta.ee/specifications/persistence/) implementation. It offers you the full breadth of an Object Relational Mapper and it works well in Quarkus. To activate JPA and then have it accessed by the Quarkus application already configured for {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add a SQL database service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include a SQL dat ## 2. Grant access to the service through a relationship -To access the new service, set a `relationship` in your [app configuration](../../create-apps/app-reference.md#relationships). +To access the new service, set a `relationship` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). {{< readFile file="registry/images/examples/full/postgresql.app.yaml" highlight="yaml" configFile="app" >}} @@ -45,4 +45,4 @@ Environment variables names are following the conversion rules of [Eclipse Micro ## 4. Connect to the service -Commit that code and push. The specified cluster will now always point to the PostgreSQL or any SQL service that you wish. \ No newline at end of file +Commit that code and push. The specified cluster will now always point to the PostgreSQL or any SQL service that you wish. diff --git a/sites/platform/src/guides/quarkus/mongodb.md b/sites/platform/src/guides/quarkus/mongodb.md index ff7b149734..93b7dc0d89 100644 --- a/sites/platform/src/guides/quarkus/mongodb.md +++ b/sites/platform/src/guides/quarkus/mongodb.md @@ -9,10 +9,10 @@ description: | MongoDB with Panache provides active record style entities (and repositories) like you have in [Hibernate ORM with Panache](https://quarkus.io/guides/hibernate-orm-panache). It focuses on helping you write your entities in Quarkus. -To activate MongoDB and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate MongoDB and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a MongoDB service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a MongoDB service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the MongoDB service @@ -27,7 +27,7 @@ dbmongo: ## 2. Grant access to MongoDb through a relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: {{< readFile file="registry/images/examples/full/mongodb.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/quarkus/panache.md b/sites/platform/src/guides/quarkus/panache.md index 3eea84fbb4..95de7129d7 100644 --- a/sites/platform/src/guides/quarkus/panache.md +++ b/sites/platform/src/guides/quarkus/panache.md @@ -9,10 +9,10 @@ description: | Hibernate ORM is a JPA implementation and offers you the full breadth of an Object Relational Mapper. It makes complex mappings possible, but they can sometimes be difficult. Hibernate ORM with Panache focuses on helping you write your entities in Quarkus. -To activate Hibernate Panache and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate Hibernate Panache and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](./deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](./deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add a SQL database service @@ -23,7 +23,7 @@ In your [service configuration](../../add-services/_index.md), include a SQL dat ## 2. Grant access to the service through a relationship -To access the new service, set a `relationship` in your [app configuration](../../create-apps/app-reference.md#relationships). +To access the new service, set a `relationship` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). {{< readFile file="registry/images/examples/full/postgresql.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/quarkus/redis.md b/sites/platform/src/guides/quarkus/redis.md index 7490e9b5c9..2c7be3f942 100644 --- a/sites/platform/src/guides/quarkus/redis.md +++ b/sites/platform/src/guides/quarkus/redis.md @@ -7,10 +7,10 @@ description: | Configure a Quarkus application with Redis. --- -To activate Redis and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate Redis and then have it accessed by the Quarkus application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Quarkus project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/quarkus/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Redis service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include Persisten ## 2. Add the Redis relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/redis-persistent.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/spring/elasticsearch.md b/sites/platform/src/guides/spring/elasticsearch.md index 2d54892dfb..1e9348dbcd 100644 --- a/sites/platform/src/guides/spring/elasticsearch.md +++ b/sites/platform/src/guides/spring/elasticsearch.md @@ -7,10 +7,10 @@ description: | Configure a Spring application with Elasticsearch. --- -To activate Elasticsearch and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate Elasticsearch and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Elasticsearch service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include Elasticse ## 2. Add the Elasticsearch relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/elasticsearch.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/spring/jpa.md b/sites/platform/src/guides/spring/jpa.md index 97cb8531c5..cf326a76ac 100644 --- a/sites/platform/src/guides/spring/jpa.md +++ b/sites/platform/src/guides/spring/jpa.md @@ -10,7 +10,7 @@ description: | To activate JPA and then have it accessed by the Spring application already configured for {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add a SQL database service @@ -21,7 +21,7 @@ In your [service configuration](../../add-services/_index.md), include a SQL dat ## 2. Grant access to the service through a relationship -To access the new service, set a `relationship` in your [app configuration](../../create-apps/app-reference.md#relationships). +To access the new service, set a `relationship` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). {{< readFile file="registry/images/examples/full/postgresql.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/spring/mongodb.md b/sites/platform/src/guides/spring/mongodb.md index 824609b592..b327de963f 100644 --- a/sites/platform/src/guides/spring/mongodb.md +++ b/sites/platform/src/guides/spring/mongodb.md @@ -7,10 +7,10 @@ description: | Configure a Spring application with MongoDB. --- -To activate MongoDB and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate MongoDB and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a MongoDB service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a MongoDB service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the MongoDB service @@ -25,7 +25,7 @@ dbmongo: ## 2. Grant access to MongoDb through a relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `dbmongo` to grant the application access to MongoDB via a relationship: {{< readFile file="registry/images/examples/full/mongodb.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/spring/redis.md b/sites/platform/src/guides/spring/redis.md index 12acd7a588..422498e385 100644 --- a/sites/platform/src/guides/spring/redis.md +++ b/sites/platform/src/guides/spring/redis.md @@ -7,10 +7,10 @@ description: | Configure a Spring application with Redis. --- -To activate Redis and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. +To activate Redis and then have it accessed by the Spring application already in {{% vendor/name %}}, it is necessary to modify two files. {{< note >}} -This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. +This guide only covers the *addition* of a service configuration to an existing Spring project already configured to deploy on {{% vendor/name %}}. Please see the [deployment guide](/guides/spring/deploy/_index.md) for more detailed instructions for setting up app containers and initial projects. {{< /note >}} ## 1. Add the Redis service @@ -22,7 +22,7 @@ include persistent Redis with a [valid supported version](../../add-services/red ## 2. Add the Redis relationship -In your [app configuration](../../create-apps/app-reference.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: +In your [app configuration](/create-apps/app-reference/single-runtime-image.md), use the service name `searchelastic` to grant the application access to Elasticsearch via a relationship: {{< readFile file="registry/images/examples/full/redis-persistent.app.yaml" highlight="yaml" configFile="app" >}} diff --git a/sites/platform/src/guides/symfony/environment-variables.md b/sites/platform/src/guides/symfony/environment-variables.md index da99627ddb..22848362be 100644 --- a/sites/platform/src/guides/symfony/environment-variables.md +++ b/sites/platform/src/guides/symfony/environment-variables.md @@ -99,11 +99,13 @@ symfony ssh -- symfony var:export --multiline ``` Each exposed environment variable is prefixed by the relationship name. -For example, if you have the following relationships in your configuration: +For example, if you have the following [relationships](/create-apps/app-reference/single-runtime-image#relationships) in your configuration: ```yaml relationships: - database: "securitydb:postgresql" + database: + service: securitydb + endpoint: postgresql ``` The environment variables for the database service is prefixed by `DATABASE_` diff --git a/sites/platform/src/guides/symfony/workers.md b/sites/platform/src/guides/symfony/workers.md index 62c8ae598a..8ab261a5fb 100644 --- a/sites/platform/src/guides/symfony/workers.md +++ b/sites/platform/src/guides/symfony/workers.md @@ -38,7 +38,7 @@ The ``commands.start`` key is required. It specifies the command you can use to launch the application worker. If the command specified by the ``start`` key terminates, it's restarted automatically. -For more information, see [Workers](../../create-apps/app-reference#workers). +For more information, see [Workers](/create-apps/app-reference/single-runtime-image#workers). {{< note title="Warning">}} diff --git a/sites/platform/src/guides/wordpress/deploy/configure.md b/sites/platform/src/guides/wordpress/deploy/configure.md index eb8957759f..9a6c99369e 100644 --- a/sites/platform/src/guides/wordpress/deploy/configure.md +++ b/sites/platform/src/guides/wordpress/deploy/configure.md @@ -10,12 +10,12 @@ description: | {{% guides/config-app template="wordpress-composer" %}} -Notice that the build `flavor` is set to `composer`, which will automatically download WordPress core, as well as your plugins, themes, and dependencies during the build step as defined in your `composer.json` file. Since WordPress's caching and uploads require write access at runtime, they've been given corresponding [mounts](../../../create-apps/app-reference.md#mounts) defined for them at the bottom of the file. MariaDB is accessible to WordPress internally at `database.internal` thanks to the relationship definition `database`. The [WordPress CLI](https://packagist.org/packages/wp-cli/wp-cli) is added as a build dependency, but we will still need to add some additional dependencies in the next step so that it can be used by the application and via SSH. +Notice that the build `flavor` is set to `composer`, which will automatically download WordPress core, as well as your plugins, themes, and dependencies during the build step as defined in your `composer.json` file. Since WordPress's caching and uploads require write access at runtime, they've been given corresponding [mounts](/create-apps/app-reference/single-runtime-image.md#mounts) defined for them at the bottom of the file. MariaDB is accessible to WordPress internally at `database.internal` thanks to the relationship definition `database`. The [WordPress CLI](https://packagist.org/packages/wp-cli/wp-cli) is added as a build dependency, but we will still need to add some additional dependencies in the next step so that it can be used by the application and via SSH. {{< /guides/config-app >}} {{< note >}} -During the template's build hook above, you see an `rsync` command that allows you to commit and use plugins that aren't accessible via Composer. The command moves all non-Composer plugins in a committed `plugins` directory to the final `wp-content/plugins` destination so that they can be enabled through the administration panel. +During the template's build hook above, you see an `rsync` command that allows you to commit and use plugins that aren't accessible via Composer. The command moves all non-Composer plugins in a committed `plugins` directory to the final `wp-content/plugins` destination so that they can be enabled through the administration panel. If you are migrating WordPress or starting from scratch, you should copy this line for your committed non-Composer plugins and, if needed, modify it to move committed `themes` to `wp-content/themes` in the same way. {{< /note >}} diff --git a/sites/platform/src/guides/wordpress/deploy/next-steps.md b/sites/platform/src/guides/wordpress/deploy/next-steps.md index 21d544b2fa..1d9bcf33a9 100644 --- a/sites/platform/src/guides/wordpress/deploy/next-steps.md +++ b/sites/platform/src/guides/wordpress/deploy/next-steps.md @@ -22,7 +22,7 @@ hooks: Here, you can commit plugins to the repository in a `plugins` subdirectory, which are placed into the WordPress installation during the build. It's assumed that these packages stick to best practices and don't write to the file system at runtime and when enabling them. -You can get around this issue by defining a [mount](../../../create-apps/app-reference.md#mounts) where a plugin requires write access, +You can get around this issue by defining a [mount](/create-apps/app-reference/single-runtime-image.md#mounts) where a plugin requires write access, but you need to remember that the contents at that mount location are wiped when deployment begins, so you need to copy and re-copy accordingly. @@ -40,7 +40,7 @@ $ composer require wpackagist-theme/neve This updates your `composer.json` and `composer.lock` files. Once you push the change to {{% vendor/name %}}, the package is downloaded during the WordPress build. All that's left is to sign in to the administration dashboard on your deployed site -and enable plugins and themes from the Plugins and Appearance settings, respectively. +and enable plugins and themes from the Plugins and Appearance settings, respectively. ## Set up a WooCommerce site @@ -57,7 +57,7 @@ Push those changes on a new environment and configure your store through the adm ## Adding private plugins and themes via Composer If your plugins aren't accessible from WPPackagist or Packagist, but are still valid packages, -you can use them in your project by defining local `repositories` for them in your `composer.json` file. +you can use them in your project by defining local `repositories` for them in your `composer.json` file. ```json "repositories":[ @@ -85,14 +85,14 @@ you can use them in your project by defining local `repositories` for them in yo In the snippet above, other packages can still be downloaded from WPPackagist, but now two custom `path` repositories have been defined from `/custom/[themes|plugins]` locally. Adding packages from these sources then only requires `composer require author/custom_plugin` -to ensure that the plugin at `/custom/plugin/author/custom_plugin` is installed by {{% vendor/name %}} when WordPress is built. +to ensure that the plugin at `/custom/plugin/author/custom_plugin` is installed by {{% vendor/name %}} when WordPress is built. ## Updating WordPress, plugins, and themes Your WordPress site is fully managed by Composer, which means so are updates to WordPress core itself. Run `composer update` periodically to get new versions of WordPress core, as well as any plugins or themes your have installed. -Commit the resulting changes to your `composer.lock` file and push again to {{% vendor/name %}}. +Commit the resulting changes to your `composer.lock` file and push again to {{% vendor/name %}}. The [Composer documentation](https://getcomposer.org/doc/) has more information on options to update individual modules or perform other tasks. @@ -103,4 +103,4 @@ All updates should be done through Composer to update the lock file, and then pu {{% guides/lando repo="wordpress-composer" %}} -{{< guide-buttons type="last" >}} \ No newline at end of file +{{< guide-buttons type="last" >}} diff --git a/sites/platform/src/guides/wordpress/redis.md b/sites/platform/src/guides/wordpress/redis.md index d98bd3c76a..66d8364bfd 100644 --- a/sites/platform/src/guides/wordpress/redis.md +++ b/sites/platform/src/guides/wordpress/redis.md @@ -43,7 +43,7 @@ If you named the service something different in step 1, change `rediscache` to t Add the Redis extension for PHP in one of two ways: -* In your [app configuration](../../create-apps/app-reference.md#extensions) (for extension versions tied to the PHP version) +* In your [app configuration](/create-apps/app-reference/single-runtime-image.md#extensions) (for extension versions tied to the PHP version) * Using a [builder script](../../languages/php/redis.md) (if you need more control over the extension version) ### 4. Add the Redis library @@ -77,7 +77,7 @@ Then commit the resulting changes to your `composer.json` and `composer.lock` fi To enable the Redis cache to work with WordPress, the `object-cache.php` file needs to be copied from the plugin's directory to the `wp-content` directory. -Add the following line to the bottom of your `build` hook in your [app configuration](../../create-apps/app-reference.md#hooks), +Add the following line to the bottom of your `build` hook in your [app configuration](/create-apps/app-reference/single-runtime-image.md#hooks), adjusting the paths based on where your plugins are located: {{< codetabs >}} diff --git a/sites/platform/src/increase-observability/logs/access-logs.md b/sites/platform/src/increase-observability/logs/access-logs.md index 75df236d46..e63772b670 100644 --- a/sites/platform/src/increase-observability/logs/access-logs.md +++ b/sites/platform/src/increase-observability/logs/access-logs.md @@ -73,7 +73,7 @@ hovering on the next unselected line gives you the amount of time that passed be Events that occur within an app container are logged within that container. The logs can be written to, but you should do so only with standard logging mechanisms. -If your app has its own logging mechanism, use it to write to a dedicated logs [mount](../../create-apps/app-reference.md#mounts). +If your app has its own logging mechanism, use it to write to a dedicated logs [mount](/create-apps/app-reference/single-runtime-image.md#mounts). To access the logs of various types of events: @@ -99,7 +99,7 @@ To view more lines, use the `--lines` flag. title=Using SSH directly +++ -1. Access the container by running +1. Access the container by running ``` bash {{% vendor/cli %}} ssh -e {{% variable "ENVIRONMENT_NAME" %}} @@ -120,7 +120,7 @@ title=Using SSH directly {{< /codetabs >}} All log files are trimmed to 100 MB automatically. -If you need larger logs, set up a [cron job](../../create-apps/app-reference.md#crons) to upload them to third-party storage. +If you need larger logs, set up a [cron job](/create-apps/app-reference/single-runtime-image.md#crons) to upload them to third-party storage. See an example of [uploading logs to Amazon S3](https://gitlab.com/contextualcode/platformsh-store-logs-at-s3) from Contextual Code. ### Types of container logs diff --git a/sites/platform/src/increase-observability/metrics/_index.md b/sites/platform/src/increase-observability/metrics/_index.md index 811c39f3d8..51c651a224 100644 --- a/sites/platform/src/increase-observability/metrics/_index.md +++ b/sites/platform/src/increase-observability/metrics/_index.md @@ -105,7 +105,7 @@ Burst allows your container to use additional resources when they aren't needed If you have a container in a prolonged burst state, you might want to consider: * [Optimizing your code](../integrate-observability/_index.md) -* Changing your [app size](../../create-apps/app-reference.md#sizes) +* Changing your [app size](/create-apps/app-reference/single-runtime-image.md#sizes) or [service size](../../add-services/_index.md#size) * [Increasing your plan](../../administration/pricing/_index.md) @@ -124,7 +124,7 @@ If the resources are high and hovering close to the 100% threshold, you might want to consider: * [Optimizing your code](../integrate-observability/_index.md) (if possible) -* Changing your [app size](../../create-apps/app-reference.md#sizes) +* Changing your [app size](/create-apps/app-reference/single-runtime-image.md#sizes) or [service size](../../add-services/_index.md#size) * [Increasing your plan](../../administration/pricing/_index.md) diff --git a/sites/platform/src/increase-observability/metrics/dedicated-generation-3.md b/sites/platform/src/increase-observability/metrics/dedicated-generation-3.md index 79ae159d4d..c41b41dc84 100644 --- a/sites/platform/src/increase-observability/metrics/dedicated-generation-3.md +++ b/sites/platform/src/increase-observability/metrics/dedicated-generation-3.md @@ -8,7 +8,7 @@ description: "Understand how to read metrics for {{% names/dedicated-gen-3 %}} e * App containers: one or more [app containers](../../create-apps/_index.md) * Service containers: zero or more [service containers](../../add-services/_index.md) -* Worker containers: zero or more [worker instances](../../create-apps/app-reference.md#workers). +* Worker containers: zero or more [worker instances](/create-apps/app-reference/single-runtime-image.md#workers). Infrastructure metrics report CPU, RAM, and disk space for all containers. @@ -33,7 +33,7 @@ Once you've read the metrics, see [recommendations for action](./_index.md#dedic ### App container Metrics graphs for the app container show CPU, RAM, and disk allocation and usage across all hosts. -The persistent disk has been configured in the [app configuration](../../create-apps/app-reference.md#top-level-properties) +The persistent disk has been configured in the [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties) at 4.86 GB, while the temporary disk is 3.99 GB by default. ![All of the metrics for the app container](/images/metrics/app-container-gen3.png) @@ -61,7 +61,7 @@ while the temporary disk is 3.99 GB by default. ### Worker container Metrics graphs for the Scheduler worker container show CPU, RAM, and disk allocation and usage across all hosts. -The persistent disk has been configured in the [app configuration](../../create-apps/app-reference.md#top-level-properties) +The persistent disk has been configured in the [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties) at 4.86 GB (the same as the app), while the temporary disk is 3.99 GB by default. ![All of the metrics for the Scheduler worker container](/images/metrics/schedule-worker-container-gen3.png) diff --git a/sites/platform/src/increase-observability/metrics/grid.md b/sites/platform/src/increase-observability/metrics/grid.md index 875e6c3237..f43978600e 100644 --- a/sites/platform/src/increase-observability/metrics/grid.md +++ b/sites/platform/src/increase-observability/metrics/grid.md @@ -8,7 +8,7 @@ Grid environments consist of: * App containers: one or more [app containers](../../create-apps/_index.md) * Service containers: zero or more [service containers](../../add-services/_index.md) -* Worker containers: zero or more [worker instances](../../create-apps/app-reference.md#workers). +* Worker containers: zero or more [worker instances](/create-apps/app-reference/single-runtime-image.md#workers). Infrastructure metrics report CPU, RAM, and disk space for app and worker containers and CPU and disk space for service containers. @@ -42,7 +42,7 @@ So the resources you see for a given container don't equal the total resources f This reference project has a single app, two services (MySQL and Redis), and two workers. The plan size for this project is [Medium](https://platform.sh/pricing/). -The appropriate resources have been [allocated automatically](../../create-apps/app-reference.md#sizes) for each container +The appropriate resources have been [allocated automatically](/create-apps/app-reference/single-runtime-image.md#sizes) for each container based on the number and type of containers for this plan size. The graphs show the current average usage in relation to the allocated resources. @@ -51,7 +51,7 @@ Once you've read the metrics, see [recommendations for action](./_index.md#grid- ### App container Metrics graphs for the app container show CPU, RAM, and disk allocation and usage. -The persistent disk has been configured in the [app configuration](../../create-apps/app-reference.md#top-level-properties) +The persistent disk has been configured in the [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties) at 1.91 GB, while the temporary disk is 3.99 GB by default. ![All of the metrics for the app container](/images/metrics/app-container.png) @@ -86,13 +86,13 @@ while the temporary disk is 3.99 GB by default. ### Worker containers Metrics graphs for the App-Horizon worker container show CPU, RAM, and disk allocation and usage. -The persistent disk has been configured in the [app configuration](../../create-apps/app-reference.md#top-level-properties) +The persistent disk has been configured in the [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties) at 1.91 GB, while the temporary disk is 3.99 GB by default. ![All of the metrics for the App-Horizon worker container](/images/metrics/horizon-worker-container.png) Metrics graphs for the App-Schedule worker container show CPU, RAM, and disk allocation and usage. -The persistent disk has been configured in the [app configuration](../../create-apps/app-reference.md#top-level-properties) +The persistent disk has been configured in the [app configuration](/create-apps/app-reference/single-runtime-image.md#top-level-properties) at 1.91 GB, while the temporary disk is 3.99 GB by default. ![All of the metrics for the App-Horizon worker container](/images/metrics/schedule-worker-container.png) diff --git a/sites/platform/src/integrations/activity/reference.md b/sites/platform/src/integrations/activity/reference.md index cfa0349fcc..ac92abb166 100644 --- a/sites/platform/src/integrations/activity/reference.md +++ b/sites/platform/src/integrations/activity/reference.md @@ -126,7 +126,7 @@ The following table presents the possible activity types: | `environment.backup.delete` | A user deleted a [backup](/environments/backup.md). | | `environment.branch` | A [new branch](/environments.md#create-environments) has been created via the CLI, Console, or API. A branch created via Git shows up as `environment.push`. | | `environment.certificate.renewal` | An environment's SSL certificate has been [renewed](/define-routes/https.md#certificate-renewals). | -| `environment.cron` | A [cron job](/create-apps/app-reference.md#crons) has completed. | +| `environment.cron` | A [cron job](/create-apps/app-reference/single-runtime-image.md#crons) has completed. | | `environment.deactivate` | An environment has been made [inactive](/glossary.md#inactive-environment). | | `environment.delete` | An environment's code was deleted through Git. | | `environment.domain.create` | A new [domain](administration/web/configure-project.md#domains) has been associated with the environment. | @@ -333,8 +333,7 @@ To test responses, [set up a webhook](./webhooks.md#setup). ### Cron -When a cron job is triggered, the activity contains all -the [job's information](../../create-apps/app-reference.md#crons). +When a cron job is triggered, the activity contains all the [job's information](/create-apps/app-reference/single-runtime-image.md#crons). The following example response was triggered by a setting where the cron is scheduled to run every five minutes (`5 * * * *`) with the command `sleep 60 && echo sleep-60-finished && date` and times out after 86,400 seconds. @@ -571,8 +570,8 @@ The `environment` property contains the settings for the environment that was pu ``` The `deployment` property contains the settings for the deployment, -including the [image type](../../create-apps/app-reference.md#types) and -[resource allocation](../../create-apps/app-reference.md#sizes). +including the [image type](/create-apps/app-reference/single-runtime-image.md#types) and +[resource allocation](/create-apps/app-reference/single-runtime-image.md#sizes). The following example shows a shortened excerpt of the `deployment` property: diff --git a/sites/platform/src/languages/dotnet.md b/sites/platform/src/languages/dotnet.md index a24101a979..6e19021f6d 100644 --- a/sites/platform/src/languages/dotnet.md +++ b/sites/platform/src/languages/dotnet.md @@ -71,7 +71,7 @@ Also, should the program terminate for any reason, it's automatically restarted. Note that the start command _must_ run in the foreground. Incoming requests are passed to the application using either a TCP (default) or Unix socket. -The application must use the [appropriate environment variable](../create-apps/app-reference.md#where-to-listen) to determine the URI to listen on. +The application must use the [appropriate environment variable](/create-apps/app-reference/single-runtime-image.md#where-to-listen) to determine the URI to listen on. For a TCP socket ([recommended](https://go.microsoft.com/fwlink/?linkid=874850)), the application must listen on `http://127.0.0.1`, using the `PORT` environment variable. diff --git a/sites/platform/src/languages/elixir.md b/sites/platform/src/languages/elixir.md index 5930cc1920..7ddd58f68d 100644 --- a/sites/platform/src/languages/elixir.md +++ b/sites/platform/src/languages/elixir.md @@ -3,6 +3,8 @@ title: "Elixir" description: "{{% vendor/name %}} supports building and deploying applications written in Elixir. There is no default flavor for the build phase, but you can define it explicitly in your build hook. {{% vendor/name %}} Elixir images support both committed dependencies and download-on-demand. The underlying Erlang version is 22.0.7." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -77,7 +79,7 @@ hooks: ``` {{< note >}} -That build hook works for most cases and assumes that your `mix.exs` file is located at [your app root](../create-apps/app-reference.md#root-directory). +That build hook works for most cases and assumes that your `mix.exs` file is located at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< /note >}} @@ -147,12 +149,17 @@ See [Config Reader Documentation](../development/variables/use-variables.md#acce The services configuration is available in the environment variable `PLATFORM_RELATIONSHIPS`. -Given a relationship defined in `{{< vendor/configfile "app" >}}`: +Given a [relationship](/create-apps/app-reference/single-runtime-image#relationships) defined in `{{< vendor/configfile "app" >}}`: ```yaml {configFile="app"} +# Relationships enable an app container's access to a service. +# The example below shows simplified configuration leveraging a default service +# (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - postgresdatabase: "dbpostgres:postgresql" + postgresql: ``` + Assuming you have in `mix.exs` the Poison library to parse JSON: ```elixir @@ -167,7 +174,7 @@ And assuming you use `ecto` you could put in `config/config.exs`: ```elixir relationships = Poison.decode!(Base.decode64!(System.get_env("PLATFORM_RELATIONSHIPS"))) -[postgresql_config | _tail] = relationships["postgresdatabase"] +[postgresql_config | _tail] = relationships["postgresql"] config :my_app, Repo, database: postgresql_config["path"], diff --git a/sites/platform/src/languages/go.md b/sites/platform/src/languages/go.md index 476a81f5af..239a1dbedd 100644 --- a/sites/platform/src/languages/go.md +++ b/sites/platform/src/languages/go.md @@ -3,6 +3,8 @@ title: "Go" description: "{{% vendor/name %}} supports building and deploying applications written in Go using Go modules. They're compiled during the Build hook phase, and support both committed dependencies and download-on-demand." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions diff --git a/sites/platform/src/languages/java/_index.md b/sites/platform/src/languages/java/_index.md index f4008658ff..95b484d1eb 100644 --- a/sites/platform/src/languages/java/_index.md +++ b/sites/platform/src/languages/java/_index.md @@ -4,6 +4,8 @@ description: Java is a general-purpose programming language, and one of the most layout: single --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions diff --git a/sites/platform/src/languages/java/frameworks.md b/sites/platform/src/languages/java/frameworks.md index bbc3d31922..99583ce352 100644 --- a/sites/platform/src/languages/java/frameworks.md +++ b/sites/platform/src/languages/java/frameworks.md @@ -4,6 +4,8 @@ weight: 1 sidebarTitle: "Frameworks" --- +{{% composable/disclaimer %}} + ## Hibernate [Hibernate ORM](https://hibernate.org/) is an object-relational mapping tool for the Java programming language. It provides a framework for mapping an object-oriented domain model to a relational database. Hibernate handles object-relational impedance mismatch problems by replacing direct, persistent database accesses with high-level object handling functions. diff --git a/sites/platform/src/languages/java/migration.md b/sites/platform/src/languages/java/migration.md index ba94c44408..cbbf4dc2da 100644 --- a/sites/platform/src/languages/java/migration.md +++ b/sites/platform/src/languages/java/migration.md @@ -4,6 +4,8 @@ weight: 2 sidebarTitle: "Moving to {{% vendor/name %}}" --- +{{% composable/disclaimer %}} + It is common to have a Java application that you want to migrate to {{% vendor/name %}}. {{% vendor/name %}} supports several styles of Java application, such as monolith, microservices, stateful, and stateless. @@ -48,12 +50,12 @@ web: ``` 1. [A Java version](/languages/java/_index.md#supported-versions), e,g.: `java:{{% latest "java" %}}` 2. [Hooks define what happens when building the application](../../create-apps/hooks/_index.md). This build process typically generates an executable file such as a uber-jar e.g.: `mvn clean package` -3. [The commands key defines the command to launch the application](../../create-apps/app-reference.md#web-commands). E.g.: `java -jar file.jar` +3. [The commands key defines the command to launch the application](/create-apps/app-reference/single-runtime-image.md#web-commands). E.g.: `java -jar file.jar` 4. In the start's command needs to receive the port where the application will execute thought the `PORT` environment. That's best when your app follows the port bind principle. E.g.: `java -jar jar --port=$PORT` {{< note >}} -Be aware that after the build, it creates a read-only system. You have the [mount option to create a writable folder](../../create-apps/app-reference.md#mounts). +Be aware that after the build, it creates a read-only system. You have the [mount option to create a writable folder](/create-apps/app-reference/single-runtime-image.md#mounts). {{< /note >}} @@ -102,9 +104,9 @@ You can load balance to some or [all applications in the project cluster](https: ## Access to managed services {{% vendor/name %}} provides [managed services](/add-services/_index.md) such as databases, cache and search engines. -However, you can use a database or any services such as a transition process, just be aware of the [firewall](../../create-apps/app-reference.md#firewall). +However, you can use a database or any services such as a transition process, just be aware of the [firewall](/create-apps/app-reference/single-runtime-image.md#firewall). -When applications need to access a service, it is important to include the [`relationships` key](../../create-apps/app-reference.md#relationships). +When applications need to access a service, it is important to include the [`relationships` key](/create-apps/app-reference/single-runtime-image.md#relationships). By default an application may not talk to any other container without a `relationship` explicitly allowing access. To connect to a service from your deployed application, you need to pass the relationships information into your application's configuration. @@ -122,7 +124,7 @@ This variable is a base64-encoded JSON object with keys of the relationship name {{% vendor/name %}} supports the [`jq` tool](https://stedolan.github.io/jq/), which allows to extract information from this JSON. ```shell -export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].host"` +export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].host"` ``` | Article | Source | @@ -138,10 +140,10 @@ you have the option to move the variable environment to another file: a [`.envir E.g.: ```shell -export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].host"` -export DB_PASSWORD=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].password"` -export DB_USER=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].username"` -export DB_DATABASE=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].path"` +export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].host"` +export DB_PASSWORD=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].password"` +export DB_USER=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].username"` +export DB_DATABASE=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].path"` export JDBC=jdbc:postgresql://${HOST}/${DATABASE} export JAVA_MEMORY=-Xmx$(jq .info.limits.memory /run/config.json)m export JAVA_OPTS="$JAVA_MEMORY -XX:+ExitOnOutOfMemoryError" @@ -156,7 +158,7 @@ disk: 1024 hooks: build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true relationships: - database: "db:postgresql" + postgresql: web: commands: start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar @@ -170,7 +172,7 @@ This library provides a streamlined way to interact with a {{% vendor/name %}} e import Config; Config config = new Config(); -MySQL database = config.getCredential("database", MySQL::new); +MySQL database = config.getCredential("postgresql", MySQL::new); DataSource dataSource = database.get(); ``` diff --git a/sites/platform/src/languages/java/tuning.md b/sites/platform/src/languages/java/tuning.md index 0c12557d8a..bbcfeb21b6 100644 --- a/sites/platform/src/languages/java/tuning.md +++ b/sites/platform/src/languages/java/tuning.md @@ -4,6 +4,8 @@ weight: 2 sidebarTitle: "Tuning" --- +{{% composable/disclaimer %}} + There are a number of settings that can be adjusted for each application to optimize its performance on {{% vendor/name %}}. ## Memory limits diff --git a/sites/platform/src/languages/lisp.md b/sites/platform/src/languages/lisp.md index 4530242ec8..b1986ae602 100644 --- a/sites/platform/src/languages/lisp.md +++ b/sites/platform/src/languages/lisp.md @@ -3,6 +3,8 @@ title: "Lisp" description: "{{% vendor/name %}} supports building and deploying applications written in Lisp using Common Lisp (the SBCL version) with ASDF and Quick Lisp support. They're compiled during the Build phase, and support both committed dependencies and download-on-demand." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -134,7 +136,7 @@ Given a relationship defined in `{{< vendor/configfile "app" >}}`: ```yaml {configFile="app"} relationships: - pg: postgresql:postgresql + postgresql: ``` The following would access that relationship, and provide your Lisp program the credentials to connect to a PostgreSQL instance. Add this to your `.asd` file: @@ -149,7 +151,7 @@ Then in your program you could access the PostgreSQL instance as follows: (defvar *pg-spec* nil) (defun setup-postgresql () - (let* ((pg-relationship (first (jsown:val (relationships) "pg"))) + (let* ((pg-relationship (first (jsown:val (relationships) "postgresql"))) (database (jsown:val pg-relationship "path")) (username (jsown:val pg-relationship "username")) (password (jsown:val pg-relationship "password")) diff --git a/sites/platform/src/languages/nodejs/_index.md b/sites/platform/src/languages/nodejs/_index.md index 0491df753c..7e0469772a 100644 --- a/sites/platform/src/languages/nodejs/_index.md +++ b/sites/platform/src/languages/nodejs/_index.md @@ -7,6 +7,8 @@ keywords: - bun runtime --- +{{% composable/disclaimer %}} + Node.js is a popular asynchronous JavaScript runtime. Deploy scalable Node.js apps of all sizes on {{% vendor/name %}}. You can also develop a microservice architecture mixing JavaScript and other apps with [multi-app projects](../../create-apps/multi-app/_index.md). @@ -170,13 +172,13 @@ web: ## Dependencies By default, {{% vendor/name %}} assumes you're using npm as a package manager. -If your code has a `package.json`, the following command is run as part of the default [build flavor](../../create-apps/app-reference.md#build): +If your code has a `package.json`, the following command is run as part of the default [build flavor](/create-apps/app-reference/single-runtime-image.md#build): ```bash npm prune --userconfig .npmrc && npm install --userconfig .npmrc ``` -This means you can specify configuration in a `.npmrc` file in [your app root](../../create-apps/app-reference.md#root-directory). +This means you can specify configuration in a `.npmrc` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). ### Use Yarn as a package manager diff --git a/sites/platform/src/languages/nodejs/debug.md b/sites/platform/src/languages/nodejs/debug.md index bd5eb1a07c..f780caa5b4 100644 --- a/sites/platform/src/languages/nodejs/debug.md +++ b/sites/platform/src/languages/nodejs/debug.md @@ -3,6 +3,8 @@ title: "Debugging" weight: 1 --- +{{% composable/disclaimer %}} + Effectively debugging web apps takes effort, especially when an HTTP request goes through multiple layers before reaching your web app. Follow the steps below to debug a specific app. diff --git a/sites/platform/src/languages/nodejs/node-version.md b/sites/platform/src/languages/nodejs/node-version.md index f89162f9a8..f43a03f9b0 100644 --- a/sites/platform/src/languages/nodejs/node-version.md +++ b/sites/platform/src/languages/nodejs/node-version.md @@ -4,6 +4,8 @@ weight: 1 description: See how to manage different Node.js versions in your {{% vendor/name %}} containers." --- +{{% composable/disclaimer %}} + Each {{% vendor/name %}} container image includes a specific language in a specific version. A set of dependencies is also provided based on that language version. This ensures that your application container is as small and efficient as possible. @@ -33,7 +35,7 @@ including Windows Subsystem for Linux. title=.nvmrc +++ -Create a `.nvmrc` file in [your app root](../../create-apps/app-reference.md#root-directory): +Create a `.nvmrc` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```yaml {location=".nvmrc"} v16.13.2 @@ -45,7 +47,7 @@ v16.13.2 title=.n-node-version/.node-version +++ -Create a `.n-node-version` or `.node-version` file in [your app root](../../create-apps/app-reference.md#root-directory): +Create a `.n-node-version` or `.node-version` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```yaml {location=".n-node-version or .node-version"} 16.13.2 diff --git a/sites/platform/src/languages/php/_index.md b/sites/platform/src/languages/php/_index.md index 8ebce40460..cbb6907068 100644 --- a/sites/platform/src/languages/php/_index.md +++ b/sites/platform/src/languages/php/_index.md @@ -4,6 +4,14 @@ description: Deploy PHP apps on {{% vendor/name %}}. layout: single --- +{{% note theme="info" %}} + +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +To find out more about this feature, see the [dedicated documentation page](/create-apps/app-reference/composable-image.md).
+Also, see how you can [modify your PHP runtime when using a composable image](#modify-your-php-runtime-when-using-a-composable-image). + +{{% /note %}} + ## Supported versions {{% major-minor-versions-note configMinor="true" %}} @@ -68,14 +76,14 @@ type: 'php:{{% latest "php" %}}' ``` ### 2. Serve your app -To serve your app, define what (and how) content should be served by setting the [`locations` parameter](../../create-apps/app-reference.md#locations). +To serve your app, define what (and how) content should be served by setting the [`locations` parameter](/create-apps/app-reference/single-runtime-image.md#locations). Usually, it contains the two following (optional) keys: - `root` for the document root, the directory to which all requests for existing `.php` and static files (such as `.css`, `.jpg`) are sent. - `passthru` to [define a front controller](../../create-apps/web/php-basic.md#set-different-rules-for-specific-locations) to handle nonexistent files. - The value is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + The value is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< note >}} @@ -125,20 +133,20 @@ web: ## Dependencies Up to PHP version 8.1, it's assumed that you're using [Composer](https://getcomposer.org/) 1.x to manage dependencies. -If you have a `composer.json` file in your code, the default [build flavor is run](../../create-apps/app-reference.md#build): +If you have a `composer.json` file in your code, the default [build flavor is run](/create-apps/app-reference/single-runtime-image.md#build): ```bash composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader ``` -To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configuration, add the following [dependency](../../create-apps/app-reference.md#dependencies): +To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configuration, add the following [dependency](/create-apps/app-reference/single-runtime-image.md#dependencies): ```yaml {configFile="app"} dependencies: php: composer/composer: '^2' ``` -Adding a dependency to the [dependencies block](../../create-apps/app-reference.md#dependencies) makes it available globally. +Adding a dependency to the [dependencies block](/create-apps/app-reference/single-runtime-image.md#dependencies) makes it available globally. So you can then use included dependencies as commands within your app container. You can add multiple global dependencies to the dependencies block, such as [Node.js](../nodejs/_index.md#2-specify-any-global-dependencies). @@ -166,7 +174,7 @@ hooks: That installs production dependencies with Composer but not development dependencies. The same can be achieved by using the default build flavor and [adding the `COMPOSER_NO_DEV` variable](../../development/variables/set-variables.md). -See more on [build flavors](../../create-apps/app-reference.md#build). +See more on [build flavors](/create-apps/app-reference/single-runtime-image.md#build). ### Alternative repositories @@ -291,7 +299,7 @@ markdownify=false ## PHP settings -You can configure your PHP-FPM runtime configuration by specifying the [runtime in your app configuration](../../create-apps/app-reference.md#runtime). +You can configure your PHP-FPM runtime configuration by specifying the [runtime in your app configuration](/create-apps/app-reference/single-runtime-image.md#runtime). In addition to changes in runtime, you can also change the PHP settings. Some commonly used settings are: @@ -380,7 +388,7 @@ For more information, see how to use [PHP-specific variables](../../development/ title=Using `php.ini` +++ -You can provide a custom `php.ini` file at the [app root](../../create-apps/app-reference.md#root-directory). +You can provide a custom `php.ini` file at the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). Using this method isn't recommended since it offers less flexibility and is more error-prone. Consider using variables instead. @@ -431,20 +439,20 @@ Common functions to disable include: PHP has two execution modes you can choose from: - The command line interface mode (PHP-CLI) is the mode used for command line scripts and standalone apps. - This is the mode used when you're logged into your container via SSH, for [crons](../../create-apps/app-reference.md#crons), + This is the mode used when you're logged into your container via SSH, for [crons](/create-apps/app-reference/single-runtime-image.md#crons), and usually also for [alternate start commands](#alternate-start-commands). To use PHP-CLI, run your script with `php {{}}`, - where {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + where {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). - The Common Gateway Interface mode (PHP-CGI) is the mode used for web apps and web requests. This is the default mode when the `start` command isn't explicitly set. To use PHP-CGI, run your script with a symlink: `/usr/bin/start-php-app {{}}`, - where {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + where {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). With PHP-CGI, PHP is run using the FastCGI Process Manager (PHP-FPM). ## Alternate start commands To specify an alternative process to run your code, set a `start` command. -For more information about the start command, see the [web commands reference](../../create-apps/app-reference.md#web-commands). +For more information about the start command, see the [web commands reference](/create-apps/app-reference/single-runtime-image.md#web-commands). By default, start commands use PHP-CLI. Find out how and when to use each [execution mode](#execution-mode). @@ -474,7 +482,7 @@ web: {{< /snippet >}} ``` - {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). <---> @@ -494,7 +502,7 @@ web: {{< /snippet >}} ``` - {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). 3. Configure the container to listen on a TCP socket: @@ -508,7 +516,7 @@ web: ``` When you listen on a TCP socket, the `$PORT` environment variable is automatically set. - See more options on how to [configure where requests are sent](../../create-apps/app-reference.md#upstream). + See more options on how to [configure where requests are sent](/create-apps/app-reference/single-runtime-image.md#upstream). You might have to configure your app to connect via the `$PORT` TCP socket, especially when using web servers such as [Swoole](swoole.md) or [Roadrunner](https://github.com/roadrunner-server/roadrunner). @@ -545,7 +553,7 @@ web: ``` {{}} is the bash script created in step 1. - Both {{}} and {{}} are file paths relative to the [app root](../../create-apps/app-reference.md#root-directory). + Both {{}} and {{}} are file paths relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< /codetabs >}} @@ -598,3 +606,59 @@ See [complete working examples for C and Rust](https://github.com/platformsh-exa ## Project templates {{< repolist lang="php" displayName="PHP" >}} + +## Modify your PHP runtime when using a composable image + +{{% note theme= "warning" %}} + +This section is only relevant when using the {{% vendor/name %}} [composable image (BETA)](/create-apps/app-reference/composable-image.md). + +{{% /note %}} + +The following table presents the possible modifications you can make to your PHP primary runtime using the `stack` key and composable image. +Each modification should be listed below the stack chosen (i.e. `extensions` are enabled under `.applications.frontend.stack[0]["php@8.3"].extensions` for PHP 8.3). +See the example below for more details. + +| Name | Type | Description | +|-----------------------------|------------------------------------------------------------|--------------------------------------------------------------------------------------------| +| `extensions` | List of `string`s OR [extensions definitions](/create-apps/app-reference/composable-image#php-extensions-and-python-packages) | [PHP extensions](/languages/php/extensions.md) to enable. | +| `disabled_extensions` | List of `string`s | [PHP extensions](/languages/php/extensions.md) to disable. | +| `request_terminate_timeout` | `integer` | The timeout for serving a single request after which the PHP-FPM worker process is killed. | +| `sizing_hints` | A [sizing hints definition](/create-apps/app-reference/composable-image#sizing-hints) | The assumptions for setting the number of workers in your PHP-FPM runtime. | +| `xdebug` | An Xdebug definition | The setting to turn on [Xdebug](/languages/php/xdebug.md). | + +Here is an example configuration: + +```yaml {configFile="app"} +name: frontend + +stack: + - "php@8.3": + extensions: + - apcu # A PHP extension made available to the PHP runtime + - sodium + - xsl + - pdo_sqlite + + xdebug: + idekey: YOUR_KEY + + disabled_extensions: + - gd + + request_terminate_timeout: 200 + + sizing_hints: + request_memory: 45 + reserved_memory: 70 + + - "php83Extensions.apcu" # A PHP extension made available to all runtimes. + - "python@3.12" + - "python312Packages.yq" +``` + +{{% note %}} + +You can also set your [app's runtime timezone](/create-apps/timezone.md). + +{{% /note %}} \ No newline at end of file diff --git a/sites/platform/src/languages/php/composer-auth.md b/sites/platform/src/languages/php/composer-auth.md index e7fb3a6af7..bd26e6af01 100644 --- a/sites/platform/src/languages/php/composer-auth.md +++ b/sites/platform/src/languages/php/composer-auth.md @@ -4,6 +4,8 @@ sidebarTitle: "Authenticated Composer" description: Allow Composer to authenticate against a private third-party Composer repository and download PHP packages from it. --- +{{% composable/disclaimer %}} + [Packagist](https://packagist.org/) is the primary Composer repository for public PHP packages. But you can also have Composer download PHP packages from a private, third-party Composer repository. To make sure Composer has the necessary credentials to do so, @@ -66,4 +68,4 @@ Access to private Git repositories is restricted through the use of SSH keys. But most private Composer tools mirror tagged releases of dependencies and serve them directly without hitting the Git repository. To avoid having to authenticate against a remote Git repository, -make sure your dependencies specify tagged releases. \ No newline at end of file +make sure your dependencies specify tagged releases. diff --git a/sites/platform/src/languages/php/extensions.md b/sites/platform/src/languages/php/extensions.md index 9abd92c0dc..739d527e63 100644 --- a/sites/platform/src/languages/php/extensions.md +++ b/sites/platform/src/languages/php/extensions.md @@ -4,10 +4,12 @@ weight: 1 description: See what PHP extensions are available with each PHP version on {{% vendor/name %}}. --- +{{% composable/disclaimer %}} + PHP has a number of [extensions](https://pecl.php.net/) developed by members of the community. Some of them are available for {{% vendor/name %}} containers. -{{< note version="1" theme="warning" >}} +{{< note version="1" theme="warning" title="Warning" >}} The information on this page applies to Grid and {{% names/dedicated-gen-3 %}} plans. See also [PHP extensions on {{% names/dedicated-gen-2 %}} plans](../../dedicated-gen-2/overview/grid.md#extensions). @@ -26,7 +28,7 @@ runtime: disabled_extensions: - sqlite3 ``` -You can also [include configuration options](../../create-apps/app-reference.md#extensions) for specific extensions. +You can also [include configuration options](/create-apps/app-reference/single-runtime-image.md#extensions) for specific extensions. The following table shows all extensions that are available (Avail) and on by default (Def). You can turn on the available ones with the `extensions` key @@ -68,7 +70,7 @@ but it takes slightly more work: but committing large binary blobs to Git is generally not recommended. 2. Load the extension using an absolute path by [customizing the PHP settings](./_index.md#customize-php-settings) - For example, if the extension is named `spiffy.so` and is in your [app root](../../create-apps/app-reference.md#root-directory), + For example, if the extension is named `spiffy.so` and is in your [app root](/create-apps/app-reference/single-runtime-image.md#root-directory), your configuration looks like the following: ```yaml {configFile="app"} diff --git a/sites/platform/src/languages/php/fpm.md b/sites/platform/src/languages/php/fpm.md index 6b3f63605b..fe11674a40 100644 --- a/sites/platform/src/languages/php/fpm.md +++ b/sites/platform/src/languages/php/fpm.md @@ -4,6 +4,8 @@ description: "Learn how to adjust the maximum number of PHP-FPM workers for your weight: 5 --- +{{% composable/disclaimer %}} + PHP-FPM helps improve your app's performance by maintaining pools of workers that can process PHP requests. This is particularly useful when your app needs to handle a high number of simultaneous requests. @@ -12,7 +14,7 @@ By default, {{% vendor/name %}} automatically sets a maximum number of PHP-FPM w This number is calculated based on three parameters: - The container memory: the amount of memory you can allot for PHP processing - depending on [app size](../../create-apps/app-reference.md#sizes). + depending on [app size](/create-apps/app-reference/single-runtime-image.md#sizes). - The request memory: the amount of memory an average PHP request is expected to require. - The reserved memory: the amount of memory you need to reserve for tasks that aren't related to requests. @@ -101,7 +103,7 @@ These values allow most programs to run, but you can amend them to fit your needs. To do so, adjust your [app configuration](../../create-apps/_index.md). -Under `runtime` in the [`sizing_hints` setting](../../create-apps/app-reference.md#sizing-hints), +Under `runtime` in the [`sizing_hints` setting](/create-apps/app-reference/single-runtime-image.md#sizing-hints), set the values for `reserved_memory` and `request_memory`. For example, diff --git a/sites/platform/src/languages/php/redis.md b/sites/platform/src/languages/php/redis.md index 7725193777..eb33c76708 100644 --- a/sites/platform/src/languages/php/redis.md +++ b/sites/platform/src/languages/php/redis.md @@ -4,6 +4,8 @@ sidebarTitle: Custom Redis weight: 7 --- +{{% composable/disclaimer %}} + [Redis](../../add-services/redis.md) is a popular structured key-value service, supported by {{% vendor/name %}}. It's frequently used for caching. @@ -71,7 +73,7 @@ That's only for pre-built extensions. 1. Download the Relay/PhpRedis source code. 2. Check out the version specified in the build hook. 3. Compile the extension. -4. Copy the resulting `relay.so`/`redis.so` file to [your app root](../../create-apps/app-reference.md#root-directory). +4. Copy the resulting `relay.so`/`redis.so` file to [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). 5. Add a line to the `php.ini` file in your app root to enable the extension, creating the file if necessary. If the script doesn't find a `$PLATFORM_CACHE_DIR` directory defined, it exits silently. diff --git a/sites/platform/src/languages/php/swoole.md b/sites/platform/src/languages/php/swoole.md index cd5deaee66..1d8ca39bd0 100644 --- a/sites/platform/src/languages/php/swoole.md +++ b/sites/platform/src/languages/php/swoole.md @@ -4,6 +4,8 @@ weight: 8 sidebarTitle: "Swoole" --- +{{% composable/disclaimer %}} + Swoole is a PHP extension that extends PHP core with a coroutine based asynchronous network application framework designed for building large scale concurrent systems. Unlike PHP-FPM’s stateless operating, Swoole relies on establishing persistent connections with every user, sending and receiving data in real-time. diff --git a/sites/platform/src/languages/php/troubleshoot.md b/sites/platform/src/languages/php/troubleshoot.md index c388aaeab9..cac76ecabe 100644 --- a/sites/platform/src/languages/php/troubleshoot.md +++ b/sites/platform/src/languages/php/troubleshoot.md @@ -4,6 +4,8 @@ sidebarTitle: Troubleshoot description: Learn how to troubleshoot common issues in PHP. --- +{{% composable/disclaimer %}} + {{% troubleshoot %}} ## Server reached `max_children` diff --git a/sites/platform/src/languages/php/tuning.md b/sites/platform/src/languages/php/tuning.md index 556c0fc0cf..a9bdc946a9 100644 --- a/sites/platform/src/languages/php/tuning.md +++ b/sites/platform/src/languages/php/tuning.md @@ -3,6 +3,8 @@ title: "Performance tuning" weight: 3 --- +{{% composable/disclaimer %}} + Once your app is up and running it still needs to be kept fast. {{% vendor/name %}} offers a wide degree of flexibility in how PHP behaves, but that does mean you may need to take a few steps to ensure your site is running optimally. @@ -16,7 +18,7 @@ To make a PHP-based site run faster, the first step is to upgrade the PHP versio Upgrading the PHP version might require changes to your app. For more details and recommendations, see the [PHP migration guides](https://www.php.net/manual/en/migration80.php). -To change your PHP version, change the [`type` in your app configuration](../../create-apps/app-reference.md#types). +To change your PHP version, change the [`type` in your app configuration](/create-apps/app-reference/single-runtime-image.md#types). Before merging to production, test the change on a branch and make sure that your app is working as expected. ## Optimize the FPM worker count @@ -55,7 +57,7 @@ variables: php: opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' ``` -`{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). +`{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). It may be any PHP script that calls `opcache_compile_file()`. The following example uses a `preload.php` file as the preload script. @@ -90,7 +92,7 @@ To determine the maximum number of files to cache, follow these steps: 1. Connect to the container via SSH using the [CLI](../../development/ssh/_index.md) by running `{{% vendor/cli %}} ssh`. -2. Determine roughly how many `.php` files your app has by running this command from [your app root](../../create-apps/app-reference.md#root-directory): +2. Determine roughly how many `.php` files your app has by running this command from [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```bash find . -type f -name '*.php' | wc -l diff --git a/sites/platform/src/languages/php/xdebug.md b/sites/platform/src/languages/php/xdebug.md index 7a03d4b321..fd021dbca4 100644 --- a/sites/platform/src/languages/php/xdebug.md +++ b/sites/platform/src/languages/php/xdebug.md @@ -4,6 +4,8 @@ weight: 6 sidebarTitle: "Xdebug" --- +{{% composable/disclaimer %}} + [Xdebug](https://xdebug.org/) is a real-time debugger extension for PHP. While usually used for local development, it can also be helpful for debugging aberrant behavior on the server. @@ -32,7 +34,7 @@ You also need: Xdebug runs as a second PHP-FPM process used only for debugging requests, leaving the normal process unaffected. -To enable Xdebug, add the following to your [app configuration](../../create-apps/app-reference.md): +To enable Xdebug, add the following to your [app configuration](/create-apps/app-reference/single-runtime-image.md): ```yaml {configFile="app"} runtime: @@ -105,7 +107,7 @@ The common steps for setup usually include: The Port should always be `443` and the Debugger set to `Xdebug`. 4. Ensuring path mappings is enabled. This lets you define what remote paths on the server correspond to what path on your local machine. - In the majority of cases you can just define [your app root](../../create-apps/app-reference.md#root-directory) + In the majority of cases you can just define [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory) to map to `app`. 5. Listening for connections. 6. Starting debugging. While in listen mode, start the `{{% vendor/cli %}} xdebug` tunnel. diff --git a/sites/platform/src/languages/python/_index.md b/sites/platform/src/languages/python/_index.md index a3d3008e8f..01d1d812d0 100644 --- a/sites/platform/src/languages/python/_index.md +++ b/sites/platform/src/languages/python/_index.md @@ -4,6 +4,8 @@ description: Get started creating Python apps on {{% vendor/name %}}. layout: single --- +{{% composable/disclaimer %}} + Python is a general purpose scripting language often used in web development. You can deploy Python apps on {{% vendor/name %}} using a server or a project such as [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/). @@ -154,7 +156,7 @@ For more about managing packages with pip, Pipenv, and Poetry, see how to [manage dependencies](./dependencies.md). To add global dependencies (packages available as commands), -add them to the `dependencies` in your [app configuration](../../create-apps/app-reference.md#dependencies): +add them to the `dependencies` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#dependencies): ```yaml {configFile="app"} dependencies: diff --git a/sites/platform/src/languages/python/dependencies.md b/sites/platform/src/languages/python/dependencies.md index 2671802827..4ea7840aad 100644 --- a/sites/platform/src/languages/python/dependencies.md +++ b/sites/platform/src/languages/python/dependencies.md @@ -5,6 +5,8 @@ sidebarTitle: Manage dependencies description: See how to manage Python dependencies with different package managers. --- +{{% composable/disclaimer %}} + You can manage Python packages in different ways. Python images come with pip installed, but they're flexible enough so you can choose what package manager you want. diff --git a/sites/platform/src/languages/python/python-version.md b/sites/platform/src/languages/python/python-version.md index 9101a6f083..9872d2c127 100644 --- a/sites/platform/src/languages/python/python-version.md +++ b/sites/platform/src/languages/python/python-version.md @@ -5,6 +5,8 @@ weight: 0 description: See how to manage different Python versions in your {{% vendor/name %}} containers. --- +{{% composable/disclaimer %}} + You may need to use a specific version of Python that isn't available in an app container for a different language. For example, a container might have a long-term support version, while you want the latest version. diff --git a/sites/platform/src/languages/python/server.md b/sites/platform/src/languages/python/server.md index 1044236943..71fe3e6c99 100644 --- a/sites/platform/src/languages/python/server.md +++ b/sites/platform/src/languages/python/server.md @@ -4,6 +4,8 @@ weight: -90 description: See how to start your apps as you wish with ASGI and WSGI servers. --- +{{% composable/disclaimer %}} + The Python ecosystem offers a number of web servers that can be used to deploy to {{% vendor/name %}}. The following examples deploy a Django project named `myapp`. They assume a `myapp/wsgi.py` or `myapp/asgi.py` file with a callable `application`. diff --git a/sites/platform/src/languages/ruby.md b/sites/platform/src/languages/ruby.md index a3ae5d74b4..3433362581 100644 --- a/sites/platform/src/languages/ruby.md +++ b/sites/platform/src/languages/ruby.md @@ -4,6 +4,8 @@ description: | {{% vendor/name %}} supports deploying any Ruby application. Your application can use any Ruby application server such as Unicorn or Puma and deploying a Rails or a Sinatra app is very straight forward. --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -85,7 +87,7 @@ You can change it. 3. Build your application with the build hook. - Assuming you have your dependencies stored in the `Gemfile` at [your app root](../create-apps/app-reference.md#root-directory), + Assuming you have your dependencies stored in the `Gemfile` at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory), create a hook like the following: ```yaml {configFile="app"} @@ -208,6 +210,7 @@ mounts: Here is a complete `{{< vendor/configfile "app" >}}` file: ```yaml {configFile="app"} +# The name of the app, which must be unique within a project. name: 'app' type: "ruby:3.0" @@ -216,8 +219,11 @@ dependencies: nodejs: yarn: "*" +# Relationships enable an app container's access to a service. +# The example below shows simplified configuration leveraging a default service (identified from the relationship name) and a default endpoint. +# See the Application reference for all options for defining relationships and endpoints. relationships: - database: "database:mysql" + mysql: disk: 2048 @@ -311,7 +317,7 @@ This example assumes there is a MySQL instance. To configure it, [create a service](../add-services/_index.md) such as the following: ```yaml {configFile="services"} -database: +mysql: type: mysql:{{% latest "mariadb" %}} disk: 2048 ``` @@ -321,7 +327,7 @@ Once you have a service, link to it in your [app configuration](../create-apps/_ ```yaml {configFile="app"} relationships: - database: "database:mysql" + mysql: ``` By using the following Ruby function calls, you can obtain the database details. @@ -335,7 +341,7 @@ This should give you something like the following: ```json { - "database" : [ + "mysql" : [ { "path" : "main", "query" : { @@ -344,7 +350,7 @@ This should give you something like the following: "port" : 3306, "username" : "user", "password" : "", - "host" : "database.internal", + "host" : "mysql.internal", "ip" : "246.0.241.50", "scheme" : "mysql" } diff --git a/sites/platform/src/languages/rust.md b/sites/platform/src/languages/rust.md index 242a2d99cf..6e32d59ca9 100644 --- a/sites/platform/src/languages/rust.md +++ b/sites/platform/src/languages/rust.md @@ -2,7 +2,7 @@ title: "Rust" description: banner: - title: Beta + title: Beta Feature body: The Rust runtime is currently available in Beta. To share your feedback so we can improve it, add a comment to the [Rust feature card](https://next.platform.sh/c/221-rust). --- diff --git a/sites/platform/src/learn/bestpractices/oneormany.md b/sites/platform/src/learn/bestpractices/oneormany.md index e8beea4716..d1d3a016b1 100644 --- a/sites/platform/src/learn/bestpractices/oneormany.md +++ b/sites/platform/src/learn/bestpractices/oneormany.md @@ -67,7 +67,7 @@ You can have services that are only exposed to another service as well as servic In a clustered application, you can have one of the following configurations: - Multiple [`{{< vendor/configfile "app" >}}` files](/create-apps/multi-app/_index.md) in different directories, with separate code bases that deploy separately -- A single app that spawns one or more [worker instances](/create-apps/app-reference.md#workers) that run background processes +- A single app that spawns one or more [worker instances](/create-apps/app-reference/single-runtime-image.md#workers) that run background processes {{< note >}} diff --git a/sites/platform/src/learn/overview/yaml/yaml-structure.md b/sites/platform/src/learn/overview/yaml/yaml-structure.md index 42ea935fe2..29148d214a 100644 --- a/sites/platform/src/learn/overview/yaml/yaml-structure.md +++ b/sites/platform/src/learn/overview/yaml/yaml-structure.md @@ -23,13 +23,13 @@ These YAML files are a good starting point before customization. These three YAML files configure the following: - ``{{< vendor/configfile "routes" "strip" >}}``: this file contains all of your [routes definition](/define-routes.md) - ``{{< vendor/configfile "services" "strip" >}}``: this file contains the list of your [services definition](/add-services.md) -- ``{{< vendor/configfile "app" >}}``: this file contains your [application definition](/create-apps/app-reference.html) +- ``{{< vendor/configfile "app" >}}``: this file contains your [application definition](/create-apps/app-reference/single-runtime-image) ## Examples ```yaml {location="{{< vendor/configfile "app" >}}"} -# {{< code-link destination="/create-apps/app-reference.html" text="Complete list of all available properties" title="Complete list of all available properties" >}} +# {{< code-link destination="/create-apps/app-reference/single-runtime-image.html" text="Complete list of all available properties" title="Complete list of all available properties" >}} # A unique name for the app. Must be lowercase alphanumeric characters. # Changing the name destroys data associated with the app. @@ -37,7 +37,7 @@ name: "app" # The runtime the application uses. -# {{< code-link destination="/create-apps/app-reference.html#types" text="Complete list of available runtimes" title="Complete list of available runtimes" >}} +# {{< code-link destination="/create-apps/app-reference/single-runtime-image.html#types" text="Complete list of available runtimes" title="Complete list of available runtimes" >}} type: "php:8.2" ... ``` diff --git a/sites/platform/src/learn/tutorials/exporting.md b/sites/platform/src/learn/tutorials/exporting.md index 9f6181887b..c9e65463be 100644 --- a/sites/platform/src/learn/tutorials/exporting.md +++ b/sites/platform/src/learn/tutorials/exporting.md @@ -59,7 +59,7 @@ title=Using Git ## 2. Download your files Some files might not be stored in Git, -such as data your app writes [in mounts](/create-apps/app-reference.md#mounts). +such as data your app writes [in mounts](/create-apps/app-reference/single-runtime-image.md#mounts). You can download your files [using the CLI](/development/file-transfer.md#transfer-files-using-the-cli) or [using SSH](/development/file-transfer.md#transfer-files-using-an-ssh-client). diff --git a/sites/platform/src/learn/tutorials/migrating.md b/sites/platform/src/learn/tutorials/migrating.md index e91c432911..0a31747def 100644 --- a/sites/platform/src/learn/tutorials/migrating.md +++ b/sites/platform/src/learn/tutorials/migrating.md @@ -68,7 +68,7 @@ which you can then upgrade. title=Using the CLI +++ -If you do not already have an organization created on {{% vendor/name %}}, create one: +If you do not already have an organization created on {{% vendor/name %}}, create one: ```bash {{% vendor/cli %}} org:create @@ -204,7 +204,7 @@ After any errors are fixed, a push creates a new environment. Once you push your code to {{% vendor/name %}}, either directly or through an integration, the deployment itself is not yet complete. -{{% vendor/name %}} has only just now understood the _types_ of containers you want (like a Python app container, and a Redis and MariaDB service containers) by validating that push. +{{% vendor/name %}} has only just now understood the _types_ of containers you want (like a Python app container, and a Redis and MariaDB service containers) by validating that push. How much resources those containers get is still left for you to define. You can do so quickly with the following CLI command: @@ -234,7 +234,7 @@ For any potential more details, see the [specific service](/add-services/_index. ## {{% version/ifelse "6" "7" %}}. Import files Your app may include content files, meaning files that aren't intended to be part of your codebase so aren't in Git. -You can upload such files to [mounts you created](/create-apps/app-reference.md#mounts). +You can upload such files to [mounts you created](/create-apps/app-reference/single-runtime-image.md#mounts). Upload to each mount separately. Suppose for instance you have the following file mounts defined: diff --git a/sites/platform/src/learn/tutorials/restrict-service-access.md b/sites/platform/src/learn/tutorials/restrict-service-access.md index 5498a194cd..eaf981a8f1 100644 --- a/sites/platform/src/learn/tutorials/restrict-service-access.md +++ b/sites/platform/src/learn/tutorials/restrict-service-access.md @@ -46,8 +46,12 @@ Edit your app configuration and add new relationships to your new endpoints: ```yaml {configFile="app"} relationships: - database: maindb:website - reports: maindb:reporting + database: + service: maindb + endpoint: website + reports: + service: maindb + endpoint: reporting ``` ## 3. Create a worker with access to the read-only endpoint @@ -68,7 +72,9 @@ workers: start: | sleep infinity relationships: - reports: maindb:reporting + reports: + service: maindb + endpoint: reporting access: ssh: viewer ``` diff --git a/sites/platform/src/projects/change-project-timezone.md b/sites/platform/src/projects/change-project-timezone.md index 5c7038c9d6..2308b7fe51 100644 --- a/sites/platform/src/projects/change-project-timezone.md +++ b/sites/platform/src/projects/change-project-timezone.md @@ -8,7 +8,7 @@ The project timezone affects [automated backups](../environments/backup.md). The project timezone doesn't affect: - [App runtime](../create-apps/timezone.md). -- [Cron jobs](../create-apps/app-reference.md#crons). +- [Cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). - [System logs](../increase-observability/logs/_index.md). UTC is the default timezone for all logs. To change the timezone for a project, follow these steps: diff --git a/sites/platform/src/security/web-application-firewall/waf.md b/sites/platform/src/security/web-application-firewall/waf.md index ab8bbb1c17..69c44f538d 100644 --- a/sites/platform/src/security/web-application-firewall/waf.md +++ b/sites/platform/src/security/web-application-firewall/waf.md @@ -90,7 +90,7 @@ The WAF enforces a file upload limit. By default, this limit is set at 250 MB. You can customize the file upload limit by amending your [app configuration](../../create-apps/_index.md). -In the [`web.locations` dictionary](../../create-apps/app-reference.md#locations), +In the [`web.locations` dictionary](/create-apps/app-reference/single-runtime-image.md#locations), add your desired value for the `max_request_size` property. ### File extension restriction @@ -98,8 +98,8 @@ add your desired value for the `max_request_size` property. The WAF enforces any file extension restriction you may have defined in your [app configuration](../../create-apps/_index.md). To set up a file extension restriction, -adjust the [`web.locations` dictionary](../../create-apps/app-reference.md#locations). -Set up [rules](../../create-apps/app-reference.md#rules) to allow only certain file extensions on a given path. +adjust the [`web.locations` dictionary](/create-apps/app-reference/single-runtime-image.md#locations). +Set up [rules](/create-apps/app-reference/single-runtime-image.md#rules) to allow only certain file extensions on a given path. ### Disallowed requests and headers diff --git a/sites/platform/static/images/nixos/nixos-packages.png b/sites/platform/static/images/nixos/nixos-packages.png new file mode 100644 index 0000000000..08ca4cb2f8 Binary files /dev/null and b/sites/platform/static/images/nixos/nixos-packages.png differ diff --git a/sites/platform/static/images/nixos/nixossearch-upstream-value.png b/sites/platform/static/images/nixos/nixossearch-upstream-value.png new file mode 100644 index 0000000000..19980fd3d1 Binary files /dev/null and b/sites/platform/static/images/nixos/nixossearch-upstream-value.png differ diff --git a/sites/friday/.eslintrc.yaml b/sites/upsun/.eslintrc.yaml similarity index 100% rename from sites/friday/.eslintrc.yaml rename to sites/upsun/.eslintrc.yaml diff --git a/sites/friday/.gitignore b/sites/upsun/.gitignore similarity index 100% rename from sites/friday/.gitignore rename to sites/upsun/.gitignore diff --git a/sites/friday/.htmltest.yml b/sites/upsun/.htmltest.yml similarity index 100% rename from sites/friday/.htmltest.yml rename to sites/upsun/.htmltest.yml diff --git a/sites/friday/.hugo_build.lock b/sites/upsun/.hugo_build.lock similarity index 100% rename from sites/friday/.hugo_build.lock rename to sites/upsun/.hugo_build.lock diff --git a/sites/friday/ABOUT.md b/sites/upsun/ABOUT.md similarity index 100% rename from sites/friday/ABOUT.md rename to sites/upsun/ABOUT.md diff --git a/sites/friday/build_docs.sh b/sites/upsun/build_docs.sh similarity index 98% rename from sites/friday/build_docs.sh rename to sites/upsun/build_docs.sh index 3b5c9d0f04..125dd8ac4b 100755 --- a/sites/friday/build_docs.sh +++ b/sites/upsun/build_docs.sh @@ -39,7 +39,7 @@ else fi echo "Moving the hugo binary from cache into the application." -cp "${PLATFORM_CACHE_DIR}/hugo_${HUGOVERSION}/hugo" "${PLATFORM_APP_DIR}/sites/friday" +cp "${PLATFORM_CACHE_DIR}/hugo_${HUGOVERSION}/hugo" "${PLATFORM_APP_DIR}/sites/upsun" # Build the Hugo site ./hugo diff --git a/sites/friday/config/_default/config.yaml b/sites/upsun/config/_default/config.yaml similarity index 56% rename from sites/friday/config/_default/config.yaml rename to sites/upsun/config/_default/config.yaml index d792a4a3d0..bd82a350bb 100644 --- a/sites/friday/config/_default/config.yaml +++ b/sites/upsun/config/_default/config.yaml @@ -50,60 +50,6 @@ module: - source: "../../shared/data" target: "data" - - source: "../platform/src" - target: "content" - excludeFiles: - - "_index.md" - - - "add-services/*" - # - "add-services/network-storage.md" - - - "administration/*" - - - "changelog/*" - - - "create-apps/*" - # - "create-apps/upgrading.md" - # - "create-apps/workers.md" - # - "create-apps/flexible-resources.md" - - - "dedicated-gen-2/*" - - - "dedicated-gen-3/*" - - - "define-routes/*" - - - "development/*" - - - "domains/*" - - - "environments/*" - - - "feedback/*" - - - "get-started/*" - - - "glossary/*" - - - "guides/*" - - - "increase-observability/*" - - - "integrations/*" - - - "languages/*" - #- "languages/java/frameworks.md" - - - "learn/*" - - - "projects/*" - - - "registry/*" - - - "security/*" - - lang: "en" - - source: "../platform/static/images" target: "static/images" - source: "../platform/static/videos" diff --git a/sites/friday/config/_default/params.yaml b/sites/upsun/config/_default/params.yaml similarity index 89% rename from sites/friday/config/_default/params.yaml rename to sites/upsun/config/_default/params.yaml index 9ce4abbda3..045dc86156 100644 --- a/sites/friday/config/_default/params.yaml +++ b/sites/upsun/config/_default/params.yaml @@ -1,12 +1,12 @@ # Basics version: "1.0.19" -description: Deploy Friday User Documentation -author: Deploy Friday +description: UPSUN User Documentation +author: Upsun title: User documentation issuerepo: "https://github.com/platformsh/platformsh-docs/" repo: "https://github.com/platformsh/platformsh-docs/" -folder: "sites/friday" +folder: "sites/upsun" editPageButton: true theme: @@ -23,8 +23,8 @@ vendor: active: true link: https://upsun.com/register/ cta: Get your Upsun free trial - title: Upsun Beta - description: "Access our newest offering - Upsun!

Get your free trial by clicking the link below.

" + title: Sign up + description: "Get your free trial by clicking the link below.

" psh_ref: Platform.sh config: version: 2 @@ -35,6 +35,7 @@ vendor: services: .upsun/config.yaml app: .upsun/config.yaml apps: .upsun/config.yaml + env: .environment prefix: apps: applications services: services @@ -47,7 +48,7 @@ vendor: console: https://console.upsun.com/ api: https://proxy.upsun.com/ host: upsun.com - hostname: upsunapp.com + hostname: platformsh.site register: https://auth.upsun.com/register # Images (kept in static/) @@ -62,7 +63,7 @@ gtm: "GTM-NN9T4G2T" headerActions: headerActionPrimary: destination: https://upsun.com/register/ - linkText: Sign up for Upsun Beta + linkText: Sign up headerActionSecondary: destination: https://console.upsun.com/ linkText: Log in diff --git a/sites/friday/deploy.sh b/sites/upsun/deploy.sh similarity index 98% rename from sites/friday/deploy.sh rename to sites/upsun/deploy.sh index 3f77970283..7a4d395371 100755 --- a/sites/friday/deploy.sh +++ b/sites/upsun/deploy.sh @@ -4,7 +4,7 @@ MEILI_CONFIG_DEST=public/scripts/xss/dist/config/config.json # The index won't be built until the post_deploy hook, so we hardcode it here. -MEILI_INDEX="friday_docs" +MEILI_INDEX="upsun_docs" createSearchConfig() { # Use the shared PLATFORM_PROJECT_ENTROPY var as MEILI_MASTER_KEY to retrieve the public key for our autocomplete app. diff --git a/sites/friday/index.js b/sites/upsun/index.js similarity index 100% rename from sites/friday/index.js rename to sites/upsun/index.js diff --git a/sites/friday/layouts/shortcodes/community-buttons.html b/sites/upsun/layouts/shortcodes/community-buttons.html similarity index 100% rename from sites/friday/layouts/shortcodes/community-buttons.html rename to sites/upsun/layouts/shortcodes/community-buttons.html diff --git a/sites/upsun/layouts/shortcodes/frameworks-landing.md b/sites/upsun/layouts/shortcodes/frameworks-landing.md new file mode 100644 index 0000000000..f4e277801f --- /dev/null +++ b/sites/upsun/layouts/shortcodes/frameworks-landing.md @@ -0,0 +1,22 @@ +{{ $python := "[Django](/get-started/stacks/django.md)
[Flask](/get-started/stacks/flask.md)" }} +{{ $php := "[Laravel](/get-started/stacks/laravel)
[Symfony](/get-started/stacks/symfony/_index.md)
[WordPress](/get-started/stacks/wordpress.md)" }} +{{ $nodejs := "[Express](/get-started/stacks/express)
[Next.js](/get-started/stacks/nextjs.md)
[Strapi](/get-started/stacks/strapi/_index.md)" }} + + + + + + + + + + + + + + + + + + +
LanguageFrameworks
{{ "[Python](/languages/python/_index.md)" | .Page.RenderString }}{{ $python | .Page.RenderString }}
{{ "[PHP](/languages/php/_index.md) " | .Page.RenderString }}{{ $php | .Page.RenderString }}
{{ "[Javascript/Node.js](/languages/nodejs/_index.md)" | .Page.RenderString }}{{ $nodejs | .Page.RenderString }}
diff --git a/sites/friday/layouts/shortcodes/home.html b/sites/upsun/layouts/shortcodes/home.html similarity index 100% rename from sites/friday/layouts/shortcodes/home.html rename to sites/upsun/layouts/shortcodes/home.html diff --git a/sites/friday/local_docs.sh b/sites/upsun/local_docs.sh similarity index 100% rename from sites/friday/local_docs.sh rename to sites/upsun/local_docs.sh diff --git a/sites/friday/marker.sh b/sites/upsun/marker.sh similarity index 100% rename from sites/friday/marker.sh rename to sites/upsun/marker.sh diff --git a/sites/friday/package-lock.json b/sites/upsun/package-lock.json similarity index 100% rename from sites/friday/package-lock.json rename to sites/upsun/package-lock.json diff --git a/sites/friday/package.json b/sites/upsun/package.json similarity index 100% rename from sites/friday/package.json rename to sites/upsun/package.json diff --git a/sites/friday/src/_index.md b/sites/upsun/src/_index.md similarity index 83% rename from sites/friday/src/_index.md rename to sites/upsun/src/_index.md index 4be45ecf1d..0d9d761b8b 100644 --- a/sites/friday/src/_index.md +++ b/sites/upsun/src/_index.md @@ -48,11 +48,7 @@ After going through the **Get started** section, you may want to know more about Now that you understand the basic rules of {{% vendor/name %}}, you're likely ready to deploy your own custom code in a chosen framework. The **Frameworks** section is a collection of framework-specific how-to guides - from best practices to configuration, local development, and more. -| Language | Frameworks | -| :---------------- |:----------------------------------------------------------------------------------------------------------------------------| -| [Python](/languages/python/_index.md) | [Django](/get-started/stacks/django.md)
[Flask](/get-started/stacks/flask.md) | -| [PHP](/languages/php/_index.md) | [Symfony](/get-started/stacks/symfony/_index.md)
[Laravel](/get-started/stacks/laravel.md) | -| [Javascript/Node.js](/languages/nodejs/_index.md) | [Express](/get-started/stacks/express.md)
[Next.js](/get-started/stacks/nextjs.md)
[Strapi](/get-started/stacks/strapi.md) | +{{< frameworks-landing >}} ### Reference diff --git a/sites/friday/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md similarity index 70% rename from sites/friday/src/add-services/_index.md rename to sites/upsun/src/add-services/_index.md index 609b7bb8f6..9ca69ae1bb 100644 --- a/sites/friday/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -26,26 +26,28 @@ All service configuration happens in the `{{< vendor/configfile "services" >}}` Configure your service in the following pattern: ```yaml {configFile="services"} -{{% snippet name="SERVICE_NAME" config="service" %}} - type: {{}}:{{}} - # Other options... -{{% /snippet %}} +# The name of the service container. Must be unique within a project. +services: + SERVICE_NAME: + type: {{}}:{{}} + # Other options... ``` An example service configuration for two databases might look like this: ```yaml {configFile="services"} -{{% snippet name="database1" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} -{{% /snippet %}} -{{% snippet name="database2" config="service" globKey="false" %}} - type: postgresql:{{% latest "postgresql" %}} -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` This YAML file contains a dictionary defining all of the services you want to use. The top-level key `services` defines an object of all of the services to be provisioned for the project. -Below that, come custom service names ({{}}; in the example, `database1` and `database2`), which you use to identify services in step 2. +Below that, come custom service names ({{}}; in the example, `mariadb` and `postgresql`), which you use to identify the service in step 2. You can give it any name you want with lowercase alphanumeric characters, hyphens, and underscores. @@ -65,7 +67,7 @@ The following table presents the keys you can define for each service: | --------------- | ---------- | ----------------- | ----------- | | `type` | `string` | Yes | One of the [available services](#available-services) in the format `type:version`. | | `configuration` | dictionary | For some services | Some services have additional specific configuration options that can be defined here, such as specific endpoints. See the given service page for more details. | -| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](../create-apps/app-reference.md#relationships). The `endpoint_name` for apps is always `http`. | +| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](/create-apps/app-reference/single-runtime-image.md#relationships). The `endpoint_name` for apps is always `http`. | ##### Resources (CPU, RAM, disk) @@ -79,43 +81,53 @@ For more information, see how to [manage resources](/manage-resources.md). ### 2. Connect the service Once you have configured a service, you need to create a relationship to connect it to an app. -This is done in your [app configuration for relationships](../create-apps/app-reference.md#relationships). +This is done in your [app configuration for relationships](/create-apps/app-reference/single-runtime-image.md#relationships). The relationship follows this pattern: ```yaml {configFile="app"} -{{% snippet name="" config="app" root="false"%}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - {{< variable "RELATIONSHIP_NAME" >}}: "{{< variable "SERVICE_NAME" >}}:{{< variable "ENDPOINT" >}}" -{{% /snippet %}} -{{% snippet name="SERVICE_NAME" config="service" placeholder="true"%}} - type: {{}}:{{}} - # Other options... -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + {{}}: + + # Other options... + + # Relationships enable an app container's access to a service. + # The example below shows simplified configuration leveraging a default service (identified from the relationship name) and a default endpoint. + # See the Application reference for all options for defining relationships and endpoints. + relationships: + {{}}: +services: + # The name of the service container. Must be unique within a project. + {{}}: + type: {{}}:{{}} + # Other options... ``` +You can define `` as you like, so long as it's unique between all defined services +and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. +That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) +(the network address a service is accessible from) that is identical to the _name_ of that service. + +Depending on your needs, instead of default endpoint configuration, +you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + An example relationship to connect to the databases given in the [example in step 1](#1-configure-the-service): -```yaml {configFile="app"} -{{% snippet name="" config="app" root="false" %}} - -# Other options... - -# Relationships enable an app container's to a service. -relationships: - mysql_database: "database1:mysql" - postgresql_database: "database2:postgresql" -{{% /snippet %}} -{{% snippet name="database1" config="service" placeholder="true" %}} - type: mariadb:{{% latest "mariadb" %}} -{{% /snippet %}} -{{% snippet name="database2" config="service" globKey="false" placeholder="true" %}} - type: postgresql:{{% latest "postgresql" %}} -{{% /snippet %}} +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + {{}}: + relationships: + mariadb: + postgresql: +services: + mariadb: + type: mariadb:{{% latest "mariadb" %}} + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` As with the service name, you can give the relationship any name you want @@ -187,17 +199,17 @@ To get the credentials for a given service, run the following command: You get output like the following: ```yaml -database: +mariadb: - username: user scheme: mysql - service: database + service: mariadb fragment: null ip: 198.51.100.37 - hostname: abcdefghijklm1234567890123.database.service._.eu.{{< vendor/urlraw "hostname" >}} + hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} public: false cluster: abcdefgh1234567-main-abcd123 - host: database.internal + host: mariadb.internal rel: mysql query: is_master: true @@ -206,10 +218,10 @@ database: type: 'mariadb:10.6' port: 3306 host_mapped: false - url: 'mysql://user:@database.internal:3306/main' + url: 'mysql://user:@mariadb.internal:3306/main' ``` -With this example, you can connect to the `database` relationship +With this example, you can connect to the `mariadb` relationship with the user `user`, an empty password, and the database name `main` (from the `path`). The `url` property shows a full database connection that can be used from your app. diff --git a/sites/friday/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md similarity index 100% rename from sites/friday/src/add-services/clickhouse.md rename to sites/upsun/src/add-services/clickhouse.md diff --git a/sites/friday/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md similarity index 100% rename from sites/friday/src/add-services/elasticsearch.md rename to sites/upsun/src/add-services/elasticsearch.md diff --git a/sites/friday/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md similarity index 75% rename from sites/friday/src/add-services/headless-chrome.md rename to sites/upsun/src/add-services/headless-chrome.md index 7e7f52ca70..e5de35e5ca 100644 --- a/sites/friday/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -27,15 +27,15 @@ title= Service environment variables {{% service-values-change %}} ```bash -CHROMEHEADLESSBROWSER_SERVICE=chromeheadless -CHROMEHEADLESSBROWSER_IP=123.456.78.90 -CHROMEHEADLESSBROWSER_HOSTNAME=azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}} -CHROMEHEADLESSBROWSER_CLUSTER=azertyuiop-main-7rqtwti -CHROMEHEADLESSBROWSER_HOST=chromeheadlessbrowser.internal -CHROMEHEADLESSBROWSER_REL=http -CHROMEHEADLESSBROWSER_SCHEME=http -CHROMEHEADLESSBROWSER_TYPE=chrome-headless:{{< latest "chrome-headless" >}} -CHROMEHEADLESSBROWSER_PORT=9222 +CHROMEHEADLESS_SERVICE=chromeheadless +CHROMEHEADLESS_IP=123.456.78.90 +CHROMEHEADLESS_HOSTNAME=azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}} +CHROMEHEADLESS_CLUSTER=azertyuiop-main-7rqtwti +CHROMEHEADLESS_HOST=chromeheadless.internal +CHROMEHEADLESS_REL=http +CHROMEHEADLESS_SCHEME=http +CHROMEHEADLESS_TYPE=chrome-headless:{{< latest "chrome-headless" >}} +CHROMEHEADLESS_PORT=9222 ``` <---> @@ -53,7 +53,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "chromeheadlessbrowser.internal", + "host": "chromeheadless.internal", "rel": "http", "scheme": "http", "type": "chrome-headless:{{< latest "chrome-headless" >}}", @@ -68,7 +68,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_HEADLESSCHROME_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.chromeheadlessbrowser[0].host')" +export APP_HEADLESSCHROME_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.chromeheadless[0].host')" ``` {{< /codetabs >}} @@ -123,27 +123,34 @@ yarn add puppeteer Configuration for a project looks similar to the following: ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -type: "nodejs:{{% latest "nodejs" %}}" - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - chromeheadlessbrowser: "chromeheadless:http" -{{% /snippet %}} -{{% snippet name="chromeheadless" config="service" placeholder="true" %}} - type: chrome-headless:{{% latest "chrome-headless" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + type: "nodejs:{{% latest "nodejs" %}}" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + chromeheadless: + service: chromeheadless + endpoint: http +services: + # The name of the service container. Must be unique within a project. + chromeheadless: + type: chrome-headless:{{% latest "chrome-headless" %}} ``` -{{% v2connect2app serviceName="chromeheadless" relationship="chromeheadlessbrowser" var="CHROME_BASEURL"%}} +{{% v2connect2app serviceName="chromeheadless" relationship="chromeheadless" var="CHROME_BASEURL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials, # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export CHROME_IP=${CHROMEHEADLESSBROWSER_IP} -export CHROME_PORT=${CHROMEHEADLESSBROWSER_PORT} +export CHROME_IP=${CHROMEHEADLESS_IP} +export CHROME_PORT=${CHROMEHEADLESS_PORT} # Combine into a single base URL to be used within app. export CHROME_BASEURL="http://${CHROME_IP}:${CHROME_PORT}" diff --git a/sites/friday/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md similarity index 78% rename from sites/friday/src/add-services/influxdb.md rename to sites/upsun/src/add-services/influxdb.md index cfbb9886bc..fa36097dbf 100644 --- a/sites/friday/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -39,22 +39,22 @@ title= Service environment variables {{% service-values-change %}} ```bash -INFLUXDBDATABASE_HOST=influxdbdatabase.internal -INFLUXDBDATABASE_HOSTNAME=azertyuiopqsdfghjklm.influxdb.service._.eu-1.{{< vendor/urlraw "hostname" >}} -INFLUXDBDATABASE_CLUSTER=azertyuiopqsdf-main-bvxea6i -INFLUXDBDATABASE_SERVICE=influxdb -INFLUXDBDATABASE_TYPE=influxdb:{{< latest "influxdb" >}} -INFLUXDBDATABASE_REL=influxdb -INFLUXDBDATABASE_SCHEME=http -INFLUXDBDATABASE_USERNAME=admin -INFLUXDBDATABASE_PASSWORD=ChangeMe -INFLUXDBDATABASE_PORT=8086 -INFLUXDBDATABASE_PATH= -INFLUXDBDATABASE_QUERY={'org': 'main', 'bucket': 'main', 'api_token': 'azertyuiopqsdfghjklm1234567890'} -INFLUXDBDATABASE_FRAGMENT= -INFLUXDBDATABASE_PUBLIC=false -INFLUXDBDATABASE_HOST_MAPPED=false -INFLUXDBDATABASE_IP=123.456.78.90 +INFLUXDB_HOST=influxdb.internal +INFLUXDB_HOSTNAME=azertyuiopqsdfghjklm.influxdb.service._.eu-1.{{< vendor/urlraw "hostname" >}} +INFLUXDB_CLUSTER=azertyuiopqsdf-main-bvxea6i +INFLUXDB_SERVICE=influxdb +INFLUXDB_TYPE=influxdb:{{< latest "influxdb" >}} +INFLUXDB_REL=influxdb +INFLUXDB_SCHEME=http +INFLUXDB_USERNAME=admin +INFLUXDB_PASSWORD=ChangeMe +INFLUXDB_PORT=8086 +INFLUXDB_PATH= +INFLUXDB_QUERY={'org': 'main', 'bucket': 'main', 'api_token': 'azertyuiopqsdfghjklm1234567890'} +INFLUXDB_FRAGMENT= +INFLUXDB_PUBLIC=false +INFLUXDB_HOST_MAPPED=false +INFLUXDB_IP=123.456.78.90 ``` <---> @@ -68,7 +68,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "host": "influxdbdatabase.internal", + "host": "influxdb.internal", "hostname": "azertyuiopqsdfghjklm.influxdb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiopqsdf-main-bvxea6i", "service": "influxdb", @@ -98,7 +98,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_INFLUXDB_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.influxdbdatabase[0].host')" +export APP_INFLUXDB_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.influxdb[0].host')" ``` {{< /codetabs >}} @@ -108,14 +108,22 @@ export APP_INFLUXDB_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.influxdbdatabase {{% endpoint-description type="influxdb" /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. -relationships: - influxdbdatabase: "influxdb:influxdb" -{{% /snippet %}} -{{% snippet name="influxdb" config="service" placeholder="true" %}} - type: influxdb:{{% latest "influxdb" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + influxdb: + +service: + influxdb: + type: influxdb:{{% latest "influxdb" %}} ``` {{% v2connect2app serviceName="influxdb" relationship="influxdbdatabase" var="INFLUX_HOST"%}} @@ -123,11 +131,11 @@ relationships: ```bash {location="myapp/.environment"} # Set environment variables for common InfluxDB credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export INFLUX_USER=${INFLUXDBDATABASE_USERNAME} -export INFLUX_HOST=${INFLUXDBDATABASE_HOST} -export INFLUX_ORG=$(echo $INFLUXDBDATABASE_QUERY | jq -r ".org") -export INFLUX_TOKEN=$(echo $INFLUXDBDATABASE_QUERY | jq -r ".api_token") -export INFLUX_BUCKET=$(echo $INFLUXDBDATABASE_QUERY | jq -r ".bucket") +export INFLUX_USER=${INFLUXDB_USERNAME} +export INFLUX_HOST=${INFLUXDB_HOST} +export INFLUX_ORG=$(echo $INFLUXDB_QUERY | jq -r ".org") +export INFLUX_TOKEN=$(echo $INFLUXDB_QUERY | jq -r ".api_token") +export INFLUX_BUCKET=$(echo $INFLUXDB_QUERY | jq -r ".bucket") ``` {{% /v2connect2app %}} @@ -146,7 +154,7 @@ To export your data from InfluxDB, follow these steps: This opens an SSH tunnel to your InfluxDB service on your current environment and produces output like the following: ```bash - SSH tunnel opened to influxdbdatabase at: http://127.0.0.1:30000 + SSH tunnel opened to {{}} at: http://127.0.0.1:30000 ``` 3. Get the username, password and token from the [relationship](#relationship-reference) by running the following command: diff --git a/sites/friday/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md similarity index 81% rename from sites/friday/src/add-services/kafka.md rename to sites/upsun/src/add-services/kafka.md index 6f08bd07c7..16610c8d10 100644 --- a/sites/friday/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -26,15 +26,15 @@ title= Service environment variables +++ ```bash -KAFKAQUEUE_SERVICE=kafka -KAFKAQUEUE_IP=123.456.78.90 -KAFKAQUEUE_HOSTNAME=azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}} -KAFKAQUEUE_CLUSTER=azertyuiop-main-7rqtwti -KAFKAQUEUE_HOST=kafkaqueue.internal -KAFKAQUEUE_REL=kafka -KAFKAQUEUE_SCHEME=kafka -KAFKAQUEUE_TYPE=kafka:{{< latest "kafka" >}} -KAFKAQUEUE_PORT=9092 +KAFKA_SERVICE=kafka +KAFKA_IP=123.456.78.90 +KAFKA_HOSTNAME=azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}} +KAFKA_CLUSTER=azertyuiop-main-7rqtwti +KAFKA_HOST=kafka.internal +KAFKA_REL=kafka +KAFKA_SCHEME=kafka +KAFKA_TYPE=kafka:{{< latest "kafka" >}} +KAFKA_PORT=9092 ``` <---> @@ -52,7 +52,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "kafkaqueue.internal", + "host": "kafka.internal", "rel": "kafka", "scheme": "kafka", "type": "kafka:{{< latest "kafka" >}}", @@ -67,7 +67,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_SOLR_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.kafkaqueue[0].host')" +export APP_SOLR_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.kafka[0].host')" ``` {{< /codetabs >}} diff --git a/sites/friday/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md similarity index 70% rename from sites/friday/src/add-services/memcached.md rename to sites/upsun/src/add-services/memcached.md index e21d0d5f2b..01f7b0b823 100644 --- a/sites/friday/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -34,15 +34,15 @@ title= Service environment variables {{% service-values-change %}} ```bash -MEMCACHEDCACHE_SERVICE=memcached -MEMCACHEDCACHE_IP=123.456.78.90 -MEMCACHEDCACHE_HOSTNAME=azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}} -MEMCACHEDCACHE_CLUSTER=azertyuiopqsdf-main-afdwftq -MEMCACHEDCACHE_HOST=memcachedcache.internal -MEMCACHEDCACHE_REL=memcached -MEMCACHEDCACHE_SCHEME=memcached -MEMCACHEDCACHE_TYPE=memcached:{{% latest "memcached" %}} -MEMCACHEDCACHE_PORT=11211 +MEMCACHED_SERVICE=memcached +MEMCACHED_IP=123.456.78.90 +MEMCACHED_HOSTNAME=azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}} +MEMCACHED_CLUSTER=azertyuiopqsdf-main-afdwftq +MEMCACHED_HOST=memcachedcache.internal +MEMCACHED_REL=memcached +MEMCACHED_SCHEME=memcached +MEMCACHED_TYPE=memcached:{{% latest "memcached" %}} +MEMCACHED_PORT=11211 ``` <---> @@ -60,7 +60,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "memcachedcache.internal", + "host": "memcached.internal", "rel": "memcached", "scheme": "memcached", "type": "memcached:{{% latest "memcached" %}}", @@ -75,7 +75,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_MEMCACHED_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.memcachedcache[0].host')" +export APP_MEMCACHED_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.memcached[0].host')" ``` {{< /codetabs >}} @@ -85,17 +85,22 @@ export APP_MEMCACHED_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.memcachedcache[ {{% endpoint-description type="memcached" php=true python=true /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - memcachedcache: "memcached:memcached" -{{% /snippet %}} -{{% snippet name="memcached" config="service" placeholder="true" %}} - type: memcached:{{% latest "memcached" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + memcached: + +service: + memcached: + type: memcached:{{% latest "memcached" %}} ``` {{% v2connect2app serviceName="memcached" relationship="memcachedcache" var="CACHE_URL"%}} @@ -103,7 +108,7 @@ relationships: ```bash {location="myapp/.environment"} # Surface a Memcached connection string for use in app. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export CACHE_URL="${MEMCACHEDCACHE_HOST}:${MEMCACHEDCACHE_PORT}" +export CACHE_URL="${MEMCACHED_HOST}:${MEMCACHED_PORT}" ``` {{% /v2connect2app %}} @@ -111,11 +116,11 @@ export CACHE_URL="${MEMCACHEDCACHE_HOST}:${MEMCACHEDCACHE_PORT}" ## Accessing Memcached directly To access the Memcached service directly you can use `netcat` as Memcached doesn't have a dedicated client tool. -Assuming your Memcached relationship is named `memcachedcache`, the host name `MEMCACHEDCACHE_HOST` and port number `MEMCACHEDCACHE_PORT` obtained from the [service environment variable](#relationship-reference) would be `memcachedcache.internal` and `11211`. +Assuming your Memcached relationship is named `memcached`, the host name `MEMCACHED_HOST` and port number `MEMCACHED_PORT` obtained from the [service environment variable](#relationship-reference) would be `memcached.internal` and `11211`.
Open an [SSH session](/development/ssh/_index.md) and access the Memcached server as follows: ```bash {location="Terminal"} -netcat memcachedcache.internal 11211 +netcat memcached.internal 11211 ``` {{% service-values-change %}} diff --git a/sites/friday/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md similarity index 78% rename from sites/friday/src/add-services/mongodb.md rename to sites/upsun/src/add-services/mongodb.md index c52616a151..83f2d767bd 100644 --- a/sites/friday/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -55,19 +55,19 @@ title= Service environment variables {{% service-values-change %}} ```bash -MONGODBDATABASE_USERNAME=main -MONGODBDATABASE_SCHEME=mongodb -MONGODBDATABASE_SERVICE=mongodb -MONGODBDATABASE_IP=123.456.78.90 -MONGODBDATABASE_HOSTNAME=azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}} -MONGODBDATABASE_CLUSTER=azertyuiop-main-7rqtwti -MONGODBDATABASE_HOST=mongodbdatabase.internal -MONGODBDATABASE_REL=mongodb -MONGODBDATABASE_QUERY={'is_master': True} -MONGODBDATABASE_PATH=main -MONGODBDATABASE_PASSWORD= -MONGODBDATABASE_TYPE=mongodb-enterprise:{{% latest "mongodb-enterprise" %}} -MONGODBDATABASE_PORT=27017 +MONGODB_USERNAME=main +MONGODBBASE_SCHEME=mongodb +MONGODB_SERVICE=mongodb +MONGODB_IP=123.456.78.90 +MONGODB_HOSTNAME=azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}} +MONGODB_CLUSTER=azertyuiop-main-7rqtwti +MONGODB_HOST=mongodbdatabase.internal +MONGODB_REL=mongodb +MONGODB_QUERY={'is_master': True} +MONGODB_PATH=main +MONGODB_PASSWORD= +MONGODB_TYPE=mongodb-enterprise:{{% latest "mongodb-enterprise" %}} +MONGODB_PORT=27017 ``` <---> @@ -87,7 +87,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "ip": "123.456.78.90", "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "mongodbdatabase.internal", + "host": "mongodb.internal", "rel": "mongodb", "query": { "is_master": true @@ -106,7 +106,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_MONGODBDATABASE_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.mongodbdatabase[0].host')" +export APP_MONGODBDATABASE_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.mongodb[0].host')" ``` {{< /codetabs >}} @@ -122,30 +122,35 @@ export APP_MONGODBDATABASE_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.mongodbda {{% endpoint-description type="mongodb" php=true /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - mongodbdatabase: "mongodb:mongodb" -{{% /snippet %}} -{{% snippet name="mongodb" config="service" placeholder="true" %}} - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + mongodb: + +service: + mongodb: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` -{{% v2connect2app serviceName="mongodb" relationship="mongodbdatabase" var="DATABASE_URL"%}} +{{% v2connect2app serviceName="mongodb" relationship="mongodb" var="DATABASE_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export DB_CONNECTION=="${MONGODBDATABASE_SCHEME}" -export DB_USERNAME="${MONGODBDATABASE_USERNAME}" -export DB_PASSWORD="${MONGODBDATABASE_PASSWORD}" -export DB_HOST="${MONGODBDATABASE_HOST}" -export DB_PORT="${MONGODBDATABASE_PORT}" -export DB_DATABASE="${MONGODBDATABASE_PATH}" +export DB_CONNECTION=="${MONGODB_SCHEME}" +export DB_USERNAME="${MONGODB_USERNAME}" +export DB_PASSWORD="${MONGODB_PASSWORD}" +export DB_HOST="${MONGODB_HOST}" +export DB_PORT="${MONGODB_PORT}" +export DB_DATABASE="${MONGODB_PATH}" # Surface connection string variable for use in app. export DATABASE_URL="${DB_CONNECTION}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}" @@ -160,13 +165,13 @@ Get the `host` from your [relationship](#relationship-reference). Then run the following command: ```bash -mongo {{< variable "MONGODBDATABASE_HOST" >}} +mongo {{< variable "MONGODB_HOST" >}} ``` With the example value, that would be the following: ```bash -mongo mongodbdatabase.internal +mongo mongodb.internal ``` {{% service-values-change %}} @@ -185,8 +190,7 @@ First, open an SSH tunnel with the {{% vendor/name %}} CLI: That opens an SSH tunnel to all services on your current environment and produce output like the following: ```bash -SSH tunnel opened on port 30000 to relationship: database -SSH tunnel opened on port 30001 to relationship: redis +SSH tunnel opened on port 30000 to relationship: mongodb ``` The port may vary in your case. diff --git a/sites/friday/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md similarity index 81% rename from sites/friday/src/add-services/mysql/_index.md rename to sites/upsun/src/add-services/mysql/_index.md index 89a178ce6e..83e656f119 100644 --- a/sites/friday/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -71,23 +71,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -MARIADBDATABASE_USERNAME=user -MARIADBDATABASE_SCHEME=mysql -MARIADBDATABASE_SERVICE=mariadb -MARIADBDATABASE_FRAGMENT= -MARIADBDATABASE_IP=123.456.78.90 -MARIADBDATABASE_HOSTNAME=azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}} -MARIADBDATABASE_PORT=3306 -MARIADBDATABASE_CLUSTER=azertyuiop-main-afdwftq -MARIADBDATABASE_HOST=mariadbdatabase.internal -MARIADBDATABASE_REL=mysql -MARIADBDATABASE_PATH=main -MARIADBDATABASE_QUERY={'is_master': True} -MARIADBDATABASE_PASSWORD= -MARIADBDATABASE_EPOCH=0 -MARIADBDATABASE_TYPE=mariadb:{{< latest "mariadb" >}} -MARIADBDATABASE_PUBLIC=false -MARIADBDATABASE_HOST_MAPPED=false +MARIADB_USERNAME=user +MARIADB_SCHEME=mysql +MARIADB_SERVICE=mariadb +MARIADB_FRAGMENT= +MARIADB_IP=123.456.78.90 +MARIADB_HOSTNAME=azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}} +MARIADB_PORT=3306 +MARIADB_CLUSTER=azertyuiop-main-afdwftq +MARIADB_HOST=mariadbdatabase.internal +MARIADB_REL=mysql +MARIADB_PATH=main +MARIADB_QUERY={'is_master': True} +MARIADB_PASSWORD= +MARIADB_EPOCH=0 +MARIADB_TYPE=mariadb:{{< latest "mariadb" >}} +MARIADB_PUBLIC=false +MARIADB_HOST_MAPPED=false ``` <---> @@ -109,7 +109,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 3306, "cluster": "azertyuiop-main-7rqtwti", - "host": "mariadbdatabase.internal", + "host": "mariadb.internal", "rel": "mysql", "path": "main", "query": { @@ -129,7 +129,7 @@ Example on how to gather [`PLATFORM_RELATIONSHIPS` environment variable](/develo export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_DATABASE_HOST=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".mariadbdatabase[0].host") +export APP_DATABASE_HOST=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".mariadb[0].host") ``` {{< /codetabs >}} @@ -144,23 +144,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -ORACLEDATABASE_USERNAME=user -ORACLEDATABASE_SCHEME=mysql -ORACLEDATABASE_SERVICE=oracle-mysql -ORACLEDATABASE_FRAGMENT= -ORACLEDATABASE_IP=123.456.78.90 -ORACLEDATABASE_HOSTNAME=azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}} -ORACLEDATABASE_PORT=3306 -ORACLEDATABASE_CLUSTER=azertyuiop-main-afdwftq -ORACLEDATABASE_HOST=oracledatabase.internal -ORACLEDATABASE_REL=mysql -ORACLEDATABASE_PATH=main -ORACLEDATABASE_QUERY={'is_master': True} -ORACLEDATABASE_PASSWORD= -ORACLEDATABASE_EPOCH=0 -ORACLEDATABASE_TYPE=oracle-mysql:{{< latest "oracle-mysql" >}} -ORACLEDATABASE_PUBLIC=false -ORACLEDATABASE_HOST_MAPPED=false +ORACLEMYSQL_USERNAME=user +ORACLEMYSQL_SCHEME=mysql +ORACLEMYSQL_SERVICE=oracle-mysql +ORACLEMYSQL_FRAGMENT= +ORACLEMYSQL_IP=123.456.78.90 +ORACLEMYSQL_HOSTNAME=azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}} +ORACLEMYSQL_PORT=3306 +ORACLEMYSQL_CLUSTER=azertyuiop-main-afdwftq +ORACLEMYSQL_HOST=oraclemysql.internal +ORACLEMYSQL_REL=mysql +ORACLEMYSQL_PATH=main +ORACLEMYSQL_QUERY={'is_master': True} +ORACLEMYSQL_PASSWORD= +ORACLEMYSQL_EPOCH=0 +ORACLEMYSQL_TYPE=oracle-mysql:{{< latest "oracle-mysql" >}} +ORACLEMYSQL_PUBLIC=false +ORACLEMYSQL_HOST_MAPPED=false ``` <---> @@ -182,7 +182,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 3306, "cluster": "azertyuiop-main-afdwftq", - "host": "oracledatabase.internal", + "host": "oraclemysql.internal", "rel": "mysql", "path": "main", "query": { @@ -202,7 +202,7 @@ Example on how to gather [`PLATFORM_RELATIONSHIPS` environment variable](/develo export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_ORACLE_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.oracledatabase[0].host')" +export APP_ORACLE_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.oraclemysql[0].host')" ``` {{< /codetabs >}} @@ -214,30 +214,35 @@ Configure your service with at least 256 MB in disk space. {{% endpoint-description type="mariadb" sectionLink="#multiple-databases" multipleText="databases" /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - mariadbdatabase: "mariadb:mysql" -{{% /snippet %}} -{{% snippet name="mariadb" config="service" placeholder="true" %}} - type: mariadb:{{% latest "mariadb" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + mariadb: + +service: + mariadb: + type: mariadb:{{% latest "mariadb" %}} ``` -{{% v2connect2app serviceName="mariadb" relationship="mariadbdatabase" var="MARIADBDATABASE_URL"%}} +{{% v2connect2app serviceName="mariadb" relationship="mariadb" var="MARIADB_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export DB_CONNECTION==${MARIADBDATABASE_SCHEME} -export DB_USERNAME=${MARIADBDATABASE_USERNAME} -export DB_PASSWORD=${MARIADBDATABASE_PASSWORD} -export DB_HOST=${MARIADBDATABASE_HOST} -export DB_PORT=${MARIADBDATABASE_PORT} -export DB_DATABASE=${MARIADBDATABASE_PATH} +export DB_CONNECTION==${MARIADB_SCHEME} +export DB_USERNAME=${MARIADB_USERNAME} +export DB_PASSWORD=${MARIADB_PASSWORD} +export DB_HOST=${MARIADB_HOST} +export DB_PORT=${MARIADB_PORT} +export DB_DATABASE=${MARIADB_PATH} # Surface connection string variable for use in app. export DATABASE_URL="${DB_CONNECTION}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}" @@ -275,19 +280,20 @@ You can configure your MySQL service in the [services configuration](../_index.m Example configuration: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin - properties: - max_allowed_packet: 64 -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin + properties: + max_allowed_packet: 64 ``` ## Access the service directly @@ -295,23 +301,23 @@ Example configuration: You can access the service using the {{< vendor/name >}} CLI by running `{{< vendor/cli >}} sql`. You can also access it from you app container via [SSH](../../development/ssh/_index.md). -From your [relationship data](#relationship-reference), you need: `MARIADBDATABASE_HOST`, `MARIADBDATABASE_PORT`, `MARIADBDATABASE_USERNAME`, `MARIADBDATABASE_PATH` values. +From your [relationship data](#relationship-reference), you need: `MARIADB_HOST`, `MARIADB_PORT`, `MARIADB_USERNAME`, `MARIADB_PATH` values. Then run the following command: ```bash -mysql -h {{< variable "MARIADBDATABASE_HOST" >}} -P {{< variable "MARIADBDATABASE_PORT" >}} -u {{< variable "MARIADBDATABASE_USERNAME" >}} {{< variable "MARIADBDATABASE_PATH" >}} +mysql -h {{< variable "MARIADB_HOST" >}} -P {{< variable "MARIADB_PORT" >}} -u {{< variable "MARIADB_USERNAME" >}} {{< variable "MARIADB_PATH" >}} ``` Assuming the values from the [MariaDB reference](#mariadb-reference), that would be: ```bash -mysql -h mariadbdatabase.internal -P 3306 -u user main +mysql -h mariadb.internal -P 3306 -u user main ``` If your database relationship has a password, pass the `-p` switch and enter the password when prompted: ```bash -mysql -p -h mariadbdatabase.internal -P 3306 -u user main +mysql -p -h mariadb.internal -P 3306 -u user main ``` ## Define permissions @@ -344,17 +350,18 @@ You can also specify multiple `endpoints` for [permissions](#define-permissions) If neither `schemas` nor `endpoints` is included, it's equivalent to the following default: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin ``` If either `schemas` or `endpoints` are defined, no default is applied and you have to specify the full configuration. @@ -376,41 +383,46 @@ Access to the database is defined through three endpoints: * `importer` has SELECT/INSERT/UPDATE/DELETE (but not DDL) access to `legacy` but no access to `main`. ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - - legacy - endpoints: - admin: - default_schema: main - privileges: - main: admin - legacy: admin - reporter: - privileges: - main: ro - importer: - default_schema: legacy - privileges: - legacy: rw -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + - legacy + endpoints: + admin: + default_schema: main + privileges: + main: admin + legacy: admin + reporter: + privileges: + main: ro + importer: + default_schema: legacy + privileges: + legacy: rw ``` Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - database: "mariadb:admin" - reports: "mariadb:reporter" - imports: "mariadb:importer" -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + database: "mariadb:admin" + reports: "mariadb:reporter" + imports: "mariadb:importer" ``` These relationships are then available in the [service environment variables](#relationship-reference). @@ -440,14 +452,15 @@ It offers the following properties: An example of setting these properties: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} - configuration: - properties: - max_allowed_packet: 64 - default_charset: utf8mb4 - default_collation: utf8mb4_unicode_ci -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + properties: + max_allowed_packet: 64 + default_charset: utf8mb4 + default_collation: utf8mb4_unicode_ci ``` You can also change a table's character set and collation through `ALTER TABLE` commands: diff --git a/sites/friday/src/add-services/mysql/mysql-replication.md b/sites/upsun/src/add-services/mysql/mysql-replication.md similarity index 82% rename from sites/friday/src/add-services/mysql/mysql-replication.md rename to sites/upsun/src/add-services/mysql/mysql-replication.md index afb6cfb88c..a2517014c6 100644 --- a/sites/friday/src/add-services/mysql/mysql-replication.md +++ b/sites/upsun/src/add-services/mysql/mysql-replication.md @@ -18,21 +18,22 @@ To set up replication you need to create a replication-enabled user. For each database that you'd like to replicate, you need to assign a `replication` permission/role, under a corresponding `endpoint`: ```yaml {configFile="services"} -{{% snippet name="mariadb" config="service" %}} - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - # Restate the default user to be used by your application. - mysql: - default_schema: main - privileges: - main: admin - replicator: - privileges: - main: replication -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + # Restate the default user to be used by your application. + mysql: + default_schema: main + privileges: + main: admin + replicator: + privileges: + main: replication ``` This creates a `replicator` user, and grants read-only and table locking rights on the `main` database (namely `Select_priv`, `Show_view_priv`, `Create_tmp_table_priv`, `Lock_tables_priv` privileges) along with global replication rights (namely `Repl_slave_priv` and `Repl_client_priv` privileges) and flushing rights (`Reload_priv` used for flushing before reading the binary log position). If there is at least one `replication` permission defined, the bin-logging is enabled on the primary server, which is essential for the replication. @@ -43,15 +44,40 @@ Even if you won't be accessing the replication endpoint from your application, y Add a new relationship to your application container: ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} - -# Other options... - -# Relationships enable an app container's access to a service. -relationships: - database: mariadb:mysql - replication: mariadb:replicator -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + database: + service: mariadb + endpoint: mysql + replication: + service: mariadb + endpoint: replicator + +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + # Restate the default user to be used by your application. + mysql: + default_schema: main + privileges: + main: admin + replicator: + privileges: + main: replication ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/friday/src/add-services/mysql/troubleshoot.md b/sites/upsun/src/add-services/mysql/troubleshoot.md similarity index 100% rename from sites/friday/src/add-services/mysql/troubleshoot.md rename to sites/upsun/src/add-services/mysql/troubleshoot.md diff --git a/sites/upsun/src/add-services/network-storage.md b/sites/upsun/src/add-services/network-storage.md new file mode 100644 index 0000000000..3ba0a472ad --- /dev/null +++ b/sites/upsun/src/add-services/network-storage.md @@ -0,0 +1,267 @@ +--- +title: "Network Storage" +weight: -30 +--- + +The Network Storage service enables a new kind of [mount](../create-apps/app-reference/single-runtime-image.md#mounts) +that refers to a shared service rather than to a local directory. +This service allows you to store data and share it between different apps. + +## Supported versions + +{{% major-minor-versions-note configMinor="true" %}} + +{{< image-versions image="network-storage" status="supported" environment="grid" >}} + +This service is the {{% vendor/name %}} network storage implementation, not the version of a third-party application. + +{{< note theme="warning">}} + +It isn't possible to upgrade or downgrade the network storage service version while keeping existing data in place. +Changing the service version requires that the service be reinitialized. +Any change to the service version results in existing data becoming inaccessible. + +{{< /note >}} + +{{% deprecated-versions %}} + +{{< image-versions image="network-storage" status="deprecated" environment="grid" >}} + +## Usage example + +{{% endpoint-description type="network-storage" noApp=true /%}} + +## Multi-application usage + +If your project contains [multiple apps](../create-apps/multi-app/_index.md), +they may [share `storage` mounts](/create-apps/app-reference/_index.md#data-sharing-through-mounts). + +Alternatively, they may use shared `service` mounts. +If the `source_path` is the same for both apps, +the files are shared between the two applications even if the mount location is different. + +It's also possible to have one app mount a `source_path` that's a subdirectory of another application's mount. +For example: + +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + app1: + # The location of the application's code. + source: + root: "app1" + + [...] + + mounts: + 'web/uploads': + source: service + service: files + source_path: uploads + + # The name of the app container. Must be unique within a project. + app2: + # The location of the application's code. + source: + root: "app2" + + [...] + + mounts: + 'process': + source: service + service: files + source_path: uploads/incoming + 'done': + source: service + service: files + source_path: uploads/done +``` + +In this example, `app1` has access to the entire `uploads` directory by writing to `web/uploads`. +`app2` has two mounts that it can write to: `process` and `done`. +The `process` mount refers to the same directory as the `web/uploads/incoming` directory does on `app1`, +and the `done` mount refers to the same directory as the `web/uploads/done` directory on `app1`. + +## How do I give my workers access to my main application’s files? + +If you need to use a worker with access to the same file mount as your web-serving app, +define all the necessary mounts as `service` mounts. + +The following example assumes a Network Storage service named `files` has been defined in `{{< vendor/configfile "services" >}}`. +Drupal files directories are shared between the `web` and `worker` instances, +while the Drush backup directory is unique to the `web` instance. + +```yaml {configFile="app"} +applications: + myapp: + + source: + root: "/" + + type: "php:{{% latest "php" %}}" + + relationships: + mariadb: + + [...] + + mounts: + # The public and private files directories are + # network mounts shared by web and workers. + 'web/sites/default/files': + source: service + service: files + source_path: files + 'private': + source: service + service: files + source_path: private + # The backup, temp, and cache directories for + # Drupal's CLI tools don't need to be shared between web and workers. + # It wouldn't hurt anything to make them network + # shares, however. + '/.drush': + source: storage + source_path: drush + 'tmp': + source: tmp + source_path: tmp + 'drush-backups': + source: storage + source_path: drush-backups + '/.console': + source: storage + source_path: console + + # Crons run on the web container, so they have the + # same mounts as the web container. + crons: + drupal: + spec: '*/20 * * * *' + commands: + start: 'cd web ; drush core-cron' + + # The worker defined here also has the same 6 mounts; + # 2 of them are shared with the web container, + # the other 4 are local to the worker. + workers: + queue: + commands: + start: | + cd web && drush queue-run myqueue +``` + +## How can I migrate data from a `storage` mount to a `service` mount? + +Network Storage `service` mounts can be shared between different apps, +while `storage` mounts can only be shared between different _instances_ of the same app. +To move data from a `storage` mount to a `service` one, follow these instructions. + +Assuming you have the following `storage` mount: + +```yaml {configFile="app"} +applications: + myapp: + + [...] + + mounts: + web/uploads: + source: storage + source_path: uploads +``` + +1. Add a new `network-storage` service to your configuration: + + ```yaml {configFile="services"} + applications: + myapp: + + [...] + + mounts: + web/uploads: + source: storage + source_path: uploads + + services: + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} + ``` + + {{< note >}} + + Make sure you [allocate enough disk space](/manage-resources/adjust-resources.md#vertical-scaling) to your `network-storage` service + for your existing files with some buffer. + + {{< /note >}} + +2. Add a new `service` mount, named `new-uploads`: + + ```yaml {configFile="services"} + applications: + myapp: + + [...] + + mounts: + web/uploads: + source: storage + source_path: uploads + new-uploads: + source: service + service: files + source_path: uploads + + services: + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} + ``` + + Note that each mount is on a different storage service, which is why they can have the same `source_path`. + +3. Deploy your changes. + +4. Copy all your files from the `storage` (`web/uploads`) mount to the `service` (`new-uploads`) mount using `rsync`: + + ```bash + rsync -avz web/uploads/* new-uploads/ + ``` + +5. Reverse the mounts. + To do so, rename the `storage` mount to `old-uploads`, and point the `web/uploads` directory to the `service` mount: + + ```yaml {configFile="services"} + applications: + myapp: + + [...] + + mounts: + old-uploads: + source: storage + source_path: uploads + web/uploads: + source: service + service: files + source_path: uploads + + services: + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} + ``` + +6. Push your changes and check that the files are now accessible from the `service` mount (now named `web/uploads`). + To check that no files were lost during the transfer, run the following command: + + ```bash + rsync -avz old-uploads/* web/uploads/ + ``` + +7. Delete the contents of the `old-uploads` `storage` mount before removing it. + +8. Push your changes again. diff --git a/sites/friday/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md similarity index 79% rename from sites/friday/src/add-services/opensearch.md rename to sites/upsun/src/add-services/opensearch.md index f4300a95f7..349d467fcf 100644 --- a/sites/friday/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -43,24 +43,24 @@ title= Service environment variables {{% service-values-change %}} ```bash -OSSEARCH_USERNAME= -OSSEARCH_SCHEME=http -OSSEARCH_SERVICE=opensearch -OSSEARCH_FRAGMENT= -OSSEARCH_IP=123.456.78.90 -OSSEARCH_INSTANCE_IPS=['123.456.78.90'] -OSSEARCH_HOSTNAME=azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}} -OSSEARCH_PORT=9200 -OSSEARCH_CLUSTER=azertyuiopqsdf-main-afdwftq -OSSEARCH_EPOCH=0 -OSSEARCH_HOST=ossearch.internal -OSSEARCH_REL=opensearch -OSSEARCH_PATH= -OSSEARCH_PASSWORD=ChangeMe -OSSEARCH_QUERY={} -OSSEARCH_TYPE=opensearch:{{% latest "opensearch" %}} -OSSEARCH_PUBLIC=false -OSSEARCH_HOST_MAPPED=false +OPENSEARCH_USERNAME= +OPENSEARCH_SCHEME=http +OPENSEARCH_SERVICE=opensearch +OPENSEARCH_FRAGMENT= +OPENSEARCH_IP=123.456.78.90 +OPENSEARCH_INSTANCE_IPS=['123.456.78.90'] +OPENSEARCH_HOSTNAME=azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}} +OPENSEARCH_PORT=9200 +OPENSEARCH_CLUSTER=azertyuiopqsdf-main-afdwftq +OPENSEARCH_EPOCH=0 +OPENSEARCH_HOST=opensearch.internal +OPENSEARCH_REL=opensearch +OPENSEARCH_PATH= +OPENSEARCH_PASSWORD=ChangeMe +OPENSEARCH_QUERY={} +OPENSEARCH_TYPE=opensearch:{{% latest "opensearch" %}} +OPENSEARCH_PUBLIC=false +OPENSEARCH_HOST_MAPPED=false ``` <---> @@ -82,7 +82,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 9200, "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "ossearch.internal", + "host": "opensearch.internal", "rel": "opensearch", "path": null, "query": [], @@ -100,7 +100,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_OPENSEARCH_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.ossearch[0].host')" +export APP_OPENSEARCH_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.opensearch[0].host')" ``` {{< /codetabs >}} @@ -114,28 +114,37 @@ export APP_OPENSEARCH_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.ossearch[0].ho To use the configured service in your app, add a configuration file similar to the following to your project. ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. -relationships: - ossearch: "opensearch:opensearch" -{{% /snippet %}} -{{% snippet name="opensearch" config="service" placeholder="true" %}} - type: opensearch:{{% latest "opensearch" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + opensearch: + +services: + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} ``` -{{% v2connect2app serviceName="opensearch" relationship="ossearch" var="OSSEARCH_HOSTS" %}} +{{% v2connect2app serviceName="opensearch" relationship="opensearch" var="OPENSEARCH_HOSTS" %}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export OS_SCHEME=${OSSEARCH_SCHEME} -export OS_HOST=${OSSEARCH_HOST} -export OS_PORT=${OSSEARCH_PORT} +export OS_SCHEME=${OPENSEARCH_SCHEME} +export OS_HOST=${OPENSEARCH_HOST} +export OS_PORT=${OPENSEARCH_PORT} # Surface more common OpenSearch connection string variables for use in app. -export OPENSEARCH_USERNAME=${OSSEARCH_USERNAME} -export OPENSEARCH_PASSWORD=${OSSEARCH_PASSWORD} +export OS_USERNAME=${OPENSEARCH_USERNAME} +export OS_PASSWORD=${OPENSEARCH_PASSWORD} export OPENSEARCH_HOSTS=[\"$OS_SCHEME://$OS_HOST:$OS_PORT\"] ``` @@ -158,17 +167,18 @@ You may optionally enable HTTP Basic authentication. To do so, include the following in your `{{< vendor/configfile "services" >}}` configuration: ```yaml {configFile="services"} -{{% snippet name="opensearch" config="service" %}} - type: opensearch:{{% latest "opensearch" %}} - configuration: - authentication: - enabled: true -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} + configuration: + authentication: + enabled: true ``` That enables mandatory HTTP Basic auth on all requests. The credentials are available in any relationships that point at that service, -in the `OSSEARCH_USERNAME` and `OSSEARCH_PASSWORD` [service environment variables](/development/variables/_index.md#service-environment-variables). +in the `OPENSEARCH_USERNAME` and `OPENSEARCH_PASSWORD` [service environment variables](/development/variables/_index.md#service-environment-variables). {{% service-values-change %}} This functionality is generally not required if OpenSearch isn't exposed on its own public HTTP route. @@ -178,13 +188,20 @@ To do so, add a route to `{{< vendor/configfile "routes" >}}` that has `opensear For example: ```yaml {configFile="routes"} -{{% snippet name="opensearch:opensearch" config="route" subDom="os" / %}} -{{% snippet name="opensearch" config="service" placeholder="true" %}} - type: opensearch:{{% latest "opensearch" %}} - configuration: - authentication: - enabled: true -{{% /snippet %}} +routes: + "https://www.os.{default}/": + type: redirect + to: "https://os.{default}/" + "https://os.{default}/": + type: upstream + upstream: "opensearch:opensearch" + +services: + # The name of the service container. Must be unique within a project. + opensearch: + configuration: + authentication: + enabled: true ``` ## Plugins @@ -193,13 +210,13 @@ OpenSearch offers a number of plugins. To enable them, list them under the `configuration.plugins` key in your `{{< vendor/configfile "services" >}}` file, like so: ```yaml {configFile="services"} -{{% snippet name="opensearch" config="service" %}} - type: "opensearch:{{% latest "opensearch" %}}" - configuration: - plugins: - - analysis-icu - - lang-python -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + opensearch: + configuration: + plugins: + - analysis-icu + - lang-python ``` In this example you'd have the ICU analysis plugin and the size mapper plugin. diff --git a/sites/friday/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md similarity index 75% rename from sites/friday/src/add-services/postgresql.md rename to sites/upsun/src/add-services/postgresql.md index 6f7bfd4190..5693a6a131 100644 --- a/sites/friday/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -43,23 +43,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -POSTGRESQLDATABASE_USERNAME=main -POSTGRESQLDATABASE_SCHEME=pgsql -POSTGRESQLDATABASE_SERVICE=postgresql -POSTGRESQLDATABASE_FRAGMENT= -POSTGRESQLDATABASE_IP=123.456.78.90 -POSTGRESQLDATABASE_HOSTNAME=azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}} -POSTGRESQLDATABASE_PORT=5432 -POSTGRESQLDATABASE_CLUSTER=azertyuiopqsdf-main-afdwftq -POSTGRESQLDATABASE_EPOCH=0 -POSTGRESQLDATABASE_HOST=postgresqldatabase.internal -POSTGRESQLDATABASE_REL=postgresql -POSTGRESQLDATABASE_PATH=main -POSTGRESQLDATABASE_QUERY={'is_master': True} -POSTGRESQLDATABASE_PASSWORD=ChangeMe -POSTGRESQLDATABASE_TYPE=postgresql:{{% latest "postgresql" %}} -POSTGRESQLDATABASE_PUBLIC=false -POSTGRESQLDATABASE_HOST_MAPPED=false +POSTGRESQL_USERNAME=main +POSTGRESQL_SCHEME=pgsql +POSTGRESQL_SERVICE=postgresql +POSTGRESQL_FRAGMENT= +POSTGRESQL_IP=123.456.78.90 +POSTGRESQL_HOSTNAME=azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}} +POSTGRESQL_PORT=5432 +POSTGRESQL_CLUSTER=azertyuiopqsdf-main-afdwftq +POSTGRESQL_EPOCH=0 +POSTGRESQL_HOST=postgresql.internal +POSTGRESQL_REL=postgresql +POSTGRESQL_PATH=main +POSTGRESQL_QUERY={'is_master': True} +POSTGRESQL_PASSWORD=ChangeMe +POSTGRESQL_TYPE=postgresql:{{% latest "postgresql" %}} +POSTGRESQL_PUBLIC=false +POSTGRESQL_HOST_MAPPED=false ``` <---> @@ -81,7 +81,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 5432, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "postgresqldatabase.internal", + "host": "postgresql.internal", "rel": "postgresql", "path": "main", "query": { @@ -101,7 +101,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_POSTGRESQL_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresqldatabase[0].host')" +export APP_POSTGRESQL_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].host')" ``` {{< /codetabs >}} @@ -111,27 +111,36 @@ export APP_POSTGRESQL_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresqldata {{% endpoint-description type="postgresql" php=true /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. -relationships: - postgresqldatabase: "postgresql:postgresql" -{{% /snippet %}} -{{% snippet name="postgresql" config="service" placeholder="true" %}} - type: postgresql:{{% latest "postgresql" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + postgresql: + +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` -{{% v2connect2app serviceName="postgresql" relationship="postgresqldatabase" var="DATABASE_URL"%}} +{{% v2connect2app serviceName="postgresql" relationship="postgresql" var="DATABASE_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export DB_CONNECTION="${POSTGRESQLDATABASE_SCHEME}" -export DB_USERNAME="${POSTGRESQLDATABASE_USERNAME}" -export DB_PASSWORD="${POSTGRESQLDATABASE_PASSWORD}" -export DB_HOST="${POSTGRESQLDATABASE_HOST}" -export DB_PORT="${POSTGRESQLDATABASE_PORT}" -export DB_DATABASE="${POSTGRESQLDATABASE_PATH}" +export DB_CONNECTION="${POSTGRESQL_SCHEME}" +export DB_USERNAME="${POSTGRESQL_USERNAME}" +export DB_PASSWORD="${POSTGRESQL_PASSWORD}" +export DB_HOST="${POSTGRESQL_HOST}" +export DB_PORT="${POSTGRESQL_PORT}" +export DB_DATABASE="${POSTGRESQL_PATH}" # Surface connection string variable for use in app. export DATABASE_URL="${DB_CONNECTION}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}" @@ -144,17 +153,17 @@ export DATABASE_URL="${DB_CONNECTION}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST} Access the service using the {{< vendor/name >}} CLI by running `{{< vendor/cli >}} sql`. You can also access it from your app container via [SSH](../development/ssh/_index.md). -From your [relationship data](#relationship-reference), you need: `POSTGRESQLDATABASE_USERNAME`, `POSTGRESQLDATABASE_HOST`, and `POSTGRESQLDATABASE_PORT`. +From your [relationship data](#relationship-reference), you need: `POSTGRESQL_USERNAME`, `POSTGRESQL_HOST`, and `POSTGRESQL_PORT`. Then run the following command: ```bash -psql -U {{< variable "POSTGRESQLDATABASE_USERNAME" >}} -h {{< variable "POSTGRESQLDATABASE_HOST" >}} -p {{< variable "POSTGRESQLDATABASE_PORT" >}} +psql -U {{< variable "POSTGRESQL_USERNAME" >}} -h {{< variable "POSTGRESQL_HOST" >}} -p {{< variable "POSTGRESQL_PORT" >}} ``` Using the values from the [example](#relationship-reference), that would be: ```bash -psql -U main -h postgresqldatabase.internal -p 5432 +psql -U main -h postgresql.internal -p 5432 ``` {{% service-values-change %}} @@ -170,7 +179,7 @@ The easiest way to download all data in a PostgreSQL instance is with the {{< ve If you have multiple SQL databases it prompts you which one to export. You can also specify one by relationship name explicitly: ```bash -{{% vendor/cli %}} db:dump --relationship postgresqldatabase +{{% vendor/cli %}} db:dump --relationship postgresql ``` By default the file is uncompressed. If you want to compress it, use the `--gzip` (`-z`) option: @@ -205,7 +214,7 @@ That works for any SQL file, so the usual caveats about importing an SQL dump ap As with exporting, you can also specify a specific environment to use and a specific database relationship to use, if there are multiple. ```bash -{{% vendor/cli %}} sql --relationship postgresqldatabase -e {{< variable "BRANCH_NAME" >}} < my_database_backup.sql +{{% vendor/cli %}} sql --relationship postgresql -e {{< variable "BRANCH_NAME" >}} < my_database_backup.sql ``` {{< note >}} @@ -236,26 +245,27 @@ Under the `configuration` key of your service there are two additional keys: Consider the following illustrative example: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro + importer: + default_database: legacy + privileges: + legacy: rw ``` This example creates a single PostgreSQL service named `postgresql`. The server has two databases, `main` and `legacy` with three endpoints created. @@ -269,33 +279,47 @@ If a given endpoint has access to multiple databases you should also specify whi Once these endpoints are defined, you need to expose them to your application as a relationship. Continuing with the above example, your `relationships` in `{{< vendor/configfile "app" >}}` might look like: ```yaml {configFile="app"} -{{% snippet name="false" config="app" root="false" %}} -relationships: - database: "postgresql:admin" - reports: "postgresql:reporter" - imports: "postgresql:importer" -{{% /snippet %}} - -{{% snippet name="postgresql" config="service" placeholder="true" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + + source: + root: "/" + + [...] + + relationships: + database: + service: postgresql + endpoint: admin + reports: + service: postgresql + endpoint: reporter + imports: + service: postgresql + endpoint: importer + +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro + importer: + default_database: legacy + privileges: + legacy: rw ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -304,47 +328,50 @@ They'll be available in the [service environment variables](/development/variabl A service configuration without the `configuration` block defined is equivalent to the following default values: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - endpoints: - postgresql: - default_database: main - privileges: - main: admin -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + endpoints: + postgresql: + default_database: main + privileges: + main: admin ``` If you do not define `database` but `endpoints` are defined, then the single database `main` is created with the following assumed configuration: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - endpoints: -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + endpoints: ``` Alternatively, if you define multiple databases but no endpoints, a single user `main` is created with `admin` access to each of your databases, equivalent to the configuration below: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - firstdb - - seconddb - - thirddb - endpoints: - main: - firstdb: admin - seconddb: admin - thirddb: admin -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - firstdb + - seconddb + - thirddb + endpoints: + main: + firstdb: admin + seconddb: admin + thirddb: admin ``` {{% databases-passwords %}} @@ -358,13 +385,14 @@ To change the timezone for the current session, run `SET TIME ZONE {{< variable {{% vendor/name %}} supports a number of PostgreSQL extensions. To enable them, list them under the `configuration.extensions` key in your `{{< vendor/configfile "services" >}}` file, like so: ```yaml {configFile="services"} -{{% snippet name="postgresql" config="service" %}} - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - extensions: - - pg_trgm - - hstore -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + extensions: + - pg_trgm + - hstore ``` In this case, you have `pg_trgm` installed, providing functions to determine the similarity of text based on trigram matching, and `hstore` providing a key-value store. diff --git a/sites/friday/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md similarity index 77% rename from sites/friday/src/add-services/rabbitmq.md rename to sites/upsun/src/add-services/rabbitmq.md index 8efb591f15..c41223956a 100644 --- a/sites/friday/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -36,23 +36,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -RABBITMQQUEUE_USERNAME=guest -RABBITMQQUEUE_SCHEME=amqp -RABBITMQQUEUE_SERVICE=rabbitmq -RABBITMQQUEUE_FRAGMENT= -RABBITMQQUEUE_EPOCH=0 -RABBITMQQUEUE_IP=123.456.78.90 -RABBITMQQUEUE_HOSTNAME=azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}} -RABBITMQQUEUE_PORT=5672 -RABBITMQQUEUE_CLUSTER=azertyuiop-main-afdwftq -RABBITMQQUEUE_HOST=rabbitmqqueue.internal -RABBITMQQUEUE_REL=rabbitmq -RABBITMQQUEUE_PATH= -RABBITMQQUEUE_QUERY={} -RABBITMQQUEUE_PASSWORD=ChangeMe -RABBITMQQUEUE_TYPE=rabbitmq:{{% latest "rabbitmq" %}} -RABBITMQQUEUE_PUBLIC=false -RABBITMQQUEUE_HOST_MAPPED=false +RABBITMQ_USERNAME=guest +RABBITMQ_SCHEME=amqp +RABBITMQ_SERVICE=rabbitmq +RABBITMQ_FRAGMENT= +RABBITMQ_EPOCH=0 +RABBITMQ_IP=123.456.78.90 +RABBITMQ_HOSTNAME=azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}} +RABBITMQ_PORT=5672 +RABBITMQ_CLUSTER=azertyuiop-main-afdwftq +RABBITMQ_HOST=rabbitmq.internal +RABBITMQ_REL=rabbitmq +RABBITMQ_PATH= +RABBITMQ_QUERY={} +RABBITMQ_PASSWORD=ChangeMe +RABBITMQ_TYPE=rabbitmq:{{% latest "rabbitmq" %}} +RABBITMQ_PUBLIC=false +RABBITMQ_HOST_MAPPED=false ``` <---> @@ -74,7 +74,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 5672, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "rabbitmqqueue.internal", + "host": "rabbitmq.internal", "rel": "rabbitmq", "path": null, "query": [], @@ -92,7 +92,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_RABBITMQ_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.rabbitmqqueue[0].host')" +export APP_RABBITMQ_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.rabbitmq[0].host')" ``` {{< /codetabs >}} @@ -102,27 +102,35 @@ export APP_RABBITMQ_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.rabbitmqqueue[0] {{% endpoint-description type="rabbitmq" /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. -relationships: - rabbitmqqueue: "rabbitmq:rabbitmq" -{{% /snippet %}} -{{% snippet name="rabbitmq" config="service" placeholder="true" %}} - type: rabbitmq:{{% latest "rabbitmq" %}} - disk: 256 -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + rabbitmq: + +services: + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} ``` -{{% v2connect2app serviceName="rabbitmq" relationship="rabbitmqqueue" var="AMQP_URL"%}} +{{% v2connect2app serviceName="rabbitmq" relationship="rabbitmq" var="AMQP_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export QUEUE_SCHEME=${RABBITMQQUEUE_SCHEME} -export QUEUE_USERNAME=${RABBITMQQUEUE_USERNAME} -export QUEUE_PASSWORD=${RABBITMQQUEUE_PASSWORD} -export QUEUE_HOST=${RABBITMQQUEUE_HOST} -export QUEUE_PORT=${RABBITMQQUEUE_PORT} +export QUEUE_SCHEME=${RABBITMQ_SCHEME} +export QUEUE_USERNAME=${RABBITMQ_USERNAME} +export QUEUE_PASSWORD=${RABBITMQ_PASSWORD} +export QUEUE_HOST=${RABBITMQ_HOST} +export QUEUE_PORT=${RABBITMQ_PORT} # Set a single RabbitMQ connection string variable for AMQP. export AMQP_URL="${QUEUE_SCHEME}://${QUEUE_USERNAME}:${QUEUE_PASSWORD}@${QUEUE_HOST}:${QUEUE_PORT}/" @@ -186,13 +194,14 @@ which can be useful for separating resources, such as exchanges, queues, and bin To create virtual hosts, add them to your configuration as in the following example: ```yaml {configFile="services"} -{{% snippet name="rabbitmq" config="service" %}} - type: "rabbitmq:{{% latest "rabbitmq" %}}" - configuration: - vhosts: - - host1 - - host2 -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + rabbitmq: + type: "rabbitmq:{{% latest "rabbitmq" %}}" + configuration: + vhosts: + - host1 + - host2 ``` ## Upgrading diff --git a/sites/friday/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md similarity index 69% rename from sites/friday/src/add-services/redis.md rename to sites/upsun/src/add-services/redis.md index 140eb2d76e..e4d0f26116 100644 --- a/sites/friday/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -51,23 +51,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -REDISCACHE_USERNAME= -REDISCACHE_SCHEME=redis -REDISCACHE_SERVICE=redis -REDISCACHE_FRAGMENT= -REDISCACHE_IP=123.456.78.90 -REDISCACHE_EPOCH=0 -REDISCACHE_HOSTNAME=azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}} -REDISCACHE_PORT=6379 -REDISCACHE_CLUSTER=azertyuiopqsdf-main-afdwftq -REDISCACHE_HOST=rediscache.internal -REDISCACHE_REL=redis -REDISCACHE_PATH= -REDISCACHE_QUERY={} -REDISCACHE_PASSWORD= -REDISCACHE_TYPE=redis:{{% latest "redis" %}} -REDISCACHE_PUBLIC=false -REDISCACHE_HOST_MAPPED=false +REDIS_USERNAME= +REDIS_SCHEME=redis +REDIS_SERVICE=redis +REDIS_FRAGMENT= +REDIS_IP=123.456.78.90 +REDIS_EPOCH=0 +REDIS_HOSTNAME=azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}} +REDIS_PORT=6379 +REDIS_CLUSTER=azertyuiopqsdf-main-afdwftq +REDIS_HOST=rediscache.internal +REDIS_REL=redis +REDIS_PATH= +REDIS_QUERY={} +REDIS_PASSWORD= +REDIS_TYPE=redis:{{% latest "redis" %}} +REDIS_PUBLIC=false +REDIS_HOST_MAPPED=false ``` <---> @@ -89,7 +89,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 6379, "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "rediscache.internal", + "host": "redis.internal", "rel": "redis", "path": null, "query": [], @@ -107,7 +107,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_REDIS_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.rediscache[0].host')" +export APP_REDIS_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.redis[0].host')" ``` {{< /codetabs >}} @@ -168,9 +168,14 @@ To define the relationship, use the `redis` endpoint : applications: # The name of the app container. Must be unique within a project. : + source: + root: "myapp" + + [...] + # Relationships enable access from this app to a given service. relationships: - : ":redis" + : services: # The name of the service container. Must be unique within a project. @@ -178,21 +183,32 @@ services: type: redis-persistent: ``` -You can define `` and `` as you like, but it’s best if they’re distinct. -With this definition, the application container now has access to the service via the relationship ``. -For PHP, enable the extension for the service: +You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) (the network address a service is accessible from) that is identical to the name of that service. + +Depending on your needs, instead of default endpoint configuration, you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + source: + root: "myapp" + + [...] + runtime: extensions: - redis + # Relationships enable access from this app to a given service. relationships: - : ":redis" + : services: # The name of the service container. Must be unique within a project. @@ -204,13 +220,18 @@ services: #### [Service](/add-services/_index.md) and [app](/create-apps/_index.md) configuration -```yaml {configFile="services"} +```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. - myapp: + : + source: + root: "myapp" + + [...] + # Relationships enable access from this app to a given service. relationships: - rediscache: "redis:redis" + redis: services: # The name of the service container. Must be unique within a project. @@ -223,31 +244,36 @@ services: To use the configured service in your app, add a configuration file similar to the following to your project. ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] -# Other options... + # Relationships enable access from this app to a given service. + relationships: + redis: -# Relationships enable an app container's access to a service. -relationships: - rediscache: "redis:redis" -{{% /snippet %}} -{{% snippet name="redis" config="service" placeholder="true" %}} - type: redis-persistent:{{% latest "redis" %}} -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} ``` -{{% v2connect2app serviceName="redis" relationship="rediscache" var="REDIS_URL"%}} +{{% v2connect2app serviceName="redis" relationship="redis" var="CACHE_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export CACHE_HOST="${REDISCACHE_HOST}" -export CACHE_PORT="${REDISCACHE_PORT}" -export CACHE_PASSWORD="${REDISCACHE_PASSWORD}" -export CACHE_SCHEME="${REDISCACHE_SCHEME}" +export CACHE_HOST="${REDIS_HOST}" +export CACHE_PORT="${REDIS_PORT}" +export CACHE_PASSWORD="${REDIS_PASSWORD}" +export CACHE_SCHEME="${REDIS_SCHEME}" # Surface a Redis connection string for use in app. -export REDIS_URL="${CACHE_SCHEME}://${CACHE_PASSWORD}@${CACHE_HOST}:${CACHE_PORT}" +export CACHE_URL="${CACHE_SCHEME}://${CACHE_PASSWORD}@${CACHE_HOST}:${CACHE_PORT}" ``` {{% /v2connect2app %}} @@ -291,9 +317,14 @@ To define the relationship, use the `redis` endpoint : applications: # The name of the app container. Must be unique within a project. : + source: + root: "myapp" + + [...] + # Relationships enable access from this app to a given service. relationships: - : ":redis" + : services: # The name of the service container. Must be unique within a project. @@ -301,21 +332,32 @@ services: type: redis: ``` -You can define `` and `` as you like, but it’s best if they’re distinct. -With this definition, the application container now has access to the service via the relationship ``. -For PHP, enable the extension for the service: +You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. + +The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships. That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference/single-runtime-image#relationships) (the network address a service is accessible from) that is identical to the name of that service. + +Depending on your needs, instead of default endpoint configuration, you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships). + +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + source: + root: "myapp" + + [...] + runtime: extensions: - redis + # Relationships enable access from this app to a given service. relationships: - : ":redis" + : services: # The name of the service container. Must be unique within a project. @@ -330,10 +372,15 @@ services: ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. - myapp: + : + source: + root: "myapp" + + [...] + # Relationships enable access from this app to a given service. relationships: - rediscache: "redis:redis" + redis: services: # The name of the service container. Must be unique within a project. @@ -346,31 +393,36 @@ services: To use the configured service in your app, add a configuration file similar to the following to your project. ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] -# Other options... + # Relationships enable access from this app to a given service. + relationships: + redis: -# Relationships enable an app container's access to a service. -relationships: - rediscache: "redis:redis" -{{% /snippet %}} -{{% snippet name="redis" config="service" placeholder="true" %}} - type: redis:{{% latest "redis" %}} -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} ``` -{{% v2connect2app serviceName="redis" relationship="rediscache" var="REDIS_URL"%}} +{{% v2connect2app serviceName="redis" relationship="redis" var="CACHE_URL"%}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export CACHE_HOST="${REDISCACHE_HOST}" -export CACHE_PORT="${REDISCACHE_PORT}" -export CACHE_PASSWORD="${REDISCACHE_PASSWORD}" -export CACHE_SCHEME="${REDISCACHE_SCHEME}" +export CACHE_HOST="${REDIS_HOST}" +export CACHE_PORT="${REDIS_PORT}" +export CACHE_PASSWORD="${REDIS_PASSWORD}" +export CACHE_SCHEME="${REDIS_SCHEME}" # Surface a Redis connection string for use in app. -export REDIS_URL="${CACHE_SCHEME}://${CACHE_PASSWORD}@${CACHE_HOST}:${CACHE_PORT}" +export CACHE_URL="${CACHE_SCHEME}://${CACHE_PASSWORD}@${CACHE_HOST}:${CACHE_PORT}" ``` {{% /v2connect2app %}} @@ -395,7 +447,7 @@ Use the Redis [`select` command](https://redis.io/commands/select): ```php connect(getenv('CACHE_HOST'), getenv('CACHE_PORT')); +$redis->connect(getenv('REDIS_HOST'), getenv('REDIS_PORT')); $redis->select(0); // switch to DB 0 $redis->set('x', '42'); // write 42 to x @@ -417,8 +469,8 @@ the Python library suggests using separate client instances for each database: import os from redis import Redis -database0 = Redis(host=os.getenv('CACHE_HOST'), port=os.getenv('CACHE_PORT'), db=0) -database1 = Redis(host=os.getenv('CACHE_HOST'), port=os.getenv('CACHE_PORT'), db=1) +database0 = Redis(host=os.getenv('REDIS_HOST'), port=os.getenv('REDIS_PORT'), db=0) +database1 = Redis(host=os.getenv('REDIS_HOST'), port=os.getenv('REDIS_PORT'), db=1) ``` <---> @@ -432,7 +484,7 @@ Use the Redis [`select` command](https://redis.io/commands/select): ```javascript const redis = require('redis'); -const client = redis.createClient(process.env.CACHE_PORT, process.env.CACHE_HOST); +const client = redis.createClient(process.env.REDIS_PORT, process.env.REDIS_HOST); await client.SELECT(0); // switch to DB 0 await client.set('x', '42'); // write 42 to x @@ -450,11 +502,12 @@ it triggers a cache cleanup. To customize those cache cleanups, set up an eviction policy such as the following: ```yaml {configFile="services"} -{{% snippet name="redis" config="service" %}} - type: "redis:{{% latest "redis" %}}" - configuration: - maxmemory_policy: allkeys-lfu -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + redis: + type: "redis:{{% latest "redis" %}}" + configuration: + maxmemory_policy: allkeys-lfu ``` The following table presents the possible values: @@ -486,7 +539,7 @@ After you've retrieved the hostname and port, [open an SSH session](../developme To access your Redis service, run the following command: ```bash -redis-cli -h {{< variable "REDISCACHE_HOSTNAME" >}} -p {{< variable "REDISCACHE_PORT" >}} +redis-cli -h {{< variable "REDIS_HOSTNAME" >}} -p {{< variable "REDIS_PORT" >}} ``` {{% version/specific %}} @@ -497,7 +550,7 @@ Note that the `CONFIG GET` and `CONFIG SET` admin commands might be restricted o {{% /version/specific %}} ```bash -redis-cli -h {{< variable "REDISCACHE_HOSTNAME" >}} -p {{< variable "REDISCACHE_PORT" >}} info +redis-cli -h {{< variable "REDIS_HOSTNAME" >}} -p {{< variable "REDIS_PORT" >}} info ``` ## Use Redis as a handler for PHP sessions @@ -509,32 +562,31 @@ which means Redis stores and retrieves the data saved into sessions. To set up Redis as your session handler, add a configuration similar to the following: -```yaml {configFile="services" v2Hide="true"} -{{% snippet name="data" config="service" %}} - type: "redis-persistent:{{% latest "redis" %}}" -{{% /snippet %}} -``` - ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="false" %}} -type: "php:{{% latest "php" %}}" - -relationships: - sessionstorage: "data:redis" - -variables: - php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" - -web: - locations: - '/': - root: 'web' - passthru: '/index.php' -{{% /snippet %}} - -{{% snippet name="data" config="service" placeholder="true" %}} - type: "redis-persistent:{{% latest "redis" %}}" -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + source: + root: "myapp" + + type: "php:{{% latest "php" %}}" + + relationships: + redissession: + + variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" + + web: + locations: + '/': + root: 'web' + passthru: '/index.php' + +services: + # The name of the service container. Must be unique within a project. + redissession: + type: "redis-persistent:{{% latest "redis" %}}" ``` diff --git a/sites/friday/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md similarity index 72% rename from sites/friday/src/add-services/solr.md rename to sites/upsun/src/add-services/solr.md index 8b42965d26..06407f408b 100644 --- a/sites/friday/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -36,23 +36,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -SOLRSEARCH_USERNAME= -SOLRSEARCH_SCHEME=solr -SOLRSEARCH_SERVICE=solr -SOLRSEARCH_IP=123.456.78.90 -SOLRSEARCH_FRAGMENT= -SOLRSEARCH_HOSTNAME=azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}} -SOLRSEARCH_PORT=8080 -SOLRSEARCH_CLUSTER=azertyuiopqsdf-main-afdwftq -SOLRSEARCH_HOST=solrsearch.internal -SOLRSEARCH_REL=solr -SOLRSEARCH_PATH=solr/collection1 -SOLRSEARCH_QUERY={} -SOLRSEARCH_PASSWORD= -SOLRSEARCH_EPOCH=0 -SOLRSEARCH_TYPE=solr:{{% latest "solr" %}} -SOLRSEARCH_PUBLIC=false -SOLRSEARCH_HOST_MAPPED=false +SOLR_USERNAME= +SOLR_SCHEME=solr +SOLR_SERVICE=solr +SOLR_IP=123.456.78.90 +SOLR_FRAGMENT= +SOLR_HOSTNAME=azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}} +SOLR_PORT=8080 +SOLR_CLUSTER=azertyuiopqsdf-main-afdwftq +SOLR_HOST=solr.internal +SOLR_REL=solr +SOLR_PATH=solr/collection1 +SOLR_QUERY={} +SOLR_PASSWORD= +SOLR_EPOCH=0 +SOLR_TYPE=solr:{{% latest "solr" %}} +SOLR_PUBLIC=false +SOLR_HOST_MAPPED=false ``` <---> @@ -74,7 +74,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "port": 8080, "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "solrsearch.internal", + "host": "solr.internal", "rel": "solr", "path": "solr\/collection1", "query": [], @@ -92,7 +92,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_SOLR_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.solrsearch[0].host')" +export APP_SOLR_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.solr[0].host')" ``` {{< /codetabs >}} @@ -102,27 +102,36 @@ export APP_SOLR_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.solrsearch[0].host') {{% endpoint-description type="solr" sectionLink="#solr-6-and-later" multipleText="cores" /%}} ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="myapp" %}} -# Relationships enable an app container's access to a service. -relationships: - solrsearch: "solr:solr" -{{% /snippet %}} -{{% snippet name="solr" config="service" placeholder="true" %}} - type: solr:{{% latest "solr" %}} -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + solrsearch: "solr:solr" + +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} ``` -{{% v2connect2app serviceName="solr" relationship="solrsearch" var="SOLR_URL" %}} +{{% v2connect2app serviceName="solr" relationship="solr" var="SEARCH_URL" %}} ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit {{< vendor/urlraw "docs" >}}/development/variables.html#service-environment-variables. -export SOLR_HOST=${SOLRSEARCH_HOST} -export SOLR_PORT=${SOLRSEARCH_PORT} -export SOLR_PATH=${SOLRSEARCH_PATH} +export SEARCH_HOST=${SOLR_HOST} +export SEARCH_PORT=${SOLR_PORT} +export SEARCH_PATH=${SOLR_PATH} # Surface more common Solr connection string variables for use in app. -export SOLR_URL="http://${CACHE_HOST}:${CACHE_PORT}/${CACHE_PATH}" +export SEARCH_URL="http://${SEARCH_HOST}:${SEARCH_PORT}/${SEARCH_PATH}" ``` {{% /v2connect2app %}} @@ -134,11 +143,12 @@ For Solr 4, {{% vendor/name %}} supports only a single core per server called `c You must provide your own Solr configuration via a `core_config` key in your `{{< vendor/configfile "services" >}}`: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: "solr:4.10" - configuration: - core_config: !archive "{{< variable "DIRECTORY" >}}" -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: "solr:4.10" + configuration: + core_config: !archive "{{< variable "DIRECTORY" >}}" ``` {{< variable "DIRECTORY" >}} points to a directory in the Git repository, in or below the `{{< vendor/configdir >}}/` folder. This directory needs to contain everything that Solr needs to start a core. At the minimum, `solrconfig.xml` and `schema.xml`. @@ -146,11 +156,12 @@ You must provide your own Solr configuration via a `core_config` key in your `{{ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the `schema.xml` file is located at `{{< vendor/configdir >}}/solr/conf/schema.xml`. You can then reference that path like this - ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: "solr:4.10" - configuration: - core_config: !archive "solr/conf/" -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: "solr:4.10" + configuration: + core_config: !archive "solr/conf/" ``` ## Solr 6 and later @@ -158,20 +169,21 @@ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the ` For Solr 6 and later {{% vendor/name %}} supports multiple cores via different endpoints. Cores and endpoints are defined separately, with endpoints referencing cores. Each core may have its own configuration or share a configuration. It is best illustrated with an example. ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: solr:{{% latest "solr" %}} - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + mainindex: + conf_dir: !archive "core1-conf" + extraindex: + conf_dir: !archive "core2-conf" + endpoints: + main: + core: mainindex + extra: + core: extraindex ``` The above definition defines a single Solr {{% latest "solr" %}} server. That server has 2 cores defined: @@ -184,28 +196,40 @@ It then defines two endpoints: `main` is connected to the `mainindex` core while Each endpoint is then available in the relationships definition in `{{< vendor/configfile "app" >}}`. For example, to allow an application to talk to both of the cores defined above its configuration should contain the following: ```yaml {configFile="app"} -{{% snippet name="myapp" config="app" root="false" %}} -type: "php:{{% latest "php" %}}" - -relationships: - solrsearch1: 'solr:main' - solrsearch2: 'solr:extra' -{{% /snippet %}} - -{{% snippet name="solr" config="service" placeholder="true" %}} - type: solr:{{% latest "solr" %}} - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + myapp: + + type: "php:{{% latest "php" %}}" + + source: + root: "myapp" + + [...] + + relationships: + solrsearch1: + service: solr + endpoint: main + solrsearch2: + service: solr + endpoint: extra + +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + mainindex: + conf_dir: !archive "core1-conf" + extraindex: + conf_dir: !archive "core2-conf" + endpoints: + main: + core: mainindex + extra: + core: extraindex ``` That is, the application's environment would include a `solrsearch1` relationship that connects to the `main` endpoint, which is the `mainindex` core, and a `solrsearch2` relationship that connects to the `extra` endpoint, which is the `extraindex` core. @@ -238,26 +262,27 @@ The relationships array would then look something like the following: For even more customizability, it's also possible to define Solr configsets. For example, the following snippet would define one configset, which would be used by all cores. Specific details can then be overridden by individual cores using `core_properties`, which is equivalent to the Solr `core.properties` file. ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: solr:8.4 - configuration: - configsets: - mainconfig: !archive "configsets/solr8" - cores: - english_index: - core_properties: | - configSet=mainconfig - schema=english/schema.xml - arabic_index: - core_properties: | - configSet=mainconfig - schema=arabic/schema.xml - endpoints: - english: - core: english_index - arabic: - core: arabic_index -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + configsets: + mainconfig: !archive "configsets/solr8" + cores: + english_index: + core_properties: | + configSet=mainconfig + schema=english/schema.xml + arabic_index: + core_properties: | + configSet=mainconfig + schema=arabic/schema.xml + endpoints: + english: + core: english_index + arabic: + core: arabic_index ``` In this example, `{{< vendor/configdir >}}/configsets/solr8` contains the configuration definition for multiple cores. There are then two cores created: @@ -276,16 +301,17 @@ Note that not all core properties features make sense to specify in the `core_pr If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: solr:{{% latest "solr" %}} - configuration: - cores: - collection1: - conf_dir: !archive "example" - endpoints: - solr: - core: collection1 -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + collection1: + conf_dir: !archive "example" + endpoints: + solr: + core: collection1 ``` The example configuration directory is equivalent to the [Solr example configuration set](https://github.com/apache/solr/tree/main/solr/server/solr/configsets/sample_techproducts_configs/conf). @@ -297,15 +323,16 @@ You are strongly recommended to define your own configuration with a custom core If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} -{{% snippet name="solr" config="service" %}} - type: solr:8.4 - configuration: - cores: - collection1: {} - endpoints: - solr: - core: collection1 -{{% /snippet %}} +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:8.4 + configuration: + cores: + collection1: {} + endpoints: + solr: + core: collection1 ``` The default configuration is based on an older version of the Drupal 8 Search API Solr module that is no longer in use. diff --git a/sites/friday/src/add-services/varnish.md b/sites/upsun/src/add-services/varnish.md similarity index 75% rename from sites/friday/src/add-services/varnish.md rename to sites/upsun/src/add-services/varnish.md index 01f3c26e7f..05fd390292 100644 --- a/sites/friday/src/add-services/varnish.md +++ b/sites/upsun/src/add-services/varnish.md @@ -33,7 +33,7 @@ graph LR The `relationships` block defines the connection between Varnish and your app. You can define {{< variable "RELATIONSHIP_NAME" >}} as you like. -{{< variable "APP_NAME" >}} should match your app's `name` in the [app configuration](../create-apps/app-reference.md). +{{< variable "APP_NAME" >}} should match your app's `name` in the [app configuration](/create-apps/app-reference/single-runtime-image.md). The `configuration` block must reference a VCL file inside the `{{< vendor/configdir >}}` directory. The `path` defines the file relative to the `{{< vendor/configdir >}}` directory. @@ -99,25 +99,38 @@ your VCL templates needs logic to determine where each request is forwarded. For example, you might have the following configuration for two apps: ```yaml {configFile="services"} -{{% snippet name="varnish" config="service" %}} - type: varnish:{{% latest "varnish" %}} - relationships: - blog: 'blog:http' - main: 'app:http' - configuration: - vcl: !include - type: string - path: config.vcl -{{% /snippet %}} -{{% snippet name="blog" config="apps" placeholder="true" root="backends/blog" %}} -# The type of the application to build. -type: "php:{{% latest "php" %}}" -{{% /snippet %}} - -{{% snippet name="app" config="apps" globKey="false" placeholder="true" root="backends/main" %}} -# The type of the application to build. -type: "nodejs:{{% latest "nodejs" %}}" -{{% /snippet %}} +# The name of the service container. Must be unique within a project. +services: + varnish: + type: varnish:{{% latest "varnish" %}} + relationships: + blog: + service: blog + endpoint: http + main: + service: app + endpoint: http + configuration: + vcl: !include + type: string + path: config.vcl + +applications: + # The name of the app container. Must be unique within a project. + blog: + # The location of the application's code. + source: + root: "backends/blog" + # The type of the application to build. + type: "php:{{% latest "php" %}}" + + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "php" %}}" ``` You could then define that all requests to `/blog/` go to the `blog` app and all other requests to the other app: @@ -140,10 +153,12 @@ Also disable the router cache as Varnish now provides caching. To forward all incoming requests to Varnish rather than your app, you could have the following: ```yaml {configFile="routes"} -{{% snippet name="varnish:http" config="route" redirect="false" %}} -cache: - enabled: false -{{% /snippet %}} +routes: + "https://{default}/": + type: upstream + upstream: "varnish:http" + cache: + enabled: false ``` Varnish forwards requests to your app based on the specified VCL template. @@ -259,46 +274,45 @@ which provides access to some Varnish analysis and debugging tools. You can't use it from an app fronted by Varnish because of the restriction with [circular relationships](#circular-relationships). To access the stats, create a **separate app** (`stats-app`) with a relationship *to* Varnish, but not *from* it. -Define [app configuration](../create-apps/app-reference.md) similar to the following: +Define [app configuration](/create-apps/app-reference/single-runtime-image.md) similar to the following: ```yaml {configFile="apps"} -{{% snippet name="stats-app" config="apps" root="stats" %}} -# The type of the application to build. -type: "python:{{% latest "python" %}}" -# Unique relationship _to_ Varnish from 'stats-app', where no relationship -# is defined _from_ Varnish to the same app, to avoid circular relationships. -relationships: - varnishstats: "varnish:http+stats" -{{% /snippet %}} -{{% snippet name="main-app" config="apps" globKey="false" root="backends/main" %}} -# The type of the application to build. -type: "nodejs:{{% latest "nodejs" %}}" -{{% /snippet %}} -{{% snippet name="varnish" config="service" placeholder="true" %}} - type: varnish:{{% latest "varnish" %}} - # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship - # is defined _to_ Varnish to the same app, to avoid circular relationships. - relationships: - main: 'main-app:http' - configuration: - vcl: !include - type: string - path: config.vcl -{{% /snippet %}} -``` - -```yaml {configFile="services" v2Hide="true"} -{{% snippet name="varnish" config="service" %}} - type: varnish:{{% latest "varnish" %}} - # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship - # is defined _to_ Varnish to the same app, to avoid circular relationships. - relationships: - main: 'app:http' - configuration: - vcl: !include - type: string - path: config.vcl -{{% /snippet %}} +applications: + # The name of the app container. Must be unique within a project. + stats-app: + # The location of the application's code. + source: + root: "stats" + # The type of the application to build. + type: "python:{{% latest "python" %}}" + # Unique relationship _to_ Varnish from 'stats-app', where no relationship + # is defined _from_ Varnish to the same app, to avoid circular relationships. + relationships: + varnishstats: + service: varnish + endpoint: "http+stats" + # The name of the app container. Must be unique within a project. + main-app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + +services: + # The name of the service container. Must be unique within a project. + varnish: + type: varnish:{{% latest "varnish" %}} + # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship + # is defined _to_ Varnish to the same app, to avoid circular relationships. + relationships: + main: + service: "main-app" + endpoint: http + configuration: + vcl: !include + type: string + path: config.vcl ``` @@ -315,5 +329,5 @@ To access the Varnish stats endpoint from the command line: 1. Connect to your stats app [using SSH](../development/ssh/_index.md): `{{% vendor/cli %}} ssh --app stats-app` (replace `stats-app` with the name you gave the app). -2. Display the [relationships array](../create-apps/app-reference.md#relationships) with `echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 -d | jq .`, +2. Display the [relationships array](/create-apps/app-reference/single-runtime-image.md#relationships) with `echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 -d | jq .`, 3. Query Varnish with `curl {{< variable "HOST" >}}:{{}}/stats`, replacing `{{< variable "HOST" >}}` and `{{< variable "PATH" >}}` with the values from Step 2. diff --git a/sites/friday/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md similarity index 100% rename from sites/friday/src/add-services/vault.md rename to sites/upsun/src/add-services/vault.md diff --git a/sites/friday/src/administration/_index.md b/sites/upsun/src/administration/_index.md similarity index 100% rename from sites/friday/src/administration/_index.md rename to sites/upsun/src/administration/_index.md diff --git a/sites/upsun/src/administration/billing/_index.md b/sites/upsun/src/administration/billing/_index.md new file mode 100644 index 0000000000..4daeac5510 --- /dev/null +++ b/sites/upsun/src/administration/billing/_index.md @@ -0,0 +1,5 @@ +--- +title: "Billing" +weight: 2 +description: Keep your billing details up to date and optimize cost management from the Console. +--- \ No newline at end of file diff --git a/sites/upsun/src/administration/billing/billing-admin.md b/sites/upsun/src/administration/billing/billing-admin.md new file mode 100644 index 0000000000..cd12c03bff --- /dev/null +++ b/sites/upsun/src/administration/billing/billing-admin.md @@ -0,0 +1,29 @@ +--- +title: Administer your billing +weight: 1 +description: Keep your billing information up to date and redeem your vouchers from the Console. +--- + +The [Console](/administration/web/_index.md) is where you can keep your billing details up to date and redeem your vouchers. + +## Manage your billing details + +To add or edit billing details for your organization, follow these steps: + +1. Navigate to your organization. +2. Open the user menu (your name or profile picture). +3. Click **Billing**.
+4. Open the **Billing details** tab. +5. Add or update your billing details and click **Save**. +6. Add or update your payment method and click **Submit**. + +## Redeem a voucher + +To redeem a voucher, follow these steps: + +1. Navigate to your organization. +2. Open the user menu (your name or profile picture). +3. Click **Billing**.
+4. Open the **Vouchers** tab. +5. Enter your voucher code. +6. Click **Redeem**. \ No newline at end of file diff --git a/sites/upsun/src/administration/billing/monitor-billing.md b/sites/upsun/src/administration/billing/monitor-billing.md new file mode 100644 index 0000000000..f3e41de534 --- /dev/null +++ b/sites/upsun/src/administration/billing/monitor-billing.md @@ -0,0 +1,173 @@ +--- +title: Monitor your billing information +weight: 2 +description: Manage your costs efficiently by viewing monthly spend estimates and setting spend alerts. +keywords: + - "resources" + - "flexible resources" + - "CPU" + - "RAM" + - "disk storage" + - "costs" + - "invoice" + - "monthly spending" + - "billing" +--- + +To help you manage costs related to your organization, +{{% vendor/name %}} provides estimates for the current month and the next. + +You can set billing alerts to ensure you don't overspend, +and track resource usage on each of your projects. + +For details on costs, see the [{{% vendor/name %}} pricing page](https://upsun.com/pricing/). + +## Access your organization billing information + +To access your organization billing information in the [Console](/administration/web/_index.md): + +1. Navigate to your organization. +2. Open the user menu (your name or profile picture). +3. Click **Billing**.
+ The **Overview** tab is displayed. + You can view your current month and next month estimates. + +![Organization billing information in the Overview tab](/images/billing/organization-billing.png "0.6") + +### Current month estimate + +The [**Overview** tab](#access-your-organization-billing-information) shows an estimate of how much you may be charged at the end of this month.
+This estimate is based on: + +- Your organization settings (user management settings, number of projects, potential add-ons, support SLA, etc.) +- Your resource allocation on each project + +The estimate includes the history of changes made since the beginning of the month. +**It cannot be 100% accurate, as it is impossible to know exactly what your future usage will be.**
+However, for maximum accuracy, the current month estimate includes three underlying estimates, +each with its own calculation: + +- A [user management estimate](#user-management-estimate) +- An [accumulated resource usage estimate](#accumulated-resource-usage-estimate) +- An [allocated resource usage estimate](#allocated-resource-usage-estimate) + +#### User management estimate + +The following formula is used to estimate how much user license and user management add-on fees may cost you this month:
+`unit price x prorated quantity`. + +| Item | Description | +| ------------------ | ----------- | +| `unit price` | A fixed unit price. | +| `prorated quantity`| An average of past changes and current settings, applied for all the remaining days in the month. | + +All items used for the calculation are displayed in the **Overview** tab. + +#### Accumulated resource usage estimate + +The resources consumed for builds, bandwidth, and log forwarding are accumulated resources.
+The following formula is used to estimate how much accumulated resource usage may cost you this month:
+`current accumulation + (unit price x daily average x remaining days in the month)`. + +| Item | Description | +| ---------------------- | ----------- | +| `current accumulation` | The amount of accumulated resources you have effectively used so far this month. | +| `unit price` | A fixed unit price. | +| `daily average` | An average based on the accumulated resource usage you've had over the last 30 days. | + +All items used for the calculation are displayed in the [**Overview** tab](#access-your-organization-billing-information). + +#### Allocated resource usage estimate + +The resources consumed by your applications and services (CPU, RAM, and storage) are allocated resources.
+The following formula is used to estimate how much allocated resource usage may cost you this month:
+`unit price x prorated quantity`. + +| Item | Description | +| -------------------- | ----------- | +| `unit price` | A fixed unit price. | +| `prorated quantity` | An average of past changes and current settings, applied for all the remaining days in the month. | + +All items used for the calculation are displayed in the [**Overview** tab](#access-your-organization-billing-information). + +### Next month estimate + +From the [**Overview** tab](#access-your-organization-billing-information), you can also access an estimate for next month. + +Like your [current month estimate](#current-month-estimate), it includes your organization settings and resource allocation on each project. +However, your next month estimate **does not include any history of changes**. + +It is solely based on your current organization settings and resource allocation, +and shows what you may be charged if you don't make any changes until the end of next month. + +The following formulas are used: + +- `unit price x current allocation` to estimate how much user license, user management add-on fees, + and allocated resources may respectively cost you next month. + +- `unit price x daily average x 30 days` to estimate how much accumulated resources may cost you next month. + +### Invoice + +Your invoice provides definitive information on what you will be charged. +It is calculated at month-end close, and includes your actual organization settings and resource usage. + +To access your current invoice and a history of past invoices, open the **Invoices** tab: + +![Invoices tab in the Console](/images/billing/invoices-tab.png) + +## Set a billing alert + +{{% note theme="info" title="Feature availability" %}} + +Billing alerts can only be set and received by the organization owner, +users with the [**Manage Billing** permission](/administration/users.md#organization-permissions), +and identified billing contacts. + +{{% /note %}} + +You can set billing alerts to receive an email when your [current month estimate](#current-month-estimate) reaches a defined threshold. + +{{% note theme="warning" title="Warning"%}} +Current month estimates are computed once a day only. +Therefore, email notifications can only be triggered once a day too. + +You may want to increase your billing alert threshold after receiving an email notification. +However, if the new threshold is reached later on the same day, +**you won't get notified until the following day**, when the current month estimate is computed again. +{{% /note %}} + +To set a billing alert on your organization: + +1. Navigate to your organization. +2. Open the user menu (your name or profile picture). +3. Click **Billing**.
+4. In the **Overview** tab, click **Set alert**. +5. Enter a threshold. +6. Click **Create alert**. + +Note that you can edit or delete a billing alert by clicking the billing alert button in the **Overview** tab: +![Billing alert button in the Console](/images/billing/billing-alert-button.png "0.1") + +## Track resource usage on a project + +{{% note theme="info" title="Feature availability" %}} + +This feature is available to users with the [**Manage Billing** permission](/administration/users.md#organization-permissions) on the organization. + +{{% /note %}} + +You can track costs related to resource usage on a specific project in the [Console](/administration/web/_index.md). +To do so, after you've set or updated resources on your project: + +1. Navigate to your organization. +2. Open the user menu (your name or profile picture). +3. Click **Billing**.
+ Your [current month estimate](#current-month-estimate) shows how much each project in your organization is expected to cost this month. +4. You can select a project to view resource allocation and usage details.
+ To do so, click **{{< icon more >}} More** next to it, and select **Project Billing**.
+ ![Project billing information in the Overview tab](/images/billing/project-billing.png "0.6") + +For information on resource-related costs, see the [{{% vendor/name %}} pricing page](https://upsun.com/pricing/). + + diff --git a/sites/friday/src/administration/cli/_index.md b/sites/upsun/src/administration/cli/_index.md similarity index 97% rename from sites/friday/src/administration/cli/_index.md rename to sites/upsun/src/administration/cli/_index.md index 7b84af58ac..b051e48778 100644 --- a/sites/friday/src/administration/cli/_index.md +++ b/sites/upsun/src/administration/cli/_index.md @@ -211,8 +211,8 @@ eval $({{% vendor/cli %}} completion) ### Run commands on your container You can use the {{% vendor/name %}} CLI to run commands on your container. -You can use any command you've added in [dependencies](../../create-apps/app-reference.md#dependencies) -or a [hook](../../create-apps/app-reference.md#hooks). +You can use any command you've added in [dependencies](/create-apps/app-reference/single-runtime-image.md#dependencies) +or a [hook](/create-apps/app-reference/single-runtime-image.md#hooks). The syntax looks like the following: diff --git a/sites/friday/src/administration/cli/api-tokens.md b/sites/upsun/src/administration/cli/api-tokens.md similarity index 100% rename from sites/friday/src/administration/cli/api-tokens.md rename to sites/upsun/src/administration/cli/api-tokens.md diff --git a/sites/friday/src/administration/cli/reference.md b/sites/upsun/src/administration/cli/reference.md similarity index 100% rename from sites/friday/src/administration/cli/reference.md rename to sites/upsun/src/administration/cli/reference.md diff --git a/sites/friday/src/administration/organizations.md b/sites/upsun/src/administration/organizations.md similarity index 100% rename from sites/friday/src/administration/organizations.md rename to sites/upsun/src/administration/organizations.md diff --git a/sites/friday/src/administration/pricing.md b/sites/upsun/src/administration/pricing.md similarity index 100% rename from sites/friday/src/administration/pricing.md rename to sites/upsun/src/administration/pricing.md diff --git a/sites/friday/src/administration/servers.md b/sites/upsun/src/administration/servers.md similarity index 100% rename from sites/friday/src/administration/servers.md rename to sites/upsun/src/administration/servers.md diff --git a/sites/friday/src/administration/teams.md b/sites/upsun/src/administration/teams.md similarity index 100% rename from sites/friday/src/administration/teams.md rename to sites/upsun/src/administration/teams.md diff --git a/sites/friday/src/administration/users.md b/sites/upsun/src/administration/users.md similarity index 99% rename from sites/friday/src/administration/users.md rename to sites/upsun/src/administration/users.md index 83ae1a2567..44412b691a 100644 --- a/sites/friday/src/administration/users.md +++ b/sites/upsun/src/administration/users.md @@ -5,7 +5,7 @@ sidebarTitle: Users description: Manage user access and permissions across all your projects and organizations. --- -{{% vendor/name %}} offers very granular and flexible user permissions across projects and organizations. +{{% vendor/name %}} offers very granular and flexible user permissions across projects and organizations. When a user is added to a project, they are automatically added to your organization. ## Manage project access @@ -42,7 +42,7 @@ A user can have one of the following roles on an environment type which grants t | Contributor | Yes | Yes | Yes | Yes | No | No | | Viewer | Yes | No | Yes | No | No | No | -To customize which roles can use SSH, set [`access` in your app configuration](../create-apps/app-reference.md#access). +To customize which roles can use SSH, set [`access` in your app configuration](/create-apps/app-reference/single-runtime-image.md#access). ### View a user's permissions across all of the projects in your organization @@ -170,7 +170,7 @@ title=In the Console {{< /codetabs >}} To apply SSH access changes after you add a remove a user from a project or environment type, -[trigger a redeploy](../development/troubleshoot.md#force-a-redeploy). +[trigger a redeploy](../development/troubleshoot.md#force-a-redeploy). ### Remove a user from a project @@ -242,7 +242,7 @@ you can invite other users to your organization and grant them the following per Users with the **Manage users** (`members`) permission can add, edit, or remove _any_ user's permissions except their own. -Users with the **Manage billing** (`billing`) permission automatically are granted **List projects** (`projects:list`) permission. +Users with the **Manage billing** (`billing`) permission automatically are granted **List projects** (`projects:list`) permission. That is, they are able to see all organization projects once given billing rights. {{< /note >}} diff --git a/sites/friday/src/administration/web/_index.md b/sites/upsun/src/administration/web/_index.md similarity index 100% rename from sites/friday/src/administration/web/_index.md rename to sites/upsun/src/administration/web/_index.md diff --git a/sites/friday/src/administration/web/configure-environment.md b/sites/upsun/src/administration/web/configure-environment.md similarity index 97% rename from sites/friday/src/administration/web/configure-environment.md rename to sites/upsun/src/administration/web/configure-environment.md index a4f8efb44d..5d31b2f580 100644 --- a/sites/friday/src/administration/web/configure-environment.md +++ b/sites/upsun/src/administration/web/configure-environment.md @@ -41,7 +41,7 @@ There are also additional options: * **Code** * **CLI** for the command to get your project set up locally with the [{{% vendor/name %}} CLI](../cli/_index.md). * **Git** for the command to clone the codebase via Git. - + If you're using {{% vendor/name %}} as your primary remote repository, the command clones from the project. If you have set up an [external integration](../../integrations/source/_index.md), the command clones directly from the integrated remote repository. @@ -61,7 +61,7 @@ If this message isn't updated once your [default environment](../../environments follow these steps: 1. Check that [you have defined routes](../../define-routes/_index.md) for your default environment. -2. Verify that your [application](../../create-apps/app-reference.md), [services](../../add-services/_index.md), and [routes](../../define-routes/_index.md) configurations are correct. +2. Verify that your [application](/create-apps/app-reference/single-runtime-image.md), [services](../../add-services/_index.md), and [routes](../../define-routes/_index.md) configurations are correct. 3. Check that your default environment is [active](../../environments/deactivate-environment.md#reactivate-an-environment). ## Environment settings diff --git a/sites/friday/src/administration/web/configure-project.md b/sites/upsun/src/administration/web/configure-project.md similarity index 100% rename from sites/friday/src/administration/web/configure-project.md rename to sites/upsun/src/administration/web/configure-project.md diff --git a/sites/friday/src/administration/web/mfa.md b/sites/upsun/src/administration/web/mfa.md similarity index 100% rename from sites/friday/src/administration/web/mfa.md rename to sites/upsun/src/administration/web/mfa.md diff --git a/sites/friday/src/changelog/_index.md b/sites/upsun/src/changelog/_index.md similarity index 100% rename from sites/friday/src/changelog/_index.md rename to sites/upsun/src/changelog/_index.md diff --git a/sites/friday/src/create-apps/_index.md b/sites/upsun/src/create-apps/_index.md similarity index 89% rename from sites/friday/src/create-apps/_index.md rename to sites/upsun/src/create-apps/_index.md index dcb8019068..64f979babc 100644 --- a/sites/friday/src/create-apps/_index.md +++ b/sites/upsun/src/create-apps/_index.md @@ -14,7 +14,7 @@ Within a single project, you can have one or more apps and each app can have mul Instances are where the same code can be run with different configurations, such as one for external communication and one for background processes. All of the apps and instances are configured with the same syntax. -You can find a [complete reference](./app-reference.md) of all possible settings. +You can find a [complete reference](/create-apps/app-reference/single-runtime-image.md) of all possible settings. ## A minimal application @@ -63,15 +63,15 @@ If you want to use one of the [databases or other services {{% vendor/name %}} p set it up by following these steps: 1. Configure the service based on the documentation for that service. -1. Use the information from that service inside your app's [`relationships` definition](./app-reference.md#relationships) +1. Use the information from that service inside your app's [`relationships` definition](/create-apps/app-reference/single-runtime-image.md#relationships) to configure how your app communicates with the service. ## Control the build and deploy process Your app generally needs to undergo some steps to be turned from the code in your Git repository into a running app. -If you're running a PHP or Node.js app, this starts with the [build flavor](./app-reference.md#build), +If you're running a PHP or Node.js app, this starts with the [build flavor](/create-apps/app-reference/single-runtime-image.md#build), which runs a default set of tasks. -Then any [global dependencies](./app-reference.md#dependencies) can be installed. +Then any [global dependencies](/create-apps/app-reference/single-runtime-image.md#dependencies) can be installed. Once these optional tasks are done, you can run [hooks](./hooks/_index.md) at various points in the process. Hooks are places for your custom scripts to control how your app is built and deployed. @@ -79,7 +79,7 @@ Hooks are places for your custom scripts to control how your app is built and de ## Configure what's served Once your app is built, it needs a defined way to communicate with the outside world. -Define its behavior with a [`web` instance](./app-reference.md#web). +Define its behavior with a [`web` instance](/create-apps/app-reference/single-runtime-image.md#web). There you can set what command runs every time your app is restarted, how dynamic requests are handled, and how to respond with static files. @@ -128,11 +128,12 @@ applications: php: composer/composer: '^2' - # The app's relationships (connections) with services or other applications. - # The key is the relationship name that can be viewed in the app. - # The value is specific to how the service is configured. + # Relationships enable an app container's access to a service or another app. + # The example below shows simplified configuration leveraging a default service + # (identified from the relationship name) and a default endpoint. + # See the Application reference for all options for defining relationships and endpoints. relationships: - database: 'mysqldb:mysql' + mysql: # Scripts that are run as part of the build and deploy process. hooks: @@ -168,5 +169,6 @@ applications: passthru: '/app.php' services: - mysqldb: + mysql: type: mariadb:{{% latest "mariadb" %}} +``` diff --git a/sites/upsun/src/create-apps/app-reference/_index.md b/sites/upsun/src/create-apps/app-reference/_index.md new file mode 100644 index 0000000000..c76a52b910 --- /dev/null +++ b/sites/upsun/src/create-apps/app-reference/_index.md @@ -0,0 +1,32 @@ +--- +title: "App reference" +weight: 4 +description: Configure your app and control how it's built and deployed on {{% vendor/name %}}. +layout: single +--- + +To define your app, you can either use one of {{% vendor/name %}}'s [single-runtime image](/create-apps/app-reference/single-runtime-image.md) +or its [composable image (BETA)](/create-apps/app-reference/composable-image.md). + +## Single-runtime image + +{{% vendor/name %}} provides and maintains a list of single-runtime images you can use for each of your application containers.
+See [all of the options you can use](/create-apps/app-reference/single-runtime-image.md) to define your app using a single-runtime image. + +## Composable image (BETA) + +The {{% vendor/name %}} composable image provides more flexibility than single-runtime images. +When using a composable image, you can define a stack (or group of packages) for your application container to use. + +There are over 80,000 packages available from the [Nix Packages collection](https://search.nixos.org/) that you can add to your stack. +You can add as many packages to your application container as you need. + +{{% note %}} + +{{% vendor/name %}} guarantees optimal user experience with the specific [set of packages](/create-apps/app-reference/composable-image.md#supported-nix-packages) it supports. +You can use any other package available from the [Nix Packages collection](https://search.nixos.org/), including unstable ones, +but NixOs is responsible for their support. + +{{% /note %}} + +See [all of the options you can use](/create-apps/app-reference/composable-image.md) to define your app using the composable image. diff --git a/sites/upsun/src/create-apps/app-reference/composable-image.md b/sites/upsun/src/create-apps/app-reference/composable-image.md new file mode 100644 index 0000000000..21fd5de566 --- /dev/null +++ b/sites/upsun/src/create-apps/app-reference/composable-image.md @@ -0,0 +1,1286 @@ +--- +title: "Composable image" +weight: 5 +description: Use {{% vendor/name %}}'s composable image to build and deploy your app. +beta: true +banner: + title: Beta Feature + body: The {{% vendor/name %}} composable image is currently available in Beta. + This feature as well as its documentation is subject to change. +--- + +The {{% vendor/name %}} composable image provides enhanced flexibility when defining your app. +It allows you to install several runtimes and tools in your application container, +in a **"one image to rule them all"** approach. + +The composable image is built on [Nix](https://nix.dev), which offers the following benefits: + +- You can add as many packages to your application container as you need, + choosing from over 80,000 packages from [the Nixpkgs collection](https://search.nixos.org/packages). +- The packages you add are built in total isolation, so you can install different versions of the same package. +- With [Nix](https://nix.dev/reference/glossary#term-Nix), there are no undeclared dependencies in your source code. + What works on your local machine is guaranteed to work on any other machine. + +This page introduces all the settings available to configure your composable image from your `{{< vendor/configfile "app" >}}` file +(usually located at the root of your Git repository).
+Note that multi-app projects can be [set in various ways](../multi-app/_index.md). + +{{% note theme="info" title="Further resources"%}} + +For a more detailed introduction to the composable image, check out [this video](https://www.youtube.com/watch?v=emOt32DVl28).
+If you're pressed for time, jump to this comprehensive [configuration example](../_index.md#comprehensive-example). + +{{% /note %}} + +## Primary application properties + +All application configuration takes place in a `{{< vendor/configfile "app" >}}` file, with each application configured +under a unique key beneath the top-level `applications` key. + +It is possible to use multiple runtimes in a single application container, +for instance PHP, NodeJS and Python, while remaining in control of their versions. + +For example, the unified `{{< vendor/configfile "app" >}}` file may look like the following: + +```yaml {configFile="app"} +applications: + frontend: + stack: + - "php@{{% latest "php" %}}": + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "nodejs@{{% latest "nodejs" %}}" + - "python@3.12" + # Additional frontend configuration +``` + +The following table presents all properties available at the level just below the unique application name (`frontend` +above). + +The column _Set in instance?_ defines whether the given property can be overridden within a `web` or `workers` instance. +To override any part of a property, you have to provide the entire property. + +| Name | Type | Required | Set in instance? | Description | +|--------------------|-----------------------------------------------------|----------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `stack` | An array of [Nix packages](#stack) | Yes | No | A list of packages from the {{% vendor/name %}} collection of [supported runtimes](#supported-nix-packages) and/or from [NixPkgs](https://search.nixos.org/packages). | +| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | +| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. Allocated disk for mounts is defined with a separate resource configuration call using `{{% vendor/cli %}} resources:set`. | +| `web` | A [web instance](#web) | | N/A | How the web application is served. | +| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | +| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](../timezone.md) | +| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | +| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | +| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | +| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | +| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | +| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | +| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | + +{{% note %}} +The ``type``, ``build``, ``dependencies``, and ``runtime`` keys are only supported when using a [single-runtime image](/create-apps/app-reference/single-runtime-image.md). +They are **not** supported when using the composable image. +They are replaced by the `stack` key. +{{% /note %}} + +## Stack + +Use the ``stack`` key to define which runtimes and binaries you want to install in your application container. +Define them as a YAML array as follows: + +```yaml {configFile="app"} +applications: + app: + stack: [ "@" ] + # OR + stack: + - "@" +``` + +To add a language to your stack, use the `@` format.
+To add a tool to your stack, use the `` format, as no version is needed. + +#### Primary runtime + +If you add multiple runtimes to your application container, +the first declared runtime becomes the primary runtime. +The primary runtime is the one that is automatically started. + +To start other declared runtimes, you need to start them manually, using [web commands](#web-commands). +To find out which start command to use, go to the [Languages](/languages/_index.md) section, +and visit the documentation page dedicated to your runtime. + +{{% note %}} +If you use PHP, note that PHP-FPM is only started automatically if PHP is defined as the primary runtime. +{{% /note %}} + +### Supported Nix packages + +{{% note %}} +The Nix packages listed in the following table are officially supported by {{% vendor/name %}} to provide optimal user experience.
+However, you can add any other packages from [the Nixpkgs collection](https://search.nixos.org/) to your `stack`. +This includes packages from the ``unstable`` channel, +like [FrankenPHP](https://search.nixos.org/packages?channel=unstable&show=frankenphp&from=0&size=50&sort=relevance&type=packages&query=frankenphp).
+While available for you to install, packages that aren't listed in the following table are supported by Nix itself, not {{% vendor/name %}}. +{{% /note %}} + +Depending on the Nix package, you can select only the major runtime version, +or the major and minor runtime versions as shown in the table. +Security and other patches are applied automatically. + +| **Language** | **Nix package** | **Supported version(s)** | +|----------------------------------------------|---------------|----------------------------| +| [Clojure](https://clojure.org/) | `clojure` | 1 | +| [Common Lisp (SBCL)](/languages/lisp.html) | `sbcl` | 2 | +| [Elixir](/languages/elixir.html) | `elixir` | 1.15, 1.14 | +| [Go](/languages/go.html) | `golang` | 1.22, 1.21, 1.20 | +| [Java](/languages/java.html) | `java` | 21 | +| [Javascript/Bun](https://bun.sh/) | `bun` | 1 | +| [JavaScript/Node.js](/languages/nodejs.html) | `nodejs` | 21, 20, 18 | +| [Perl](https://www.perl.org/) | `perl` | 5 | +| [PHP](/languages/php.html) | `php` | 8.3, 8.2, 8.1 | +| [Python](/languages/python.html) | `python` | 3.12, 3.11, 3.10, 3.9, 2.7 | + +**Example:** + +You want to add PHP version {{% latest php %}} and ``facedetect`` to your application container. +To do so, use the following configuration: + +```yaml {configFile="app"} +applications: + app: + stack: [ "php@{{% latest php %}}", "facedetect" ] + # OR + stack: + - "php@{{% latest php %}}" + - "facedetect" +``` + +### PHP extensions and Python packages + +When you add PHP or Python to your application container, +you can define which extensions (for PHP) or packages (for Python) you also want to add to your stack. + +To find out which extensions you can install with your runtime, +follow these steps: + +1. Go to the [NixOS search](https://search.nixos.org/). +2. Enter a runtime and click **Search**. +3. In the **Package sets** side bar, select the right set of extensions/packages for your runtime version.
+ You can choose the desired extensions/packages from the filtered results. + +![Screenshot of the Nix package sets selection for PHP@8.3](/images/nixos/nixos-packages.png "0.5") + +#### Install PHP extensions + +To enable [PHP extensions](/languages/php/extensions.md), +specify a list of `extensions` below the language definition.
+To disable [PHP extensions](/languages/php/extensions.md), +specify a list of `disabled_extensions` below the language definition.
+For instance: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: + - "php@{{% latest "php" %}}": + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + disabled_extensions: + - gd +``` + +{{% note %}} +To help you find out the name of the PHP package you want to use, +some maintainers provide a ``PHP upstream extension`` value in the [NixOS search engine](https://search.nixos.org/packages?channel=unstable&show=php82Extensions.gd). + +![Screenshot of an upstream extension value shown in the NixOS search](/images/nixos/nixossearch-upstream-value.png "0.5") + +If this information is not provided, note that PHP package names on NixOS always respect the ``Extensions.`` format. +Therefore, you can copy the ```` as shown in the NixOS search results, and use it in your configuration. + +Note that you can use environment variables or your `php.ini` file to [include further configuration options](/languages/php/_index.md#customize-php-settings) +for your PHP extensions. + +{{% /note %}} + +#### Install Python packages + +To install Python packages, add them to your stack as new packages. +To do so, use the full name of the package. + +For instance, to install [``python312Packages.yq``](https://search.nixos.org/packages?channel=unstable&show=python312Packages.yq), +use the following configuration: + +```yaml {configFile="app"} +applications: + myapp: + stack: + - "python@3.12" + - "python312Packages.yq" # python package specific +``` + +Alternatively, if you need to include configuration options for your extensions, use either your ``php.ini`` file or [environment variables](/development/variables/set-variables.md). + +### Example configuration + +Here is a full composable image configuration example. Note the use of the `@` format. + +```yaml {configFile="app"} +applications: + myapp: + stack: + - "php@{{% latest "php" %}}" + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "python@3.12" + - "python312Packages.yq" # python package specific + - "yq" # tool +``` + +### Combine single-runtime and composable images + +In a [multiple application context](/create-apps/multi-app/_index.md), +you can use a mix of [single-runtime images](/create-apps/app-reference/single-runtime-image.md) +and [composable images](/create-apps/app-reference/composable-image.md). +Here is an example configuration including a ``frontend`` app and a ``backend`` app: + +```yaml {configFile="app"} +applications: + frontend: + stack: + - "php@{{% latest "php" %}}" + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "python@3.12" + - "python312Packages.yq" # python package specific + backend: + type: 'nodejs:{{% latest "nodejs" %}} +``` + +{{% note %}} +If you add multiple runtimes to your application container, +the first declared runtime becomes the primary runtime. +The primary runtime is the one that is automatically started. + +To start other declared runtimes, you need to start them manually, using [web commands](#web-commands). +To find out which start command to use, go to the [Languages](/languages/_index.md) section, +and visit the documentation page dedicated to your language. + +If you use PHP, note that PHP-FPM is only started automatically if PHP is defined as the primary runtime. +{{% /note %}} + +## Resources + +Resources for application containers are not committed to YAML files, but instead managed over the API using either the +Console or the `{{% vendor/cli %}} resources:set` command. + +For more information, see how to [manage resources](/manage-resources.md). + +{{% note %}} +Composable image container profile defaults to ``HIGH_CPU``. +
If multiple runtimes are added to your stack, +you would need to change +the [default container_profile](/manage-resources/adjust-resources.md#advanced-container-profiles) +
or change [default CPU and RAM ratio](/manage-resources/resource-init.md) on first deployment using the following +commands: + +```bash +{{% vendor/cli %}} push --resources-init=manual +``` + +{{% /note %}} + +## Relationships + +To access another container within your project, you need to define a relationship to it. +You can give each relationship any name you want. + +The relationship is specified in the form `service_name:endpoint_name`. +The `service_name` is the name of the service given in the [services configuration](/add-services/_index.md) +or the name of another application in the same project specified as the `name` in that app's configration. + +The `endpoint_name` is the exposed functionality of the service to use. +For most services, the endpoint is the same as the service type. +For some services (such as [MariaDB](/add-services/mysql/_index.md#multiple-databases) +and [Solr](/add-services/solr.md#solr-6-and-later)), +you can define additional explicit endpoints for multiple databases and cores in +the [service's configuration](/add-services/_index.md). + +The following example shows a single MySQL service named `mysqldb` offering two databases, +a Redis cache service named `rediscache`, and an Elasticsearch service named `searchserver`. + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "nodejs@{{% latest nodejs %}}" ] + relationships: + database: 'mysqldb:db1' + database2: 'mysqldb:db2' + cache: 'rediscache:redis' + search: 'searchserver:elasticsearch' +``` + +{{% note %}} +Once a service is running and exposed via a relationship, +its credentials (such as the host, username, and password) are automatically available +as [service environment variables](/development/variables.html#service-environment-variables), +in the `$_` format. +The available information is documented on each service's page, along with sample code for how to connect to it from +your app. +{{% /note %}} + +## Available disk space + +Disk for application containers are not committed to YAML files, but instead managed over the API using either the +Console or the `{{% vendor/cli %}} resources:set` command. + +For more information, see how to [manage resources](/manage-resources.md). + +### Downsize a disk + +{{% disk-downsize type="app" %}} + +## Mounts + +After your app is built, its file system is read-only. +To make changes to your app's code, you need to use Git. + +For enhanced flexibility, {{% vendor/name %}} allows you to define and use writable directories called "mounts". +Mounts give you write access to files generated by your app (such as cache and log files) +and uploaded files without going through Git. + +When you define a mount, you are mounting an external directory to your app container, +much like you would plug a hard drive into your computer to transfer data. + +{{% note %}} + +- Mounts aren't available during the build +- When you [back up an environment](/environments/backup.md), the mounts on that environment are backed up too + +{{% /note %}} + +### Define a mount + +To define a mount, use the following configuration: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "nodejs@{{% latest nodejs %}}" ] + mounts: + '{{< variable "MOUNT_PATH" >}}': + source: {{< variable "MOUNT_TYPE" >}} + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} +``` + +{{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). +If you already have a directory with that name, you get a warning that it isn't accessible after the build. +See how to [troubleshoot the warning](../troubleshoot-mounts.md#overlapping-folders). + +| Name | Type | Required | Description | +|---------------|--------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `source` | `storage`, `tmp`, or `service` | Yes | Specifies the type of the mount:

- By design, `storage` mounts can be shared between instances of the same app. You can also configure them so they are [shared between different apps](#share-a-mount-between-several-apps).

- `tmp` mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**.

- `service` mounts can be useful if you want to explicitly define and use a [Network Storage](/add-services/network-storage.md) service to share data between different apps (instead of using a `storage` mount). | +| `source_path` | `string` | No | Specifies where the mount points **inside the [external directory](#mounts)**.

- If you explicitly set a `source_path`, your mount points to a specific subdirectory in the external directory.

- If the `source_path` is an empty string (`""`), your mount points to the entire external directory.

- If you don't define a `source_path`, {{% vendor/name %}} uses the {{< variable "MOUNT_PATH" >}} as default value, without leading or trailing slashes.
For example, if your mount lives in the `/web/uploads/` directory in your app container, it will point to a directory named `web/uploads` in the external directory.

**WARNING:** Changing the name of your mount affects the `source_path` when it's undefined. See [how to ensure continuity](#ensure-continuity-when-changing-the-name-of-your-mount) and maintain access to your files. | +| `service` | `string` | | The purpose of the `service` key depends on your use case.

In a multi-app context where a `storage` mount is shared between apps, `service` is required. Its value is the name of the app whose mount you want to share. See how to [share a mount between several apps](#share-a-mount-between-several-apps).

In a multi-app context where a [Network Storage service](/add-services/network-storage.md) (`service` mount) is shared between apps, `service` is required and specifies the name of that Network Storage. | + +The accessibility to the web of a mounted directory depends on the [`web.locations` configuration](#web). +Files can be all public, all private, or with different rules for different paths and file types. + +Note that when you remove a `tmp` mount from your `{{< vendor/configfile "app" >}}` file, +the mounted directory isn't deleted. +The files still exist on disk until manually removed, +or until the app container is moved to another host during a maintenance operation. + +### Example configuration + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "nodejs@{{% latest nodejs %}}" ] + mounts: + 'web/uploads': + source: storage + source_path: uploads + '/.tmp_platformsh': + source: tmp + source_path: files/.tmp_platformsh + '/build': + source: storage + source_path: files/build + '/.cache': + source: tmp + source_path: files/.cache + '/node_modules/.cache': + source: tmp + source_path: files/node_modules/.cache +``` + +### Ensure continuity when changing the name of your mount + +Changing the name of your mount affects the default `source_path`. + +Say you have a `/my/cache/` mount with an undefined `source_path`: + +```yaml {configFile="app"} +mounts: + '/my/cache/': + source: tmp +``` + +If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. + +To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading +or trailing slashes: + + ```yaml {configFile="app"} +mounts: + '/cache/files/': + source: tmp + source_path: my/cache +``` + +The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing +files in that directory. + +### Share a mount between several apps + +By design, [`storage` mounts](#mounts) are shared **between different instances of the same app**, +which enables [horizontal scaling](/manage-resources/_index.md). + +In a [multi-application context](/create-apps/multi-app/_index.md), +you can even share a `storage` mount **between different applications** in the same project. + +To do so, you need to define a `storage` mount in each of your app containers, +and point each of those mounts to the same shared external network directory. + +Use the following configuration: + +```yaml {configFile="app"} +applications: + app1: + mounts: + '{{< variable "MOUNT_PATH_1" >}}': + source: storage + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + + app2: + mounts: + '{{< variable "MOUNT_PATH_2" >}}': + source: storage + service: app1 + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} +``` + +- {{< variable "MOUNT_PATH_1" >}} and {{< variable "MOUNT_PATH_2" >}} are the paths to each mount **within their + respective app container** (relative to the app's root). +- When configuring the first `storage` mount, you don't need to include the `service` key. + The first mount implicitly points to an external network directory. + The `service` key is required for subsequent mounts, to ensure they use the same external network directory as the + first mount. +- The `source_path` allows you to point each mount to the same subdirectory **within the shared external network + directory**. + +{{% note title = "Example" %}} + +You have a `backend` app and a `frontend` app. +You want both apps to share data from the same mount.
+Follow these steps: + +1. In your `backend` app configuration, define a `storage` mount: + + ```yaml {configFile="app"} + applications: + backend: + mounts: + var/uploads: #The path to your mount within the backend app container. + source: storage + source_path: backend/uploads #The path to the source of the mount within the external network directory. + ``` + + This creates a `storage` mount named `var/uploads` in the `backend` app container. + The mount points to the `backend/uploads` directory within an external network directory. + +2. In your `frontend` app configuration, define another `storage` mount: + + ```yaml {configFile="app"} + applications: + applications: + backend: + mounts: + var/uploads: + source: storage + source_path: backend/uploads + + frontend: + mounts: + web/uploads: #The path to your mount within the frontend app container. + source: storage + service: backend #The name of the other app, so the mount can point to the same external network directory as that other app's mount. + source_path: backend/uploads #The path to the source of the mount within the shared external network directory. + ``` + + This creates another `storage` mount named `web/uploads` in the `frontend` app container. + + The `service` key allows you to specify that the `web/uploads` mount should use the same external network directory + as the mount previously defined in the `backend` app container. + + The `source_path` key specifies which subdirectory within the external network directory both mounts should share ( + here, the `backend/uploads` directory). + +{{% /note %}} + +Note that another way to share data between apps through a mount is by +explicitly [defining a Network Storage service](/add-services/network-storage.md). + +### Local mounts + +If you need a local mount (i.e. unique per container), +{{% vendor/name %}} allows you to mount a directory within the `/tmp` directory of your app. +However, the following limitations apply: + +- Content from `tmp` mounts is removed when your app container is moved to another host during an infrastructure + maintenance operation +- The `/tmp` directory has a [maximum allocation of 8 GB](/create-apps/troubleshoot-disks.md#no-space-left-on-device) + +Therefore, `tmp` mounts are ideal to store non-critical data, such as your application cache which can be seamlessly +rebuilt, +but aren't suitable for storing files that are necessary for your app to run smoothly. + +Note that {{% vendor/name %}} will provide new local mounts in the near future. + +## Web + +Use the `web` key to configure the web server running in front of your app. + +| Name | Type | Required | Description | +|-------------|--------------------------------------------|-------------------------------|------------------------------------------------------| +| `commands` | A [web commands dictionary](#web-commands) | See [note](#required-command) | The command to launch your app. | +| `upstream` | An [upstream dictionary](#upstream) | | How the front server connects to your app. | +| `locations` | A [locations dictionary](#locations) | | How the app container responds to incoming requests. | + +See some [examples of how to configure what's served](../web/_index.md). + +### Web commands + +| Name | Type | Required | Description | +|-------------|----------|-------------------------------|-----------------------------------------------------------------------------------------------------| +| `pre_start` | `string` | | Command run just prior to `start`, which can be useful when you need to run _per-instance_ actions. | +| `start` | `string` | See [note](#required-command) | The command to launch your app. If it terminates, it's restarted immediately. | + +Example: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + web: + commands: + start: 'uwsgi --ini conf/server.ini' +``` + +This command runs every time your app is restarted, regardless of whether or not new code is deployed. + +{{< note >}} + +Never "background" a start process using `&`. +That's interpreted as the command terminating and the supervisor process starts a second copy, +creating an infinite loop until the container crashes. +Just run it as normal and allow the {{% vendor/name %}} supervisor to manage it. + +{{< /note >}} + +#### Required command + +On all containers other than PHP, the value for `start` should be treated as required. + +On PHP containers, it's optional and defaults to starting PHP-FPM (`/usr/bin/start-php-app`). +It can also be set explicitly on a PHP container to run a dedicated process, +such as [React PHP](https://github.com/platformsh-examples/platformsh-example-reactphp) +or [Amp](https://github.com/platformsh-examples/platformsh-example-amphp). +See how to set up [alternate start commands on PHP](/languages/php/_index.md#alternate-start-commands). + +### Upstream + +| Name | Type | Required | Description | Default | +|-----------------|---------------------|----------|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [primary runtimes](#primary-runtime) except PHP; for PHP the default is `unix`. | +| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on the [primary runtimes](#primary-runtime). | + +For PHP, the defaults are configured for PHP-FPM and shouldn't need adjustment. +For all other containers, the default for `protocol` is `http`. + +The following example is the default on non-PHP containers: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + web: + upstream: + socket_family: tcp + protocol: http +``` + +#### Where to listen + +Where to listen depends on your setting for `web.upstream.socket_family` (defaults to `tcp`). + +| `socket_family` | Where to listen | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------| +| `tcp` | The port specified by the [`PORT` environment variable](/development/variables/use-variables.md#use-provided-variables) | +| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](/development/variables/use-variables.md#use-provided-variables) | + +If your application isn't listening at the same place that the runtime is sending requests, +you see `502 Bad Gateway` errors when you try to connect to your website. + +### Locations + +Each key in the `locations` dictionary is a path on your site with a leading `/`. +For `example.com`, a `/` matches `example.com/` and `/admin` matches `example.com/admin`. +When multiple keys match an incoming request, the most-specific applies. + +The following table presents possible properties for each location: + +| Name | Type | Default | Description | +|---------------------|------------------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `root` | `string` | | The directory to serve static assets for this location relative to the app's root directory ([see `source.root`](#source)). Must be an actual directory inside the root directory. | +| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered. | +| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | +| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | +| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | +| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | +| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | +| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | +| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | + +#### Rules + +The rules dictionary can override most other keys according to a regular expression. +The key of each item is a regular expression to match paths exactly. +If an incoming request matches the rule, it's handled by the properties under the rule, +overriding any conflicting rules from the rest of the `locations` dictionary. + +Under `rules`, you can set all of the other possible [`locations` properties](#locations) +except `root`, `index` and `request_buffering`. + +In the following example, the `allow` key disallows requests for static files anywhere in the site. +This is overridden by a rule that explicitly allows common image file formats. + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + web: + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/index.php' + # Disallow static files + allow: false + rules: + # Allow common image files only. + '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': + allow: true +``` + +#### Request buffering + +Request buffering is enabled by default to handle chunked requests as most app servers don't support them. +The following table shows the keys in the `request_buffering` dictionary: + +| Name | Type | Required | Default | Description | +|--------------------|-----------|----------|---------|-------------------------------------------| +| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | +| `max_request_size` | `string` | | `250m` | The maximum size to allow in one request. | + +The default configuration would look like this: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + web: + locations: + '/': + passthru: true + request_buffering: + enabled: true + max_request_size: 250m +``` + +## Workers + +Workers are exact copies of the code and compilation output as a `web` instance after a [`build` hook](#hooks). +They use the same container image. + +Workers can't accept public requests and so are suitable only for background tasks. +If they exit, they're automatically restarted. + +The keys of the `workers` definition are the names of the workers. +You can then define how each worker differs from the `web` instance using +the [top-level properties](#top-level-properties). + +Each worker can differ from the `web` instance in all properties _except_ for: + +- `build` and `dependencies` properties, which must be the same +- `crons` as cron jobs don't run on workers +- `hooks` as the `build` hook must be the same + and the `deploy` and `post_deploy` hooks don't run on workers. + +A worker named `queue` that was small and had a different start command could look like this: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + workers: + queue: + commands: + start: | + ./worker.sh +``` + +Workers require resource definition using `{{% vendor/cli %}} resources:set`, same as application containers. +For more information, see how to [manage resources](/manage-resources.md). + +## Access + +The `access` dictionary has one allowed key: + +| Name | Allowed values | Default | Description | +|-------|-------------------------------------|---------------|-----------------------------------------------------------------------| +| `ssh` | `admin`, `contributor`, or `viewer` | `contributor` | Defines the minimum role required to access app environments via SSH. | + +In the following example, only users with `admin` permissions for the +given [environment type](/administration/users.md#environment-type-roles) +can access the deployed environment via SSH: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + access: + ssh: admin +``` + +## Variables + +{{% vendor/name %}} provides a number of ways to set [variables](/development/variables/_index.md). +Variables set in your app configuration have the lowest precedence, +meaning they're overridden by any conflicting values provided elsewhere. + +All variables set in your app configuration must have a prefix. +Some [prefixes have specific meanings](/development/variables/_index.md#variable-prefixes). + +Variables with the prefix `env` are available as a separate environment variable. +All other variables are available in +the [`PLATFORM_VARIABLES` environment variable](/development/variables/use-variables.md#use-provided-variables). + +The following example sets two variables: + +- A variable named `env:AUTHOR` with the value `Juan` that's available in the environment as `AUTHOR` +- A variable named `d8config:system.site:name` with the value `My site rocks` + that's available in the `PLATFORM_VARIABLES` environment variable + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + variables: + env: + AUTHOR: 'Juan' + d8config: + "system.site:name": 'My site rocks' +``` + +You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). + +## Firewall + +{{< premium-features/tiered "Elite and Enterprise" >}} + +Set limits in outbound traffic from your app with no impact on inbound requests. + +The `outbound` key is required and contains one or more rules. +The rules define what traffic is allowed; anything unspecified is blocked. + +Each rule has the following properties where at least one is required and `ips` and `domains` can't be specified +together: + +| Name | Type | Default | Description | +|-----------|---------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | +| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | +| `ports` | Array of `integer`s | | Ports from 1 to 65535 that are allowed. If any ports are specified, all unspecified ports are blocked. If no ports are specified, all ports are allowed. Port `25`, the SMTP port for sending email, is always blocked. | + +The default settings would look like this: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + firewall: + outbound: + - ips: [ "0.0.0.0/0" ] +``` + +### Support for rules + +Where outbound rules for firewalls are supported in all environments. + +### Multiple rules + +Multiple firewall rules can be specified. +In such cases, a given outbound request is allowed if it matches _any_ of the defined rules. + +So in the following example requests to any IP on port 80 are allowed +and requests to 1.2.3.4 on either port 80 or 443 are allowed: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + firewall: + outbound: + - ips: [ "1.2.3.4/32" ] + ports: [ 443 ] + - ports: [ 80 ] +``` + +### Outbound traffic to CDNs + +Be aware that many services are behind a content delivery network (CDN). +For most CDNs, routing is done via domain name, not IP address, +so thousands of domain names may share the same public IP addresses at the CDN. +If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that +CDN. + +### Outbound traffic by domain + +You can filter outbound traffic by domain. +Using domains in your rules rather than IP addresses is generally more specific and secure. +For example, if you use an IP address for a service with a CDN, +you have to allow the IP address for the CDN. +This means that you allow potentially hundreds or thousands of other servers also using the CDN. + +An example rule filtering by domain: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "python@{{% latest python %}}" ] + firewall: + outbound: + - protocol: tcp + domains: [ "api.stripe.com", "api.twilio.com" ] + ports: [ 80, 443 ] + - protocol: tcp + ips: [ "1.2.3.4/29","2.3.4.5" ] + ports: [ 22 ] +``` + +#### Determine which domains to allow + +To determine which domains to include in your filtering rules, +find the domains your site has requested the DNS to resolve. +Run the following command to parse your server’s `dns.log` file +and display all Fully Qualified Domain Names that have been requested: + +```bash +awk '/query\[[^P]\]/ { print $6 | "sort -u" }' /var/log/dns.log +``` + +The output includes all DNS requests that were made, including those blocked by your filtering rules. +It doesn't include any requests made using an IP address. + +Example output: + +```bash +facebook.com +fastly.com +upsun.com +www.google.com +www.upsun.com +``` +## Hooks + +There are three different hooks that run as part of the process of building and deploying your app. +These are places where you can run custom scripts. +They are: the `build` hook, the `deploy` hook, and the `post_deploy` hook. +Only the `build` hook is run for [worker instances](#workers), while [web instances](#web) run all three. + +The process is ordered as: + +1. Variables accessible at build time become available. +1. The `build` hook is run. +1. The file system is changed to read only (except for any [mounts](#mounts)). +1. The app container starts. Variables accessible at runtime and services become available. +1. The `deploy` hook is run. +1. The app container begins accepting requests. +1. The `post_deploy` hook is run. + +Note that if an environment changes by no code changes, only the last step is run. +If you want the entire process to run, see how +to [manually trigger builds](/development/troubleshoot.md#manually-trigger-builds). + +### Writable directories during build + +During the `build` hook, there are three writeable directories: + +- `PLATFORM_APP_DIR`: + Where your code is checked out and the working directory when the `build` hook starts. + Becomes the app that gets deployed. +- `PLATFORM_CACHE_DIR`: + Persists between builds, but isn't deployed. + Shared by all builds on all branches. +- `/tmp`: + Isn't deployed and is wiped between each build. + Note that `PLATFORM_CACHE_DIR` is mapped to `/tmp` + and together they offer about 8GB of free space. + +### Hook failure + +Each hook is executed as a single script, so they're considered to have failed only if the final command in them fails. +To cause them to fail on the first failed command, add `set -e` to the beginning of the hook. + +If a `build` hook fails for any reason, the build is aborted and the deploy doesn't happen. +Note that this only works for `build` hooks -- +if other hooks fail, the app is still deployed. + +#### Automated testing + +It’s preferable that you set up and run automated tests in a dedicated CI/CD tool. +Relying on {{% vendor/name %}} hooks for such tasks can prove difficult. + +During the `build` hook, you can halt the deployment on a test failure but the following limitations apply: + +- Access to services such as databases, Redis, Vault KMS, and even writable mounts is disabled. + So any testing that relies on it is sure to fail. +- If you haven’t made changes to your app, an existing build image is reused and the build hook isn’t run. +- Test results are written into your app container, so they might get exposed to a third party. + +During the `deploy` hook, you can access services but **you can’t halt the deployment based on a test failure**. +Note that there are other downsides: + +- Your app container is read-only during the deploy hook, + so if your tests need to write reports and other information, you need to create a file mount for them. +- Your app can only be deployed once the deploy hook has been completed. + Therefore, running automated testing via the deploy hook generates slower deployments. +- Your environment isn’t available externally during the deploy hook. + Unit and integration testing might work without the environment being available, + but you can’t typically perform end-to-end testing until after the environment is up and available. + +## Crons + +The keys of the `crons` definition are the names of the cron jobs. +The names must be unique. + +If an application defines both a `web` instance and `worker` instances, cron jobs run only on the `web` instance. + +See how to [get cron logs](/increase-observability/logs/access-logs.md#container-logs). + +The following table shows the properties for each job: + +| Name | Type | Required | Description | +|--------------------|----------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `spec` | `string` | Yes | The [cron specification](https://en.wikipedia.org/wiki/Cron#Cron_expression). To prevent competition for resources that might hurt performance, use `H` in definitions to indicate an unspecified but invariant time. For example, instead of using `0 * * * *` to indicate the cron job runs at the start of every hour, you can use `H * * * *` to indicate it runs every hour, but not necessarily at the start. This prevents multiple cron jobs from trying to start at the same time. | +| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | +| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | +| `timeout` | `integer` | No | The maximum amount of time a cron can run before it's terminated. Defaults to the maximum allowed value of `86400` seconds (24 hours). | + +Note that you can [cancel pending or running crons](/environments/cancel-activity.md). + +### Cron commands + +| Name | Type | Required | Description | +|---------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `start` | `string` | Yes | The command that's run. It's run in [Dash](https://en.wikipedia.org/wiki/Almquist_shell). | +| `stop` | `string` | No | The command that's issued to give the cron command a chance to shutdown gracefully, such as to finish an active item in a list of tasks. Issued when a cron task is interrupted by a user through the CLI or Console. If not specified, a `SIGTERM` signal is sent to the process. | + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "nodejs@{{% latest nodejs %}}" ] + crons: + mycommand: + spec: 'H * * * *' + commands: + start: sleep 60 && echo sleep-60-finished && date + stop: killall sleep + shutdown_timeout: 18 +``` + +In this example configuration, the [cron specification](#crons) uses the `H` syntax. + +### Example cron jobs + + +{{< codetabs >}} + ++++ +title=Drupal ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Run Drupal's cron tasks every 19 minutes. + drupal: + spec: '*/19 * * * *' + commands: + start: 'cd web ; drush core-cron' + # But also run pending queue tasks every 7 minutes. + # Use an odd number to avoid running at the same time as the `drupal` cron. + drush-queue: + spec: '*/7 * * * *' + commands: + start: 'cd web ; drush queue-run aggregator_feeds' +{{< /snippet >}} +``` + +<---> + ++++ +title=Ruby on Rails ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "ruby@{{% latest ruby %}}" ] +crons: + # Execute a rake script every 19 minutes. + ruby: + spec: '*/19 * * * *' + commands: + start: 'bundle exec rake some:task' +{{< /snippet >}} +``` + +<---> + ++++ +title=Laravel ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Run Laravel's scheduler every 5 minutes. + scheduler: + spec: '*/5 * * * *' + cmd: 'php artisan schedule:run' +{{< /snippet >}} +``` + +<---> + ++++ +title=Symfony ++++ + +```yaml {configFile="app"} +{{< snippet name="myapp" config="app" root="/" >}} +stack: [ "php@{{% latest php %}}" ] +crons: + # Take a backup of the environment every day at 5:00 AM. + snapshot: + spec: 0 5 * * * + cmd: | + # Only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi +{{< /snippet >}} +``` + +{{< /codetabs >}} + + +### Conditional crons + +If you want to set up customized cron schedules depending on the environment type, +define conditional crons. +To do so, use a configuration similar to the following: + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "php@{{% latest php %}}" ] + crons: + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi +``` + +### Cron job timing + +The minimum time between cron jobs being triggered is 5 minutes. + +For each app container, only one cron job can run at a time. +If a new job is triggered while another is running, the new job is paused until the other completes. + +To minimize conflicts, a random offset is applied to all triggers. +The offset is a random number of seconds up to 20 minutes or the cron frequency, whichever is smaller. + +Crons are also paused while activities such as [backups](/environments/backup) are running. +The crons are queued to run after the other activity finishes. + +To run cron jobs in a timezone other than UTC, set the [timezone property](#top-level-properties). + +### Paused crons + +[Preview environments](/glossary.md#preview-environment) are often used for a limited time and then abandoned. +While it's useful for environments under active development to have scheduled tasks, +unused environments don't need to run cron jobs. +To minimize unnecessary resource use, +crons on environments with no deployments are paused. + +This affects all preview environments, _and_ production environment that do not yet have a domain attached to them. + +Such environments with deployments within 14 days have crons with the status `running`. +If there haven't been any deployments within 14 days, the status is `paused`. + +You can see the status in the Console +or using the CLI by running `{{% vendor/cli %}} environment:info` and looking under `deployment_state`. + +#### Restarting paused crons + +If the crons on your preview environment are paused but you're still using them, +you can push changes to the environment or redeploy it. + +To restart crons without changing anything: + +{{< codetabs >}} + ++++ +title=In the Console ++++ + +1. In the Console, navigate to your project. +1. Open the environment where you'd like the crons to run. +1. Click `Redeploy` next to the cron status of `Paused`. + +<---> + ++++ +title=Using the CLI ++++ + +Run the following command: + +```bash +{{% vendor/cli %}} redeploy +``` + +{{< /codetabs >}} + +### Sizing hints + +The following table shows the properties that can be set in `sizing_hints`: + +| Name | Type | Default | Minimum | Description | +|-------------------|-----------|---------|---------|------------------------------------------------| +| `request_memory` | `integer` | 45 | 10 | The average memory consumed per request in MB. | +| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | + +See more about [PHP-FPM workers and sizing](/languages/php/fpm.md). + +{{% note title="TODO" %}} +Not sure if applicable. +{{% /note %}} + +## Source + +The following table shows the properties that can be set in `source`: + +| Name | Type | Required | Description | +|--------------|--------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------| +| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](../source-operations.md) | +| `root` | `string` | | The path where the app code lives. Defaults to the root project directory. Useful for [multi-app setups](../multi-app/_index.md). | + +## Container profile + +By default, {{% vendor/name %}} allocates a container profile to each app and service depending on the range of resources it’s +expected to need. + +Each container profile gives you access to a specific list of CPU and RAM combinations. +Using the {{% vendor/name %}} CLI or Console, you can then pick a CPU and RAM combination for each of your apps and services. + +- [Container profile types and resources](/manage-resources/adjust-resources#advanced-container-profiles) +- [Default container profiles](/manage-resources/adjust-resources#default-container-profiles) for runtime and service + containers +- [Customize resources using the `container_profile` key](/manage-resources/adjust-resources#adjust-a-container-profile) + +## Additional hosts + +If you're using a private network with specific IP addresses you need to connect to, +you might want to map those addresses to hostnames to better remember and organize them. +In such cases, you can add a map of those IP addresses to whatever hostnames you like. +Then when your app tries to access the hostname, it's sent to the proper IP address. + +So in the following example, if your app tries to access `api.example.com`, it's sent to `192.0.2.23`. + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + stack: [ "php@{{% latest php %}}" ] + additional_hosts: + api.example.com: "192.0.2.23" + web.example.com: "203.0.113.42" +``` + +This is equivalent to adding the mapping to the `/etc/hosts` file for the container. diff --git a/sites/friday/src/create-apps/app-reference.md b/sites/upsun/src/create-apps/app-reference/single-runtime-image.md similarity index 52% rename from sites/friday/src/create-apps/app-reference.md rename to sites/upsun/src/create-apps/app-reference/single-runtime-image.md index 0f95c7ee29..d3df9d8737 100644 --- a/sites/friday/src/create-apps/app-reference.md +++ b/sites/upsun/src/create-apps/app-reference/single-runtime-image.md @@ -1,5 +1,5 @@ --- -title: "App reference" +title: "Single-runtime image" weight: 4 description: See all of the options for controlling your apps and how they're built and deployed on {{% vendor/name %}}. --- @@ -9,50 +9,52 @@ description: See all of the options for controlling your apps and how they're bu Configuration is all done in a `{{< vendor/configfile "app" >}}` file, located at the root of your Git repository. -See a [comprehensive example](./_index.md#comprehensive-example) of a configuration in a `{{< vendor/configfile "app" >}}` file. +See a [comprehensive example](../_index.md#comprehensive-example) of a configuration in +a `{{< vendor/configfile "app" >}}` file. ## Primary application properties -All application configuration takes place in a `{{< vendor/configfile "app" >}}` file, with each application configured under a unique key beneath the top-level `applications` key. -For example, it is possible to deploy two application containers - one JavaScript and the other Python - for the frontend and backend components of a deployed site. +All application configuration takes place in a `{{< vendor/configfile "app" >}}` file, with each application configured +under a unique key beneath the top-level `applications` key. +For example, it is possible to deploy two application containers - one JavaScript and the other Python - for the +frontend and backend components of a deployed site. In this case, the unified `{{< vendor/configfile "app" >}}` file would look like: ```yaml {configFile="app"} applications: - frontend: - type: 'nodejs:{{% latest "nodejs" %}}' - # Additional frontend configuration - backend: - type: 'python:{{% latest "python" %}}' - # Additional backend configuration + frontend: + type: 'nodejs:{{% latest "nodejs" %}}' + # Additional frontend configuration + backend: + type: 'python:{{% latest "python" %}}' + # Additional backend configuration ``` -The following table presents all properties available at the level just below the unique application name (`frontend` and `backend` above). +The following table presents all properties available at the level just below the unique application name (`frontend` +and `backend` above). The column _Set in instance?_ defines whether the given property can be overridden within a `web` or `workers` instance. To override any part of a property, you have to provide the entire property. - -| Name | Type | Required | Set in instance? | Description | -| ------------------ | --------------------------------------------------- | -------- | ---------------- | ----------- | -| `name` | `string` | Yes | No | A unique name for the app. Must be lowercase alphanumeric characters. Changing the name destroys data associated with the app. | -| `type` | A [type](#types) | Yes | No | The base image to use with a specific app language. Format: `runtime:version`. | -| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | -| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. Allocated disk for mounts is defined with a separate resource configuration call using `{{% vendor/cli %}} resources:set`. | -| `web` | A [web instance](#web) | | N/A | How the web application is served. | -| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | -| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](./timezone.md) | -| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | -| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | -| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | -| `build` | A [build dictionary](#build) | | No | What happens when the app is built. | -| `dependencies` | A [dependencies dictionary](#dependencies) | | No | What global dependencies to install before the `build` hook is run. | -| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | -| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | -| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | -| `runtime` | A [runtime dictionary](#runtime) | | No | Customizations to your PHP or Lisp runtime. | -| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | +| Name | Type | Required | Set in instance? | Description | +|--------------------|-----------------------------------------------------|----------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | A [type](#types) | Yes | No | The base image to use with a specific app language. Format: `runtime:version`. | +| `relationships` | A dictionary of [relationships](#relationships) | | Yes | Connections to other services and apps. | +| `mounts` | A dictionary of [mounts](#mounts) | | Yes | Directories that are writable even after the app is built. Allocated disk for mounts is defined with a separate resource configuration call using `{{% vendor/cli %}} resources:set`. | +| `web` | A [web instance](#web) | | N/A | How the web application is served. | +| `workers` | A [worker instance](#workers) | | N/A | Alternate copies of the application to run as background processes. | +| `timezone` | `string` | | No | The timezone for crons to run. Format: a [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Defaults to `UTC`, which is the timezone used for all logs no matter the value here. See also [app runtime timezones](../timezone.md) | +| `access` | An [access dictionary](#access) | | Yes | Access control for roles accessing app environments. | +| `variables` | A [variables dictionary](#variables) | | Yes | Variables to control the environment. | +| `firewall` | A [firewall dictionary](#firewall) | | Yes | Outbound firewall rules for the application. | +| `build` | A [build dictionary](#build) | | No | What happens when the app is built. | +| `dependencies` | A [dependencies dictionary](#dependencies) | | No | What global dependencies to install before the `build` hook is run. | +| `hooks` | A [hooks dictionary](#hooks) | | No | What commands run at different stages in the build and deploy process. | +| `crons` | A [cron dictionary](#crons) | | No | Scheduled tasks for the app. | +| `source` | A [source dictionary](#source) | | No | Information on the app's source code and operations that can be run on it. | +| `runtime` | A [runtime dictionary](#runtime) | | No | Customizations to your PHP or Lisp runtime. | +| `additional_hosts` | An [additional hosts dictionary](#additional-hosts) | | Yes | Maps of hostnames to IP addresses. | ## Root directory @@ -61,20 +63,27 @@ The root defaults to the root of the repository. ```yaml {configFile="app"} applications: - frontend: - type: 'nodejs:{{% latest "nodejs" %}}' - # Default behavior of source.root - source: - root: "/" + frontend: + type: 'nodejs:{{% latest "nodejs" %}}' + # Default behavior of source.root + source: + root: "/" ``` -That is, if a custom value for `source.root` is not provided in your configuration, the default behavior is equivalent to the above. +That is, if a custom value for `source.root` is not provided in your configuration, the default behavior is equivalent +to the above. -To specify another directory, for example for a [multi-app project](./multi-app/_index.md), +To specify another directory, for example for a [multi-app project](../multi-app/_index.md), use the [`source.root` property](#source). ## Types +{{% note theme="info" %}} +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +If you've reached this section from another page, you may be interested in supported `stacks` where `type` was referenced. +See [supported Nix packages for the `stack` key](/create-apps/app-reference/composable-image#supported-nix-packages) for more information. +{{% /note %}} + The `type` defines the base container image used to run the application. The version is the major (`X`) and sometimes minor (`X.Y`) version numbers, depending on the service, as in the following table. @@ -90,13 +99,36 @@ These are used in the format `runtime:version`: ```yaml {configFile="app"} applications: - myapp: - type: 'php:{{% latest "php" %}}' + myapp: + type: 'php:{{% latest "php" %}}' +``` + +### Mix of images + +In a [multiple application context](/create-apps/multi-app/_index.md), you can mix both [single-runtime image](/create-apps/app-reference/single-runtime-image.md) and [Composable Image (BETA)](/create-apps/app-reference/composable-image.md) per application. + +As an example configuration for a ``frontend`` and a ``backend`` application: + +```yaml {configFile="app"} +applications: + backend: + type: 'nodejs:{{% latest "nodejs" %}} + frontend: + stack: + - "php@{{% latest "php" %}}" + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + - "python@3.12" + - "python312Packages.yq" # python package specific ``` ## Resources -Resources for application containers are not committed to YAML files, but instead managed over the API using either the Console or the `{{% vendor/cli %}} resources:set` command. +Resources for application containers are not committed to YAML files, but instead managed over the API using either the +Console or the `{{% vendor/cli %}} resources:set` command. For more information, see how to [manage resources](/manage-resources.md). @@ -106,40 +138,45 @@ To access another container within your project, you need to define a relationsh You can give each relationship any name you want. The relationship is specified in the form `service_name:endpoint_name`. -The `service_name` is the name of the service given in the [services configuration](../add-services/_index.md) +The `service_name` is the name of the service given in the [services configuration](/add-services/_index.md) or the name of another application in the same project specified as the `name` in that app's configration. The `endpoint_name` is the exposed functionality of the service to use. For most services, the endpoint is the same as the service type. -For some services (such as [MariaDB](../add-services/mysql/_index.md#multiple-databases) and [Solr](../add-services/solr.md#solr-6-and-later)), -you can define additional explicit endpoints for multiple databases and cores in the [service's configuration](../add-services/_index.md). +For some services (such as [MariaDB](/add-services/mysql/_index.md#multiple-databases) +and [Solr](/add-services/solr.md#solr-6-and-later)), +you can define additional explicit endpoints for multiple databases and cores in +the [service's configuration](/add-services/_index.md). The following example shows a single MySQL service named `mysqldb` offering two databases, a Redis cache service named `rediscache`, and an Elasticsearch service named `searchserver`. ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'nodejs:{{% latest "nodejs" %}}' - relationships: - database: 'mysqldb:db1' - database2: 'mysqldb:db2' - cache: 'rediscache:redis' - search: 'searchserver:elasticsearch' + myapp: + source: + root: "/" + type: 'nodejs:{{% latest "nodejs" %}}' + relationships: + database: 'mysqldb:db1' + database2: 'mysqldb:db2' + cache: 'rediscache:redis' + search: 'searchserver:elasticsearch' ``` {{% note %}} Once a service is running and exposed via a relationship, -its credentials (such as the host, username, and password) are automatically available as [service environment variables](/development/variables.html#service-environment-variables), +its credentials (such as the host, username, and password) are automatically available +as [service environment variables](/development/variables.html#service-environment-variables), in the `$_` format. -The available information is documented on each service's page, along with sample code for how to connect to it from your app. +The available information is documented on each service's page, along with sample code for how to connect to it from +your app. {{% /note %}} ## Available disk space -Disk for application containers are not committed to YAML files, but instead managed over the API using either the Console or the `{{% vendor/cli %}} resources:set` command. +Disk for application containers are not committed to YAML files, but instead managed over the API using either the +Console or the `{{% vendor/cli %}} resources:set` command. For more information, see how to [manage resources](/manage-resources.md). @@ -172,25 +209,25 @@ To define a mount, use the following configuration: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: nodejs:{{% latest "nodejs" %}} - mounts: - '{{< variable "MOUNT_PATH" >}}': - source: {{< variable "MOUNT_TYPE" >}} - source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + myapp: + source: + root: "/" + type: nodejs:{{% latest "nodejs" %}} + mounts: + '{{< variable "MOUNT_PATH" >}}': + source: {{< variable "MOUNT_TYPE" >}} + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} ``` + {{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). If you already have a directory with that name, you get a warning that it isn't accessible after the build. -See how to [troubleshoot the warning](./troubleshoot-mounts.md#overlapping-folders). - +See how to [troubleshoot the warning](../troubleshoot-mounts.md#overlapping-folders). | Name | Type | Required | Description | | ------------- | -------------------- | -------- | ----------- | -| `source` | `storage`, `tmp`, or `service` | Yes | Specifies the type of the mount:

- By design, `storage` mounts can be shared between instances of the same app. You can also configure them so they are [shared between different apps](#share-a-mount-between-several-apps).

- `tmp` mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**.

- `service` mounts can be useful if you want to explicitly define and use a [Network Storage](/add-services/network-storage.md) service to share data between different apps (instead of using a `storage` mount).| +| `source` | `storage`, `instance`, `tmp` (also called `temporary`), or `service` | Yes | Specifies the type of the mount:

- By design, `storage` mounts can be shared between instances of the same app. You can also configure them so they are [shared between different apps](#share-a-mount-between-several-apps).

-`instance` mounts are local mounts. Unique to your app, they are useful to store files that remain local to the app instance, such as application logs.

- `tmp` (or `temporary`) mounts are local ephemeral mounts, where an external directory is mounted to the `/tmp` directory of your app.
The content of a `tmp` mount **may be removed during infrastructure maintenance operations**. Therefore, `tmp` mounts allow you to **store files that you’re not afraid to lose**, such as your application cache that can be seamlessly rebuilt.
Note that the `/tmp` directory has **a maximum allocation of 8 GB**.

- `service` mounts can be useful if you want to explicitly define and use a [Network Storage](/add-services/network-storage.md) service to share data between different apps (instead of using a `storage` mount).| | `source_path` | `string` | No | Specifies where the mount points **inside the [external directory](#mounts)**.

- If you explicitly set a `source_path`, your mount points to a specific subdirectory in the external directory.

- If the `source_path` is an empty string (`""`), your mount points to the entire external directory.

- If you don't define a `source_path`, {{% vendor/name %}} uses the {{< variable "MOUNT_PATH" >}} as default value, without leading or trailing slashes.
For example, if your mount lives in the `/web/uploads/` directory in your app container, it will point to a directory named `web/uploads` in the external directory.

**WARNING:** Changing the name of your mount affects the `source_path` when it's undefined. See [how to ensure continuity](#ensure-continuity-when-changing-the-name-of-your-mount) and maintain access to your files. | -| `service` | `string` | | The purpose of the `service` key depends on your use case.

In a multi-app context where a `storage` mount is shared between apps, `service` is required. Its value is the name of the app whose mount you want to share. See how to [share a mount between several apps](#share-a-mount-between-several-apps).

In a multi-app context where a [Network Storage service](../add-services/network-storage.md) (`service` mount) is shared between apps, `service` is required and specifies the name of that Network Storage. | +| `service` | `string` | | The purpose of the `service` key depends on your use case.

In a multi-app context where a `storage` mount is shared between apps, `service` is required. Its value is the name of the app whose mount you want to share. See how to [share a mount between several apps](#share-a-mount-between-several-apps).

In a multi-app context where a [Network Storage service](/add-services/network-storage.md) (`service` mount) is shared between apps, `service` is required and specifies the name of that Network Storage. | The accessibility to the web of a mounted directory depends on the [`web.locations` configuration](#web). Files can be all public, all private, or with different rules for different paths and file types. @@ -204,27 +241,28 @@ or until the app container is moved to another host during a maintenance operati ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: nodejs:20 - mounts: - 'web/uploads': - source: storage - source_path: uploads - '/.tmp_platformsh': - source: tmp - source_path: files/.tmp_platformsh - '/build': - source: storage - source_path: files/build - '/.cache': - source: tmp - source_path: files/.cache - '/node_modules/.cache': - source: tmp - source_path: files/node_modules/.cache + myapp: + source: + root: "/" + type: nodejs:20 + mounts: + 'web/uploads': + source: storage + source_path: uploads + '/.tmp_platformsh': + source: tmp + source_path: files/.tmp_platformsh + '/build': + source: storage + source_path: files/build + '/.cache': + source: tmp + source_path: files/.cache + '/node_modules/.cache': + source: tmp + source_path: files/node_modules/.cache ``` + ### Ensure continuity when changing the name of your mount Changing the name of your mount affects the default `source_path`. @@ -233,22 +271,24 @@ Say you have a `/my/cache/` mount with an undefined `source_path`: ```yaml {configFile="app"} mounts: - '/my/cache/': - source: tmp + '/my/cache/': + source: tmp ``` - If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. +If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. - To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading or trailing slashes: +To ensure continuity, you need to explicitly define the `source_path` as the previous name of the mount, without leading +or trailing slashes: ```yaml {configFile="app"} mounts: - '/cache/files/': - source: tmp - source_path: my/cache + '/cache/files/': + source: tmp + source_path: my/cache ``` -The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing files in that directory. +The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing +files in that directory. ### Share a mount between several apps @@ -265,25 +305,28 @@ Use the following configuration: ```yaml {configFile="app"} applications: - app1: - mounts: - '{{< variable "MOUNT_PATH_1" >}}': - source: storage - source_path: {{< variable "SOURCE_PATH_LOCATION" >}} - - app2: - mounts: - '{{< variable "MOUNT_PATH_2" >}}': - source: storage - service: app1 - source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + app1: + mounts: + '{{< variable "MOUNT_PATH_1" >}}': + source: storage + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + + app2: + mounts: + '{{< variable "MOUNT_PATH_2" >}}': + source: storage + service: app1 + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} ``` -- {{< variable "MOUNT_PATH_1" >}} and {{< variable "MOUNT_PATH_2" >}} are the paths to each mount **within their respective app container** (relative to the app's root). +- {{< variable "MOUNT_PATH_1" >}} and {{< variable "MOUNT_PATH_2" >}} are the paths to each mount **within their + respective app container** (relative to the app's root). - When configuring the first `storage` mount, you don't need to include the `service` key. The first mount implicitly points to an external network directory. - The `service` key is required for subsequent mounts, to ensure they use the same external network directory as the first mount. -- The `source_path` allows you to point each mount to the same subdirectory **within the shared external network directory**. + The `service` key is required for subsequent mounts, to ensure they use the same external network directory as the + first mount. +- The `source_path` allows you to point each mount to the same subdirectory **within the shared external network + directory**. {{% note title = "Example" %}} @@ -326,61 +369,50 @@ Follow these steps: This creates another `storage` mount named `web/uploads` in the `frontend` app container. - The `service` key allows you to specify that the `web/uploads` mount should use the same external network directory as the mount previously defined in the `backend` app container. + The `service` key allows you to specify that the `web/uploads` mount should use the same external network directory + as the mount previously defined in the `backend` app container. - The `source_path` key specifies which subdirectory within the external network directory both mounts should share (here, the `backend/uploads` directory). + The `source_path` key specifies which subdirectory within the external network directory both mounts should share ( + here, the `backend/uploads` directory). {{% /note %}} -Note that another way to share data between apps through a mount is by explicitly [defining a Network Storage service](/add-services/network-storage.md). - -### Local mounts - -If you need a local mount (i.e. unique per container), -{{% vendor/name %}} allows you to mount a directory within the `/tmp` directory of your app. -However, the following limitations apply: - -- Content from `tmp` mounts is removed when your app container is moved to another host during an infrastructure maintenance operation -- The `/tmp` directory has a [maximum allocation of 8 GB](/create-apps/troubleshoot-disks.md#no-space-left-on-device) - -Therefore, `tmp` mounts are ideal to store non-critical data, such as your application cache which can be seamlessly rebuilt, -but aren't suitable for storing files that are necessary for your app to run smoothly. - -Note that {{% vendor/name %}} will provide new local mounts in the near future. +Note that another way to share data between apps through a mount is by +explicitly [defining a Network Storage service](/add-services/network-storage.md). ## Web Use the `web` key to configure the web server running in front of your app. Defaults may vary with a different [image `type`](#types). -| Name | Type | Required | Description | -| ----------- | -------------------------------------------- | ----------------------------- | ----------- | -| `commands` | A [web commands dictionary](#web-commands) | See [note](#required-command) | The command to launch your app. | -| `upstream` | An [upstream dictionary](#upstream) | | How the front server connects to your app. | -| `locations` | A [locations dictionary](#locations) | | How the app container responds to incoming requests. | +| Name | Type | Required | Description | +|-------------|--------------------------------------------|-------------------------------|------------------------------------------------------| +| `commands` | A [web commands dictionary](#web-commands) | See [note](#required-command) | The command to launch your app. | +| `upstream` | An [upstream dictionary](#upstream) | | How the front server connects to your app. | +| `locations` | A [locations dictionary](#locations) | | How the app container responds to incoming requests. | -See some [examples of how to configure what's served](./web/_index.md). +See some [examples of how to configure what's served](../web/_index.md). ### Web commands - -| Name | Type | Required | Description | -| ------- | -------- | ----------------------------- | ----------- | -| `pre_start` | `string` | | Command run just prior to `start`, which can be useful when you need to run _per-instance_ actions. | -| `start` | `string` | See [note](#required-command) | The command to launch your app. If it terminates, it's restarted immediately. | +| Name | Type | Required | Description | +|-------------|----------|-------------------------------|-----------------------------------------------------------------------------------------------------| +| `pre_start` | `string` | | Command run just prior to `start`, which can be useful when you need to run _per-instance_ actions. | +| `start` | `string` | See [note](#required-command) | The command to launch your app. If it terminates, it's restarted immediately. | Example: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - web: - commands: - start: 'uwsgi --ini conf/server.ini' + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + web: + commands: + start: 'uwsgi --ini conf/server.ini' ``` + This command runs every time your app is restarted, regardless of whether or not new code is deployed. {{< note >}} @@ -400,14 +432,14 @@ On PHP containers, it's optional and defaults to starting PHP-FPM (`/usr/bin/sta It can also be set explicitly on a PHP container to run a dedicated process, such as [React PHP](https://github.com/platformsh-examples/platformsh-example-reactphp) or [Amp](https://github.com/platformsh-examples/platformsh-example-amphp). -See how to set up [alternate start commands on PHP](../languages/php/_index.md#alternate-start-commands). +See how to set up [alternate start commands on PHP](/languages/php/_index.md#alternate-start-commands). ### Upstream -| Name | Type | Required | Description | Default | -| --------------- | ------------------- | -------- | ----------- | ----------- | -| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [image types](#types) except PHP; for PHP image types the default is `unix`. | -| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on [image `type`](#types). | +| Name | Type | Required | Description | Default | +|-----------------|---------------------|----------|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| `socket_family` | `tcp` or `unix` | | Whether your app listens on a Unix or TCP socket. | Defaults to `tcp` for all [image types](#types) except PHP; for PHP image types the default is `unix`. | +| `protocol` | `http` or `fastcgi` | | Whether your app receives incoming requests over HTTP or FastCGI. | Default varies based on [image `type`](#types). | For PHP, the defaults are configured for PHP-FPM and shouldn't need adjustment. For all other containers, the default for `protocol` is `http`. @@ -416,23 +448,24 @@ The following example is the default on non-PHP containers: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - web: - upstream: - socket_family: tcp - protocol: http + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + web: + upstream: + socket_family: tcp + protocol: http ``` + #### Where to listen Where to listen depends on your setting for `web.upstream.socket_family` (defaults to `tcp`). -| `socket_family` | Where to listen | -| --------------- | --------------- | -| `tcp` | The port specified by the [`PORT` environment variable](../development/variables/use-variables.md#use-provided-variables) | -| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](../development/variables/use-variables.md#use-provided-variables) | +| `socket_family` | Where to listen | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------| +| `tcp` | The port specified by the [`PORT` environment variable](/development/variables/use-variables.md#use-provided-variables) | +| `unix` | The Unix socket file specified by the [`SOCKET` environment variable](/development/variables/use-variables.md#use-provided-variables) | If your application isn't listening at the same place that the runtime is sending requests, you see `502 Bad Gateway` errors when you try to connect to your website. @@ -445,17 +478,17 @@ When multiple keys match an incoming request, the most-specific applies. The following table presents possible properties for each location: -| Name | Type | Default | Description | -| ------------------- | ---------------------------------------------------- | --------- | ----------- | -| `root` | `string` | | The directory to serve static assets for this location relative to the [app's root directory](#root-directory). Must be an actual directory inside the root directory. | -| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered.| -| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | -| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | -| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | -| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | -| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | -| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | -| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | +| Name | Type | Default | Description | +|---------------------|------------------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `root` | `string` | | The directory to serve static assets for this location relative to the [app's root directory](#root-directory). Must be an actual directory inside the root directory. | +| `passthru` | `boolean` or `string` | `false` | Whether to forward disallowed and missing resources from this location to the app. A string is a path with a leading `/` to the controller, such as `/index.php`.

If your app is in PHP, when setting `passthru` to `true`, you might want to set `scripts` to `false` for enhanced security. This prevents PHP scripts from being executed from the specified location. You might also want to set `allow` to `false` so that not only PHP scripts can't be executed, but their source code also can't be delivered. | +| `index` | Array of `string`s or `null` | | Files to consider when serving a request for a directory. When set, requires access to the files through the `allow` or `rules` keys. | +| `expires` | `string` | `-1` | How long static assets are cached. The default means no caching. Setting it to a value enables the `Cache-Control` and `Expires` headers. Times can be suffixed with `ms` = milliseconds, `s` = seconds, `m` = minutes, `h` = hours, `d` = days, `w` = weeks, `M` = months/30d, or `y` = years/365d. | +| `allow` | `boolean` | `true` | Whether to allow serving files which don't match a rule. | +| `scripts` | `boolean` | | Whether to allow scripts to run. Doesn't apply to paths specified in `passthru`. Meaningful only on PHP containers. | +| `headers` | A headers dictionary | | Any additional headers to apply to static assets, mapping header names to values. Responses from the app aren't affected. | +| `request_buffering` | A [request buffering dictionary](#request-buffering) | See below | Handling for chunked requests. | +| `rules` | A [rules dictionary](#rules) | | Specific overrides for specific locations. | #### Rules @@ -472,49 +505,51 @@ This is overridden by a rule that explicitly allows common image file formats. ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - web: - locations: - '/': - # Handle dynamic requests - root: 'public' - passthru: '/index.php' - # Disallow static files - allow: false - rules: - # Allow common image files only. - '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': - allow: true + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + web: + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/index.php' + # Disallow static files + allow: false + rules: + # Allow common image files only. + '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': + allow: true ``` + #### Request buffering Request buffering is enabled by default to handle chunked requests as most app servers don't support them. The following table shows the keys in the `request_buffering` dictionary: -| Name | Type | Required | Default | Description | -| ------------------ | --------- | -------- | ------- | ----------- | -| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | +| Name | Type | Required | Default | Description | +|--------------------|-----------|----------|---------|-------------------------------------------| +| `enabled` | `boolean` | Yes | `true` | Whether request buffering is enabled. | | `max_request_size` | `string` | | `250m` | The maximum size to allow in one request. | The default configuration would look like this: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - web: - locations: - '/': - passthru: true - request_buffering: - enabled: true - max_request_size: 250m + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + web: + locations: + '/': + passthru: true + request_buffering: + enabled: true + max_request_size: 250m ``` + ## Workers Workers are exact copies of the code and compilation output as a `web` instance after a [`build` hook](#hooks). @@ -524,7 +559,8 @@ Workers can't accept public requests and so are suitable only for background tas If they exit, they're automatically restarted. The keys of the `workers` definition are the names of the workers. -You can then define how each worker differs from the `web` instance using the [top-level properties](#top-level-properties). +You can then define how each worker differs from the `web` instance using +the [top-level properties](#top-level-properties). Each worker can differ from the `web` instance in all properties _except_ for: @@ -537,50 +573,54 @@ A worker named `queue` that was small and had a different start command could lo ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - workers: - queue: - commands: - start: | - ./worker.sh + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + workers: + queue: + commands: + start: | + ./worker.sh ``` Workers require resource definition using `{{% vendor/cli %}} resources:set`, same as application containers. For more information, see how to [manage resources](/manage-resources.md). + ## Access The `access` dictionary has one allowed key: -| Name | Allowed values | Default | Description | -| ----- | ----------------------------------- | ------------- | ----------- | +| Name | Allowed values | Default | Description | +|-------|-------------------------------------|---------------|-----------------------------------------------------------------------| | `ssh` | `admin`, `contributor`, or `viewer` | `contributor` | Defines the minimum role required to access app environments via SSH. | -In the following example, only users with `admin` permissions for the given [environment type](../administration/users.md#environment-type-roles) +In the following example, only users with `admin` permissions for the +given [environment type](/administration/users.md#environment-type-roles) can access the deployed environment via SSH: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - access: - ssh: admin + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + access: + ssh: admin ``` + ## Variables -{{% vendor/name %}} provides a number of ways to set [variables](../development/variables/_index.md). +{{% vendor/name %}} provides a number of ways to set [variables](/development/variables/_index.md). Variables set in your app configuration have the lowest precedence, meaning they're overridden by any conflicting values provided elsewhere. All variables set in your app configuration must have a prefix. -Some [prefixes have specific meanings](../development/variables/_index.md#variable-prefixes). +Some [prefixes have specific meanings](/development/variables/_index.md#variable-prefixes). Variables with the prefix `env` are available as a separate environment variable. -All other variables are available in the [`PLATFORM_VARIABLES` environment variable](../development/variables/use-variables.md#use-provided-variables). +All other variables are available in +the [`PLATFORM_VARIABLES` environment variable](/development/variables/use-variables.md#use-provided-variables). The following example sets two variables: @@ -590,17 +630,18 @@ The following example sets two variables: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - variables: - env: - AUTHOR: 'Juan' - d8config: - "system.site:name": 'My site rocks' + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + variables: + env: + AUTHOR: 'Juan' + d8config: + "system.site:name": 'My site rocks' ``` -You can also define and access more [complex values](../development/variables/use-variables.md#access-complex-values). + +You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). ## Firewall @@ -611,29 +652,32 @@ Set limits in outbound traffic from your app with no impact on inbound requests. The `outbound` key is required and contains one or more rules. The rules define what traffic is allowed; anything unspecified is blocked. -Each rule has the following properties where at least one is required and `ips` and `domains` can't be specified together: +Each rule has the following properties where at least one is required and `ips` and `domains` can't be specified +together: -| Name | Type | Default | Description | -| --------- | ------------------- | --------------- | ----------- | -| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | -| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | +| Name | Type | Default | Description | +|-----------|---------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ips` | Array of `string`s | `["0.0.0.0/0"]` | IP addresses in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). See a [CIDR format converter](https://www.ipaddressguide.com/cidr). | +| `domains` | Array of `string`s | | [Fully qualified domain names](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to specify specific destinations by hostname. | | `ports` | Array of `integer`s | | Ports from 1 to 65535 that are allowed. If any ports are specified, all unspecified ports are blocked. If no ports are specified, all ports are allowed. Port `25`, the SMTP port for sending email, is always blocked. | The default settings would look like this: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - firewall: - outbound: - - ips: ["0.0.0.0/0"] + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + firewall: + outbound: + - ips: [ "0.0.0.0/0" ] ``` + ### Support for rules Where outbound rules for firewalls are supported in all environments. + ### Multiple rules Multiple firewall rules can be specified. @@ -644,22 +688,24 @@ and requests to 1.2.3.4 on either port 80 or 443 are allowed: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - firewall: - outbound: - - ips: ["1.2.3.4/32"] - ports: [443] - - ports: [80] + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + firewall: + outbound: + - ips: [ "1.2.3.4/32" ] + ports: [ 443 ] + - ports: [ 80 ] ``` + ### Outbound traffic to CDNs Be aware that many services are behind a content delivery network (CDN). For most CDNs, routing is done via domain name, not IP address, so thousands of domain names may share the same public IP addresses at the CDN. -If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that CDN. +If you allow the IP address of a CDN, you are usually allowing many or all of the other customers hosted behind that +CDN. ### Outbound traffic by domain @@ -673,19 +719,20 @@ An example rule filtering by domain: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'python:{{% latest "python" %}}' - firewall: - outbound: - - protocol: tcp - domains: ["api.stripe.com", "api.twilio.com"] - ports: [80, 443] - - protocol: tcp - ips: ["1.2.3.4/29","2.3.4.5"] - ports: [22] + myapp: + source: + root: "/" + type: 'python:{{% latest "python" %}}' + firewall: + outbound: + - protocol: tcp + domains: [ "api.stripe.com", "api.twilio.com" ] + ports: [ 80, 443 ] + - protocol: tcp + ips: [ "1.2.3.4/29","2.3.4.5" ] + ports: [ 22 ] ``` + #### Determine which domains to allow To determine which domains to include in your filtering rules, @@ -705,9 +752,9 @@ Example output: ```bash facebook.com fastly.com -platform.sh +upsun.com www.google.com -www.platform.sh +www.upsun.com ``` ## Build @@ -717,21 +764,22 @@ Flavors are language-specific. See what the build flavor is for your language: -- [Node.js](../languages/nodejs/_index.md#dependencies) -- [PHP](../languages/php/_index.md#dependencies) +- [Node.js](/languages/nodejs/_index.md#dependencies) +- [PHP](/languages/php/_index.md#dependencies) In all languages, you can also specify a flavor of `none` to take no action at all (which is the default for any language other than PHP and Node.js). ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'nodejs:{{% latest "nodejs" %}}' - build: - flavor: none + myapp: + source: + root: "/" + type: 'nodejs:{{% latest "nodejs" %}}' + build: + flavor: none ``` + ## Dependencies Installs global dependencies as part of the build process. @@ -739,13 +787,13 @@ They're independent of your app's dependencies and are available in the `PATH` during the build process and in the runtime environment. They're installed before the `build` hook runs using a package manager for the language. -| Language | Key name | Package manager | -| -------- | --------------------- | --------------- | -| PHP | `php` | [Composer](https://getcomposer.org/) | -| Python 2 | `python` or `python2` | [Pip 2](https://packaging.python.org/tutorials/installing-packages/) | -| Python 3 | `python3` | [Pip 3](https://packaging.python.org/tutorials/installing-packages/) | -| Ruby | `ruby` | [Bundler](https://bundler.io/) | -| Node.js | `nodejs` | [npm](https://www.npmjs.com/) (see [how to use yarn](../languages/nodejs/_index.md#use-yarn-as-a-package-manager))| +| Language | Key name | Package manager | +|----------|-----------------------|--------------------------------------------------------------------------------------------------------------------| +| PHP | `php` | [Composer](https://getcomposer.org/) | +| Python 2 | `python` or `python2` | [Pip 2](https://packaging.python.org/tutorials/installing-packages/) | +| Python 3 | `python3` | [Pip 3](https://packaging.python.org/tutorials/installing-packages/) | +| Ruby | `ruby` | [Bundler](https://bundler.io/) | +| Node.js | `nodejs` | [npm](https://www.npmjs.com/) (see [how to use yarn](/languages/nodejs/_index.md#use-yarn-as-a-package-manager)) | | Java | `java` | [Apache Maven](https://maven.apache.org/), [Gradle](https://gradle.org/), or [Apache Ant](https://ant.apache.org/) | The format for package names and version constraints are defined by the specific package manager. @@ -754,24 +802,25 @@ An example of dependencies in multiple languages: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'nodejs:{{% latest "nodejs" %}}' - dependencies: - php: # Specify one Composer package per line. - drush/drush: '8.0.0' - composer/composer: '^2' - python2: # Specify one Python 2 package per line. - behave: '*' - requests: '*' - python3: # Specify one Python 3 package per line. - numpy: '*' - ruby: # Specify one Bundler package per line. - sass: '3.4.7' - nodejs: # Specify one NPM package per line. - pm2: '^4.5.0' + myapp: + source: + root: "/" + type: 'nodejs:{{% latest "nodejs" %}}' + dependencies: + php: # Specify one Composer package per line. + drush/drush: '8.0.0' + composer/composer: '^2' + python2: # Specify one Python 2 package per line. + behave: '*' + requests: '*' + python3: # Specify one Python 3 package per line. + numpy: '*' + ruby: # Specify one Bundler package per line. + sass: '3.4.7' + nodejs: # Specify one NPM package per line. + pm2: '^4.5.0' ``` + ## Hooks There are three different hooks that run as part of the process of building and deploying your app. @@ -792,7 +841,8 @@ The process is ordered as: 1. The `post_deploy` hook is run. Note that if an environment changes by no code changes, only the last step is run. -If you want the entire process to run, see how to [manually trigger builds](../development/troubleshoot.md#manually-trigger-builds). +If you want the entire process to run, see how +to [manually trigger builds](/development/troubleshoot.md#manually-trigger-builds). ### Writable directories during build @@ -848,40 +898,41 @@ The names must be unique. If an application defines both a `web` instance and `worker` instances, cron jobs run only on the `web` instance. -See how to [get cron logs](../increase-observability/logs/access-logs.md#container-logs). +See how to [get cron logs](/increase-observability/logs/access-logs.md#container-logs). The following table shows the properties for each job: -| Name | Type | Required | Description | -| ------------------ | -------------------------------------------- | -------- | ----------- | +| Name | Type | Required | Description | +|--------------------|----------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `spec` | `string` | Yes | The [cron specification](https://en.wikipedia.org/wiki/Cron#Cron_expression). To prevent competition for resources that might hurt performance, use `H` in definitions to indicate an unspecified but invariant time. For example, instead of using `0 * * * *` to indicate the cron job runs at the start of every hour, you can use `H * * * *` to indicate it runs every hour, but not necessarily at the start. This prevents multiple cron jobs from trying to start at the same time. | -| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | -| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | -| `timeout` | `integer` | No | The maximum amount of time a cron can run before it's terminated. Defaults to the maximum allowed value of `86400` seconds (24 hours). +| `commands` | A [cron commands dictionary](#cron-commands) | Yes | A definition of what commands to run when starting and stopping the cron job. | +| `shutdown_timeout` | `integer` | No | When a cron is canceled, this represents the number of seconds after which a `SIGKILL` signal is sent to the process to force terminate it. The default is `10` seconds. | +| `timeout` | `integer` | No | The maximum amount of time a cron can run before it's terminated. Defaults to the maximum allowed value of `86400` seconds (24 hours). | -Note that you can [cancel pending or running crons](../environments/cancel-activity.md). +Note that you can [cancel pending or running crons](/environments/cancel-activity.md). ### Cron commands -| Name | Type | Required | Description | -| ------------------ | --------- | -------- | ----------- | -| `start` | `string` | Yes | The command that's run. It's run in [Dash](https://en.wikipedia.org/wiki/Almquist_shell). | -| `stop` | `string` | No | The command that's issued to give the cron command a chance to shutdown gracefully, such as to finish an active item in a list of tasks. Issued when a cron task is interrupted by a user through the CLI or Console. If not specified, a `SIGTERM` signal is sent to the process. | +| Name | Type | Required | Description | +|---------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `start` | `string` | Yes | The command that's run. It's run in [Dash](https://en.wikipedia.org/wiki/Almquist_shell). | +| `stop` | `string` | No | The command that's issued to give the cron command a chance to shutdown gracefully, such as to finish an active item in a list of tasks. Issued when a cron task is interrupted by a user through the CLI or Console. If not specified, a `SIGTERM` signal is sent to the process. | ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'nodejs:{{% latest "nodejs" %}}' - crons: - mycommand: - spec: 'H * * * *' - commands: - start: sleep 60 && echo sleep-60-finished && date - stop: killall sleep - shutdown_timeout: 18 + myapp: + source: + root: "/" + type: 'nodejs:{{% latest "nodejs" %}}' + crons: + mycommand: + spec: 'H * * * *' + commands: + start: sleep 60 && echo sleep-60-finished && date + stop: killall sleep + shutdown_timeout: 18 ``` + In this example configuration, the [cron specification](#crons) uses the `H` syntax. ### Example cron jobs @@ -897,18 +948,18 @@ title=Drupal {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Run Drupal's cron tasks every 19 minutes. - drupal: - spec: '*/19 * * * *' - commands: - start: 'cd web ; drush core-cron' - # But also run pending queue tasks every 7 minutes. - # Use an odd number to avoid running at the same time as the `drupal` cron. - drush-queue: - spec: '*/7 * * * *' - commands: - start: 'cd web ; drush queue-run aggregator_feeds' -{{< /snippet >}} + # Run Drupal's cron tasks every 19 minutes. + drupal: + spec: '*/19 * * * *' + commands: + start: 'cd web ; drush core-cron' + # But also run pending queue tasks every 7 minutes. + # Use an odd number to avoid running at the same time as the `drupal` cron. + drush-queue: + spec: '*/7 * * * *' + commands: + start: 'cd web ; drush queue-run aggregator_feeds' + {{< /snippet >}} ``` <---> @@ -921,12 +972,12 @@ title=Ruby on Rails {{< snippet name="myapp" config="app" root="/" >}} type: 'ruby:{{% latest "ruby" %}}' crons: - # Execute a rake script every 19 minutes. - ruby: - spec: '*/19 * * * *' - commands: - start: 'bundle exec rake some:task' -{{< /snippet >}} + # Execute a rake script every 19 minutes. + ruby: + spec: '*/19 * * * *' + commands: + start: 'bundle exec rake some:task' + {{< /snippet >}} ``` <---> @@ -939,11 +990,11 @@ title=Laravel {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Run Laravel's scheduler every 5 minutes. - scheduler: - spec: '*/5 * * * *' - cmd: 'php artisan schedule:run' -{{< /snippet >}} + # Run Laravel's scheduler every 5 minutes. + scheduler: + spec: '*/5 * * * *' + cmd: 'php artisan schedule:run' + {{< /snippet >}} ``` <---> @@ -956,15 +1007,15 @@ title=Symfony {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Take a backup of the environment every day at 5:00 AM. - snapshot: - spec: 0 5 * * * - cmd: | - # Only run for the production environment, aka main branch - if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then - croncape symfony ... - fi -{{< /snippet >}} + # Take a backup of the environment every day at 5:00 AM. + snapshot: + spec: 0 5 * * * + cmd: | + # Only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi + {{< /snippet >}} ``` {{< /codetabs >}} @@ -978,20 +1029,21 @@ To do so, use a configuration similar to the following: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:{{% latest "php" %}}' - crons: - update: - spec: '0 0 * * *' - commands: - start: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - {{% vendor/cli %}} backup:create --yes --no-wait - {{% vendor/cli %}} source-operation:run update --no-wait --yes - fi + myapp: + source: + root: "/" + type: 'php:{{% latest "php" %}}' + crons: + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi ``` + ### Cron job timing The minimum time between cron jobs being triggered is 5 minutes. @@ -1058,80 +1110,89 @@ Run the following command: The following table presents the various possible modifications to your PHP or Lisp runtime: -| Name | Type | Language | Description | -| --------------------------- | ---------------------------------------------------------- | -------- | ----------- | -| `extensions` | List of `string`s OR [extensions definitions](#extensions) | PHP | [PHP extensions](../languages/php/extensions.md) to enable. | -| `disabled_extensions` | List of `string`s | PHP | [PHP extensions](../languages/php/extensions.md) to disable. | +| Name | Type | Language | Description | +|-----------------------------|------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------| +| `extensions` | List of `string`s OR [extensions definitions](#extensions) | PHP | [PHP extensions](/languages/php/extensions.md) to enable. | +| `disabled_extensions` | List of `string`s | PHP | [PHP extensions](/languages/php/extensions.md) to disable. | | `request_terminate_timeout` | `integer` | PHP | The timeout for serving a single request after which the PHP-FPM worker process is killed. | -| `sizing_hints` | A [sizing hints definition](#sizing-hints) | PHP | The assumptions for setting the number of workers in your PHP-FPM runtime. | -| `xdebug` | An Xdebug definition | PHP | The setting to turn on [Xdebug](../languages/php/xdebug.md). | -| `quicklisp` | Distribution definitions | Lisp | [Distributions for QuickLisp](../languages/lisp.md#quicklisp-options) to use. | +| `sizing_hints` | A [sizing hints definition](#sizing-hints) | PHP | The assumptions for setting the number of workers in your PHP-FPM runtime. | +| `xdebug` | An Xdebug definition | PHP | The setting to turn on [Xdebug](/languages/php/xdebug.md). | +| `quicklisp` | Distribution definitions | Lisp | [Distributions for QuickLisp](/languages/lisp.md#quicklisp-options) to use. | -You can also set your [app's runtime timezone](../create-apps/timezone.md). +You can also set your [app's runtime timezone](/create-apps/timezone.md). ### Extensions -You can enable [PHP extensions](../languages/php/extensions.md) just with a list of extensions: +{{% note theme="info" %}} +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +If you've reached this section from another page and are using the composable image, enabling/disabling extensions should be placed under the `stack` key instead of what is listed below. +See [how to configure extensions with the composable image](/create-apps/app-reference/composable-image#top-level-properties). +{{% /note %}} + +You can enable [PHP extensions](/languages/php/extensions.md) just with a list of extensions: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:{{% latest "php" %}}' - runtime: - extensions: - - geoip - - tidy + myapp: + source: + root: "/" + type: 'php:{{% latest "php" %}}' + runtime: + extensions: + - geoip + - tidy ``` + Alternatively, if you need to include configuration options, use a dictionary for that extension: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:{{% latest "php" %}}' - runtime: - extensions: - - geoip - - name: blackfire - configuration: - server_id: foo - server_token: bar + myapp: + source: + root: "/" + type: 'php:{{% latest "php" %}}' + runtime: + extensions: + - geoip + - name: blackfire + configuration: + server_id: foo + server_token: bar ``` + In this case, the `name` property is required. ### Sizing hints The following table shows the properties that can be set in `sizing_hints`: -| Name | Type | Default | Minimum | Description | -| ----------------- | --------- | ------- | ------- | ----------- | +| Name | Type | Default | Minimum | Description | +|-------------------|-----------|---------|---------|------------------------------------------------| | `request_memory` | `integer` | 45 | 10 | The average memory consumed per request in MB. | -| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | +| `reserved_memory` | `integer` | 70 | 70 | The amount of memory reserved in MB. | -See more about [PHP-FPM workers and sizing](../languages/php/fpm.md). +See more about [PHP-FPM workers and sizing](/languages/php/fpm.md). ## Source The following table shows the properties that can be set in `source`: - -| Name | Type | Required | Description | -| ------------ | ------------------------ | -------- | ----------- | -| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](./source-operations.md) | -| `root` | `string` | | The path where the app code lives. Defaults to the root project directory. Useful for [multi-app setups](./multi-app/_index.md). | +| Name | Type | Required | Description | +|--------------|--------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------| +| `operations` | An operations dictionary | | Operations that can be applied to the source code. See [source operations](../source-operations.md) | +| `root` | `string` | | The path where the app code lives. Defaults to the root project directory. Useful for [multi-app setups](../multi-app/_index.md). | ## Container profile -By default, Upsun allocates a container profile to each app and service depending on the range of resources it’s expected to need. +By default, {{% vendor/name %}} allocates a container profile to each app and service depending on the range of resources it’s +expected to need. -Each container profile gives you access to a specific list of CPU and RAM combinations. -Using the Upsun CLI or Console, you can then pick a CPU and RAM combination for each of your apps and services. +Each container profile gives you access to a specific list of CPU and RAM combinations. +Using the {{% vendor/name %}} CLI or Console, you can then pick a CPU and RAM combination for each of your apps and services. - [Container profile types and resources](/manage-resources/adjust-resources#advanced-container-profiles) -- [Default container profiles](/manage-resources/adjust-resources#default-container-profiles) for runtime and service containers +- [Default container profiles](/manage-resources/adjust-resources#default-container-profiles) for runtime and service + containers - [Customize resources using the `container_profile` key](/manage-resources/adjust-resources#adjust-a-container-profile) ## Additional hosts @@ -1145,13 +1206,13 @@ So in the following example, if your app tries to access `api.example.com`, it's ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:{{% latest "php" %}}' - additional_hosts: - api.example.com: "192.0.2.23" - web.example.com: "203.0.113.42" + myapp: + source: + root: "/" + type: 'php:{{% latest "php" %}}' + additional_hosts: + api.example.com: "192.0.2.23" + web.example.com: "203.0.113.42" ``` This is equivalent to adding the mapping to the `/etc/hosts` file for the container. diff --git a/sites/friday/src/create-apps/hooks/_index.md b/sites/upsun/src/create-apps/hooks/_index.md similarity index 97% rename from sites/friday/src/create-apps/hooks/_index.md rename to sites/upsun/src/create-apps/hooks/_index.md index aafb361b38..bb5b60b6ed 100644 --- a/sites/friday/src/create-apps/hooks/_index.md +++ b/sites/upsun/src/create-apps/hooks/_index.md @@ -29,7 +29,7 @@ In this case, the app has two sets of dependencies: Create your `build` hook to install them all: -1. Create a `build` hook in your [app configuration](../app-reference.md): +1. Create a `build` hook in your [app configuration](/create-apps/app-reference/single-runtime-image.md): ```yaml {configfile="app"} applications: @@ -90,7 +90,7 @@ All of this configuration and preparation can be handled in a bash script. Note that hooks are executed using the dash shell, not the bash shell used by SSH logins. 2. Copy the [Drush configuration script from the template](https://github.com/platformsh-templates/nextjs-drupal/blob/master/api/drush/platformsh_generate_drush_yml.php) into a `drush/platformsh_generate_drush_yml.php` file. -3. Set a [mount](../app-reference.md#mounts). +3. Set a [mount](/create-apps/app-reference/single-runtime-image.md#mounts). Unlike in the `build` hook, in the `deploy` hook the system is generally read-only. So create a mount where you can write the Drush configuration: @@ -156,7 +156,7 @@ So you don't have to rebuild Drupal but you still get fresh content. api: 'api:http' ``` -2. Set [mounts](../app-reference.md#mounts). +2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). Like the [`deploy` hook](#configure-drush-and-drupal), the `post_deploy` hook has a read-only file system. Create mounts for your Next.js files: diff --git a/sites/friday/src/create-apps/hooks/hooks-and-dependencies.md b/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md similarity index 93% rename from sites/friday/src/create-apps/hooks/hooks-and-dependencies.md rename to sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md index caee7ba45c..4e6189298d 100644 --- a/sites/friday/src/create-apps/hooks/hooks-and-dependencies.md +++ b/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md @@ -5,7 +5,7 @@ description: Manage dependencies for your hooks, such as compiling Sass files as If you use a specific package in a hook, you may want to manage dependencies for it. For example, you may want to compile Sass files as part of your build process. -You can set dependencies along with hooks in your [app configuration](../app-reference.md#dependencies). +You can set dependencies along with hooks in your [app configuration](/create-apps/app-reference/single-runtime-image.md#dependencies). The following example assumes you have some Sass source files, such as a `index.scss` file. You also need a script to compile the files, such as the following: diff --git a/sites/friday/src/create-apps/hooks/hooks-comparison.md b/sites/upsun/src/create-apps/hooks/hooks-comparison.md similarity index 90% rename from sites/friday/src/create-apps/hooks/hooks-comparison.md rename to sites/upsun/src/create-apps/hooks/hooks-comparison.md index 2abe6980c3..563e9e369a 100644 --- a/sites/friday/src/create-apps/hooks/hooks-comparison.md +++ b/sites/upsun/src/create-apps/hooks/hooks-comparison.md @@ -8,15 +8,15 @@ The following table presents the main differences among the three available hook | Hook name | Failures stop build | Variables available | Services available | Timeout | Run on `worker` instances | Writable directories | Blocks requests | Runs on all redeploys\* | | ------------- | ------------------- |-------------------- | ------------------ | ------- | ------------------------- | -------------------- | --------------- | --------------- | | `build` | Yes | Build variables | No | 1 hour | Yes | `$PLATFORM_APP_DIR`, `$PLATFORM_CACHE_DIR`, and `/tmp` | No | No | -| `deploy` | No | Runtime variables | Yes | None | No | [Mounts](../app-reference.md#mounts) | Yes | No | -| `post_deploy` | No | Runtime variables | Yes | None | No | [Mounts](../app-reference.md#mounts) | No | Yes | +| `deploy` | No | Runtime variables | Yes | None | No | [Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) | Yes | No | +| `post_deploy` | No | Runtime variables | Yes | None | No | [Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) | No | Yes | \* All of the hooks run with changes to the code or environment. This column indicates which hooks run on a redeploy without any code changes. ## Build hook -The `build` hook is run after any [build flavor](../app-reference.md#build). +The `build` hook is run after any [build flavor](/create-apps/app-reference/single-runtime-image.md#build). During this hook, no services (such as a database) or any persistent file mounts are available as the application hasn't yet been deployed. @@ -63,8 +63,8 @@ So if you accidentally add an unbroken loop, it gets cut off and you can continu ## Deploy hook The `deploy` hook is run after the app container has been started but before it has started accepting requests. -Note that the deploy hook only runs on [`web` instances](../app-reference.md#web), -not [`worker` instances](../app-reference.md#workers). +Note that the deploy hook only runs on [`web` instances](/create-apps/app-reference/single-runtime-image.md#web), +not [`worker` instances](/create-apps/app-reference/single-runtime-image.md#workers). You can access other services at this stage (such as MySQL, Solr, Redis). The disk where the application lives is read-only at this point. @@ -72,7 +72,7 @@ The disk where the application lives is read-only at this point. This hook should be used when something needs to run once when new code is deployed. It isn't run when a host is restarted (such as during region maintenance), so anything that needs to run each time an instance of an app starts (regardless of whether there's new code) -should go in the `pre_start` key in [your `web` configuration](../app-reference.md#web-commands). +should go in the `pre_start` key in [your `web` configuration](/create-apps/app-reference/single-runtime-image.md#web-commands). For example, clearing the cache. Be aware: The deploy hook blocks the site accepting new requests. diff --git a/sites/friday/src/create-apps/hooks/vary-hooks-by-environment.md b/sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md similarity index 100% rename from sites/friday/src/create-apps/hooks/vary-hooks-by-environment.md rename to sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md diff --git a/sites/friday/src/create-apps/multi-app/_index.md b/sites/upsun/src/create-apps/multi-app/_index.md similarity index 100% rename from sites/friday/src/create-apps/multi-app/_index.md rename to sites/upsun/src/create-apps/multi-app/_index.md diff --git a/sites/friday/src/create-apps/multi-app/project-structure.md b/sites/upsun/src/create-apps/multi-app/project-structure.md similarity index 99% rename from sites/friday/src/create-apps/multi-app/project-structure.md rename to sites/upsun/src/create-apps/multi-app/project-structure.md index 443bf37bfe..a5d064d09b 100644 --- a/sites/friday/src/create-apps/multi-app/project-structure.md +++ b/sites/upsun/src/create-apps/multi-app/project-structure.md @@ -297,7 +297,7 @@ make sure you [change the source root](#change-the-source-root-of-your-app) for ## Change the source root of your app When your app's code base and configuration file aren't located at the same directory level in your project repository, -you need to [define a root directory](../app-reference.md#root-directory) for your app. +you need to [define a root directory](/create-apps/app-reference/single-runtime-image.md#root-directory) for your app. To do so, add a new `source.root` property in your app configuration. diff --git a/sites/friday/src/create-apps/multi-app/relationships.md b/sites/upsun/src/create-apps/multi-app/relationships.md similarity index 100% rename from sites/friday/src/create-apps/multi-app/relationships.md rename to sites/upsun/src/create-apps/multi-app/relationships.md diff --git a/sites/friday/src/create-apps/multi-app/routes.md b/sites/upsun/src/create-apps/multi-app/routes.md similarity index 98% rename from sites/friday/src/create-apps/multi-app/routes.md rename to sites/upsun/src/create-apps/multi-app/routes.md index 92f8e78221..5458a1a7c3 100644 --- a/sites/friday/src/create-apps/multi-app/routes.md +++ b/sites/upsun/src/create-apps/multi-app/routes.md @@ -44,7 +44,7 @@ You don't need to define a route for each app in the repository. If an app isn't specified, then it isn't accessible to the web. One good example of defining an app with no route is when you [use Git submodules](/create-apps/multi-app/project-structure.html#split-your-code-source-into-multiple-git-submodule-repositories) and want to [use a source operation to update your submodules](/development/submodules.html#update-submodules). -You can also achieve the same thing by defining the app as a [`worker`](../app-reference.md#workers). +You can also achieve the same thing by defining the app as a [`worker`](/create-apps/app-reference/single-runtime-image.md#workers). {{< /note >}} diff --git a/sites/friday/src/create-apps/runtime-operations.md b/sites/upsun/src/create-apps/runtime-operations.md similarity index 96% rename from sites/friday/src/create-apps/runtime-operations.md rename to sites/upsun/src/create-apps/runtime-operations.md index d8c52c652e..a10370b44c 100644 --- a/sites/friday/src/create-apps/runtime-operations.md +++ b/sites/upsun/src/create-apps/runtime-operations.md @@ -5,8 +5,8 @@ weight: 6 --- Runtime operations allow you to trigger one-off commands or scripts on your project. -Similar to [crons](../create-apps/app-reference.md#crons), they run in the app container but not on a specific schedule. -You can [define runtime operations](#define-a-runtime-operation) in your [app configuration](../create-apps/app-reference.md) +Similar to [crons](/create-apps/app-reference/single-runtime-image.md#crons), they run in the app container but not on a specific schedule. +You can [define runtime operations](#define-a-runtime-operation) in your [app configuration](/create-apps/app-reference/single-runtime-image.md) and [trigger them](#run-a-runtime-operation) at any time through the {{% vendor/name %}} CLI. For example, if you have a static website, @@ -112,7 +112,7 @@ but want to avoid going through the whole {{% vendor/name %}} [build and deploy The following examples assume that the frontend and backend containers are included in the same environment. This isn’t necessary for the commands to run successfully.
What _is_ necessary is that the build destination for your frontend **is writable at runtime** -(meaning, you must [define a mount](../create-apps/app-reference.md#mounts) for it). +(meaning, you must [define a mount](/create-apps/app-reference/single-runtime-image.md#mounts) for it). If you don’t want to include a build within a mount (especially if your data source **isn’t** on {{% vendor/name %}}), you can use [source operations](../create-apps/source-operations.md) to achieve a similar effect, but through generating a new commit. diff --git a/sites/friday/src/create-apps/source-operations.md b/sites/upsun/src/create-apps/source-operations.md similarity index 98% rename from sites/friday/src/create-apps/source-operations.md rename to sites/upsun/src/create-apps/source-operations.md index 5d238edfdc..8d8f4310e7 100644 --- a/sites/friday/src/create-apps/source-operations.md +++ b/sites/upsun/src/create-apps/source-operations.md @@ -21,7 +21,7 @@ or [revert to the last commit](#revert-to-the-last-commit) pushed to your Git re To run your source operations, you can use the [{{% vendor/name %}} CLI](../administration/cli/_index.md) or the [Console](https://console.platform.sh). If you want to run your source operations and update your code automatically, -you can also define [cron jobs](./app-reference.md#crons). +you can also define [cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). ## How source operations work @@ -50,7 +50,7 @@ When you trigger a source operation, the following happens in order: A source operation requires two things: - A name that must be unique within the application. - The name is the key of the block defined under `source.operations` in your [app configuration](./app-reference.md#source). + The name is the key of the block defined under `source.operations` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#source). - A `command` that defines what's run when the operation is triggered. diff --git a/sites/friday/src/create-apps/timezone.md b/sites/upsun/src/create-apps/timezone.md similarity index 95% rename from sites/friday/src/create-apps/timezone.md rename to sites/upsun/src/create-apps/timezone.md index 56a955a716..11d5906918 100644 --- a/sites/friday/src/create-apps/timezone.md +++ b/sites/upsun/src/create-apps/timezone.md @@ -79,4 +79,4 @@ title=Java ## Set a cron timezone You can set a specific timezone for your crons so they don't run in your app runtime timezone (or container timezone if no app runtime timezone is set on your project). -To do so, [set the `timezone` top-level property](../create-apps/app-reference.md#top-level-properties) in your app configuration. \ No newline at end of file +To do so, [set the `timezone` top-level property](/create-apps/app-reference/single-runtime-image.md#top-level-properties) in your app configuration. diff --git a/sites/friday/src/create-apps/troubleshoot-disks.md b/sites/upsun/src/create-apps/troubleshoot-disks.md similarity index 100% rename from sites/friday/src/create-apps/troubleshoot-disks.md rename to sites/upsun/src/create-apps/troubleshoot-disks.md diff --git a/sites/friday/src/create-apps/troubleshoot-mounts.md b/sites/upsun/src/create-apps/troubleshoot-mounts.md similarity index 96% rename from sites/friday/src/create-apps/troubleshoot-mounts.md rename to sites/upsun/src/create-apps/troubleshoot-mounts.md index e4df7a7f42..475b336a2c 100644 --- a/sites/friday/src/create-apps/troubleshoot-mounts.md +++ b/sites/upsun/src/create-apps/troubleshoot-mounts.md @@ -41,7 +41,7 @@ You can then put the mount back in place. ## Mounted files not publicly accessible If you've set up mounts to handle files like user uploads, you want to make sure the files are accessible. -Do so by managing their [location](./app-reference.md#locations). +Do so by managing their [location](/create-apps/app-reference/single-runtime-image.md#locations). This example defines two mounts, one named `private` and one `upload`: diff --git a/sites/friday/src/create-apps/web/_index.md b/sites/upsun/src/create-apps/web/_index.md similarity index 69% rename from sites/friday/src/create-apps/web/_index.md rename to sites/upsun/src/create-apps/web/_index.md index cd141d0a93..5ab2297090 100644 --- a/sites/friday/src/create-apps/web/_index.md +++ b/sites/upsun/src/create-apps/web/_index.md @@ -3,4 +3,4 @@ title: Configure what's served --- How you should configure your web server depends a lot on what you want to serve. -The following examples show how in specific scenarios you might define [your web server](../app-reference.md#web). +The following examples show how in specific scenarios you might define [your web server](/create-apps/app-reference/single-runtime-image.md#web). diff --git a/sites/friday/src/create-apps/web/custom-headers.md b/sites/upsun/src/create-apps/web/custom-headers.md similarity index 96% rename from sites/friday/src/create-apps/web/custom-headers.md rename to sites/upsun/src/create-apps/web/custom-headers.md index 69189edfac..dcfc1f582c 100644 --- a/sites/friday/src/create-apps/web/custom-headers.md +++ b/sites/upsun/src/create-apps/web/custom-headers.md @@ -5,7 +5,7 @@ description: Set custom headers for your static content such as custom content-t --- When your app responds to dynamic requests, it can generate headers on the fly. -To set headers for static content, add them in [your `web` configuration](../app-reference.md#web). +To set headers for static content, add them in [your `web` configuration](/create-apps/app-reference/single-runtime-image.md#web). You might want to do so to add custom content-type headers, limit what other sites can embed your content, or allow cross origin requests. @@ -35,7 +35,7 @@ applications: This sets the `X-Frame-Options` header to `SAMEORIGIN` for all static files. Now your files can only be embedded within your site. -Now set up an exception for MP3 files using a [rule](../app-reference.md#rules): +Now set up an exception for MP3 files using a [rule](/create-apps/app-reference/single-runtime-image.md#rules): ```yaml {configFile="app"} applications: diff --git a/sites/friday/src/create-apps/web/php-basic.md b/sites/upsun/src/create-apps/web/php-basic.md similarity index 98% rename from sites/friday/src/create-apps/web/php-basic.md rename to sites/upsun/src/create-apps/web/php-basic.md index dc1eaab563..f256bf0b94 100644 --- a/sites/friday/src/create-apps/web/php-basic.md +++ b/sites/upsun/src/create-apps/web/php-basic.md @@ -5,7 +5,7 @@ description: Start with a basic PHP app with a front controller for dynamic requ --- To handle dynamic requests to your PHP app, you might want to use a [front controller](https://en.wikipedia.org/wiki/Front_controller). -The following example shows how for such an app you might start defining [your web server](../app-reference.md#web). +The following example shows how for such an app you might start defining [your web server](/create-apps/app-reference/single-runtime-image.md#web). ## Define a document root diff --git a/sites/friday/src/create-apps/web/rewrite-requests.md b/sites/upsun/src/create-apps/web/rewrite-requests.md similarity index 94% rename from sites/friday/src/create-apps/web/rewrite-requests.md rename to sites/upsun/src/create-apps/web/rewrite-requests.md index 82adfa5de4..98c43cff30 100644 --- a/sites/friday/src/create-apps/web/rewrite-requests.md +++ b/sites/upsun/src/create-apps/web/rewrite-requests.md @@ -10,7 +10,7 @@ For example, you might want to make URLs seem semantic to users without having t In such a case, you might want requests to `/shoes/great-shoe/` to be served as if they were requests to `/?category=shoes&product=great-shoe`. -If so, add a [rule](../app-reference.md#rules) similar to the following: +If so, add a [rule](/create-apps/app-reference/single-runtime-image.md#rules) similar to the following: ```yaml {configFile="app"} applications: diff --git a/sites/friday/src/create-apps/web/serve-different-directories.md b/sites/upsun/src/create-apps/web/serve-different-directories.md similarity index 93% rename from sites/friday/src/create-apps/web/serve-different-directories.md rename to sites/upsun/src/create-apps/web/serve-different-directories.md index cd80579e74..e1e043fb0c 100644 --- a/sites/friday/src/create-apps/web/serve-different-directories.md +++ b/sites/upsun/src/create-apps/web/serve-different-directories.md @@ -23,7 +23,7 @@ And your build process might build the documentation with an output folder such If so, you can serve all requests by your app code except for those that start with `/docs`, which you serve with your generated docs. -Use a [`web` configuration](../app-reference.md#web) similar to the following: +Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#web) similar to the following: ```yaml {configfile="apps"} applications: diff --git a/sites/friday/src/create-apps/web/static.md b/sites/upsun/src/create-apps/web/static.md similarity index 92% rename from sites/friday/src/create-apps/web/static.md rename to sites/upsun/src/create-apps/web/static.md index b2fa71ec2e..47a3772349 100644 --- a/sites/friday/src/create-apps/web/static.md +++ b/sites/upsun/src/create-apps/web/static.md @@ -41,9 +41,9 @@ applications: ``` See more information on the required minimal settings: -- [Top-level properties](../app-reference.md#top-level-properties). -- [`web` property](../app-reference.md#web). -- [`locations` properties](../app-reference.md#locations). +- [Top-level properties](/create-apps/app-reference/single-runtime-image.md#top-level-properties). +- [`web` property](/create-apps/app-reference/single-runtime-image.md#web). +- [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). ## Add more features @@ -70,7 +70,7 @@ applications: allow: true ``` -See more information on [`locations` properties](../app-reference.md#locations). +See more information on [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). ### Create cache rules diff --git a/sites/friday/src/create-apps/workers.md b/sites/upsun/src/create-apps/workers.md similarity index 66% rename from sites/friday/src/create-apps/workers.md rename to sites/upsun/src/create-apps/workers.md index d317745628..edd4fc2f7f 100644 --- a/sites/friday/src/create-apps/workers.md +++ b/sites/upsun/src/create-apps/workers.md @@ -5,7 +5,7 @@ description: Interact with your worker instances to handle background tasks for Workers are instances of your code that aren't open to connections from other apps or services or the outside world. They're good for handling background tasks. -See how to [configure a worker](./app-reference.md#workers) for your app. +See how to [configure a worker](/create-apps/app-reference/single-runtime-image.md#workers) for your app. ## Access the worker container @@ -70,13 +70,13 @@ The `start` key specifies the command to use to launch your worker application. It may be any valid shell command, although most often it runs a command in your application in the language of your application. If the command specified by the `start` key terminates, it's restarted automatically. -Note that [`deploy` and `post_deploy` hooks](./hooks/_index.md) as well as [`cron` commands](./app-reference.md#crons) -run only on the [`web`](./app-reference.md#web) container, not on workers. +Note that [`deploy` and `post_deploy` hooks](./hooks/_index.md) as well as [`cron` commands](/create-apps/app-reference/single-runtime-image.md#crons) +run only on the [`web`](/create-apps/app-reference/single-runtime-image.md#web) container, not on workers. ## Inheritance -Any top-level definitions for [`relationships`](./app-reference.md#relationships), -[`access`](./app-reference.md#access), [`mount`](./app-reference.md#mounts), and [`variables`](./app-reference.md#variables) +Any top-level definitions for [`relationships`](/create-apps/app-reference/single-runtime-image.md#relationships), +[`access`](/create-apps/app-reference/single-runtime-image.md#access), [`mount`](/create-apps/app-reference/single-runtime-image.md#mounts), and [`variables`](/create-apps/app-reference/single-runtime-image.md#variables) are inherited by every worker, unless overridden explicitly. Likewise [resources defined for the application container](/manage-resources/_index.md) are inherited by every worker, unless overridden explicitly. @@ -86,61 +86,59 @@ That means, for example, that the following two `{{< vendor/configfile "app" >}} ```yaml {configFile="app"} applications: app: #The name of the app, which must be unique within the project. - type: python:{{% latest "python" %}} - mounts: - test: - source: storage - source_path: test - relationships: - database: 'mysqldb:mysql' - workers: - queue: - commands: - start: | - python queue-worker.py - mail: - commands: - start: | - python mail-worker.py -services: - mysqldb: + type: python:{{% latest "python" %}} + mounts: + test: + source: storage + source_path: test + relationships: + mysql: + workers: + queue: + commands: + start: | + python queue-worker.py + mail: + commands: + start: | + python mail-worker.py + services: + mysql: type: mariadb:{{% latest "mariadb" %}} ``` ```yaml {configFile="app"} applications: app: #The name of the app, which must be unique within the project. - type: python:{{% latest "python" %}} - workers: - queue: - commands: - start: | - python queue-worker.py - mounts: - test: - source: storage - source_path: test - relationships: - database: 'mysqldb:mysql' - mail: - commands: - start: | - python mail-worker.py - mounts: - test: - source: storage - source_path: test - relationships: - database: 'mysqldb:mysql' + type: python:{{% latest "python" %}} + workers: + queue: + commands: + start: | + python queue-worker.py + mounts: + test: + source: storage + source_path: test + mysql: + mail: + commands: + start: | + python mail-worker.py + mounts: + test: + source: storage + source_path: test + mysql: services: - mysqldb: + mysql: type: mariadb:{{% latest "mariadb" %}} ``` In both cases, there are two worker instances named `queue` and `mail`. Both have access to a MySQL/MariaDB service defined in `{{< vendor/configfile "services" >}}`, -through a [relationship](/create-apps/app-reference.md#relationships) that is identical to the _name_ of that service (`mysql`). -Both also have their own separate [`storage` mount](/create-apps/app-reference.md#mounts). +through a [relationship](/create-apps/app-reference/single-runtime-image.md#relationships) that is identical to the _name_ of that service (`mysql`). +Both also have their own separate [`storage` mount](/create-apps/app-reference/single-runtime-image.md#mounts). ## Customizing a worker @@ -154,62 +152,62 @@ For example, consider the following configuration: ```yaml {configFile="app"} applications: app: #The name of the app, which must be unique within the project. - type: "python:{{% latest "python" %}}" - hooks: - build: | - pip install -r requirements.txt - pip install -e . - pip install gunicorn - relationships: - database: 'mysqldb:mysql' - messages: 'rabbitqueue:rabbitmq' - variables: - env: - type: 'none' - web: - commands: - start: "gunicorn -b $PORT project.wsgi:application" + type: "python:{{% latest "python" %}}" + hooks: + build: | + pip install -r requirements.txt + pip install -e . + pip install gunicorn + relationships: + mysql: + rabbitmq: variables: env: - type: 'web' - mounts: - uploads: - source: storage - source_path: uploads - locations: - "/": - root: "" - passthru: true - allow: false - "/static": - root: "static/" - allow: true - workers: - queue: + type: 'none' + web: commands: - start: | - python queue-worker.py + start: "gunicorn -b $PORT project.wsgi:application" variables: env: - type: 'worker' + type: 'web' mounts: - scratch: + uploads: source: storage - source_path: scratch - mail: - commands: - start: | - python mail-worker.py - variables: - env: - type: 'worker' - mounts: {} - relationships: - emails: 'rabbitqueue:rabbitmq' + source_path: uploads + locations: + "/": + root: "" + passthru: true + allow: false + "/static": + root: "static/" + allow: true + workers: + queue: + commands: + start: | + python queue-worker.py + variables: + env: + type: 'worker' + mounts: + scratch: + source: storage + source_path: scratch + mail: + commands: + start: | + python mail-worker.py + variables: + env: + type: 'worker' + mounts: {} + relationships: + rabbitmq: services: - mysqldb: + mysql: type: 'mariadb:{{% latest "mariadb" %}}' - rabbitqueue: + rabbitmq: type: 'rabbitmq:{{% latest "rabbitmq" %}}' ``` @@ -261,10 +259,10 @@ and, if appropriate, adjust its behavior accordingly. ## Mounts -When defining a [worker](../create-apps/app-reference.md#workers) instance, +When defining a [worker](../create-apps/app-reference/single-runtime-image.md#workers) instance, keep in mind what mount behavior you want. -`tmp` local mounts are a separate storage area for each instance, +`tmp` and `instance` local mounts are a separate storage area for each instance, while `storage` mounts can be shared between instances. For example, you can define a `storage` mount (called `shared_dir`) to be used by a `web` instance, @@ -273,38 +271,38 @@ and a `tmp` mount (called `local_dir`) to be used by a `queue` worker instance: ```yaml {configFile="app"} applications: app: #The name of the app, which must be unique within the project. - type: "nodejs:{{% latest "nodejs" %}}" - - # Define a web instance - web: - locations: - "/": - root: "public" - passthru: true - index: ['index.html'] - - mounts: - # Define a storage mount that's available to both instances together - 'shared_dir': - source: storage - service: files - source_path: our_stuff - - # Define a local mount that's available to each instance separately - 'local_dir': - source: tmp - source_path: my_stuff - - # Define a worker instance from the same code but with a different start - workers: - queue: - commands: - start: ./start.sh + type: "nodejs:{{% latest "nodejs" %}}" + + # Define a web instance + web: + locations: + "/": + root: "public" + passthru: true + index: ['index.html'] + + mounts: + # Define a storage mount that's available to both instances together + 'shared_dir': + source: storage + service: files + source_path: our_stuff + + # Define a local mount that's available to each instance separately + 'local_dir': + source: tmp + source_path: my_stuff + + # Define a worker instance from the same code but with a different start + workers: + queue: + commands: + start: ./start.sh ``` Both the `web` instance and `queue` worker have their own, dedicated `local_dir` mount. Note that: -- Each `local_dir` mount is a [`tmp` mount](/create-apps/app-reference.md#mounts) with a **maximum allocation of 8 GB**.
+- Each `local_dir` mount is a [`tmp` mount](/create-apps/app-reference/single-runtime-image.md#mounts) with a **maximum allocation of 8 GB**.
- `tmp` mounts **may be removed** during infrastructure maintenance operations. Both the `web` instance and `queue` worker also have a `shared_dir` mount pointing to the same network storage space. diff --git a/sites/friday/src/define-routes/_index.md b/sites/upsun/src/define-routes/_index.md similarity index 99% rename from sites/friday/src/define-routes/_index.md rename to sites/upsun/src/define-routes/_index.md index a24b0de037..5911487528 100644 --- a/sites/friday/src/define-routes/_index.md +++ b/sites/upsun/src/define-routes/_index.md @@ -200,7 +200,7 @@ routes: "https://{default}/": type: upstream upstream: "app1:http" - + "https://{all}/": type: upstream upstream: "app2:http" @@ -421,10 +421,10 @@ routes: type: upstream upstream: "app:http" cache: - enabled: false + enabled: false ``` -2. [Disable request buffering](../create-apps/app-reference.md#locations) in your app configuration. +2. [Disable request buffering](/create-apps/app-reference/single-runtime-image.md#locations) in your app configuration. ```yaml {configFile="app"} web: diff --git a/sites/friday/src/define-routes/cache.md b/sites/upsun/src/define-routes/cache.md similarity index 98% rename from sites/friday/src/define-routes/cache.md rename to sites/upsun/src/define-routes/cache.md index 516a92af5c..7bbb81be87 100644 --- a/sites/friday/src/define-routes/cache.md +++ b/sites/upsun/src/define-routes/cache.md @@ -205,7 +205,7 @@ The cache duration is decided based on the `Cache-Control` response header value The `default_ttl` only applies to **non-static responses**, that is, those generated by your application. -To set a cache lifetime for static resources configure that in your [app configuration](../create-apps/app-reference.md#locations). +To set a cache lifetime for static resources configure that in your [app configuration](/create-apps/app-reference/single-runtime-image.md#locations). All static assets have a Cache-Control header with a max age defaulting to 0 (which is the default for `expires`). {{< note title="none">}} @@ -283,4 +283,4 @@ Set the Vary header to `X-Forwarded-Proto` [custom request header](/development/ ### Cache zipped content separately -Use `Vary: Accept-Encoding` to serve different content depending on the encoding. Useful for ensuring that gzipped content isn't served to clients that can't read it. \ No newline at end of file +Use `Vary: Accept-Encoding` to serve different content depending on the encoding. Useful for ensuring that gzipped content isn't served to clients that can't read it. diff --git a/sites/friday/src/define-routes/https.md b/sites/upsun/src/define-routes/https.md similarity index 100% rename from sites/friday/src/define-routes/https.md rename to sites/upsun/src/define-routes/https.md diff --git a/sites/friday/src/define-routes/proxy.md b/sites/upsun/src/define-routes/proxy.md similarity index 100% rename from sites/friday/src/define-routes/proxy.md rename to sites/upsun/src/define-routes/proxy.md diff --git a/sites/friday/src/define-routes/redirects.md b/sites/upsun/src/define-routes/redirects.md similarity index 100% rename from sites/friday/src/define-routes/redirects.md rename to sites/upsun/src/define-routes/redirects.md diff --git a/sites/friday/src/define-routes/ssi.md b/sites/upsun/src/define-routes/ssi.md similarity index 100% rename from sites/friday/src/define-routes/ssi.md rename to sites/upsun/src/define-routes/ssi.md diff --git a/sites/friday/src/development/_index.md b/sites/upsun/src/development/_index.md similarity index 100% rename from sites/friday/src/development/_index.md rename to sites/upsun/src/development/_index.md diff --git a/sites/friday/src/development/access-site.md b/sites/upsun/src/development/access-site.md similarity index 100% rename from sites/friday/src/development/access-site.md rename to sites/upsun/src/development/access-site.md diff --git a/sites/friday/src/development/email.md b/sites/upsun/src/development/email.md similarity index 100% rename from sites/friday/src/development/email.md rename to sites/upsun/src/development/email.md diff --git a/sites/friday/src/development/file-transfer.md b/sites/upsun/src/development/file-transfer.md similarity index 92% rename from sites/friday/src/development/file-transfer.md rename to sites/upsun/src/development/file-transfer.md index d701966cad..f17f90343b 100644 --- a/sites/friday/src/development/file-transfer.md +++ b/sites/upsun/src/development/file-transfer.md @@ -17,7 +17,7 @@ This means that the only way you can edit your app's code is through Git. However, you can transfer files to and from your built app without using Git. To do so, you need to configure mounts or use an SSH client. -[Mounts](../create-apps/app-reference.md#mounts) let you set up directories that remain writable after the build is complete. +[Mounts](/create-apps/app-reference/single-runtime-image.md#mounts) let you set up directories that remain writable after the build is complete. You can then transfer files directly to and from mounts inside your app with a single command via the [{{% vendor/name %}} CLI](../administration/cli/_index.md). @@ -112,7 +112,7 @@ Another way to transfer files to and from your built app is to use an SSH client You can use `scp` to copy files to and from a remote environment. For example, to download a `diagram.png` file from the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)), +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)), run the following command: ```bash @@ -183,7 +183,7 @@ The `sftp` connection is open once the `sftp>` prompt is displayed in your termi #### Download a file Say you want to download a `diagram.png` file from the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)). +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)). To do so, run the following command: ``` @@ -195,7 +195,7 @@ The `diagram.png` file is copied to the current local directory. #### Upload a file Say you want to upload a `diagram.png` file to the `web/uploads` directory -(relative to the [app root](../create-apps/app-reference.md#root-directory)). +(relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory)). To do so, run the following command: ```bash diff --git a/sites/friday/src/development/headers.md b/sites/upsun/src/development/headers.md similarity index 100% rename from sites/friday/src/development/headers.md rename to sites/upsun/src/development/headers.md diff --git a/sites/friday/src/development/local/_index.md b/sites/upsun/src/development/local/_index.md similarity index 100% rename from sites/friday/src/development/local/_index.md rename to sites/upsun/src/development/local/_index.md diff --git a/sites/friday/src/development/local/ddev.md b/sites/upsun/src/development/local/ddev.md similarity index 100% rename from sites/friday/src/development/local/ddev.md rename to sites/upsun/src/development/local/ddev.md diff --git a/sites/friday/src/development/local/tethered.md b/sites/upsun/src/development/local/tethered.md similarity index 100% rename from sites/friday/src/development/local/tethered.md rename to sites/upsun/src/development/local/tethered.md diff --git a/sites/friday/src/development/local/untethered.md b/sites/upsun/src/development/local/untethered.md similarity index 100% rename from sites/friday/src/development/local/untethered.md rename to sites/upsun/src/development/local/untethered.md diff --git a/sites/friday/src/development/private-repository.md b/sites/upsun/src/development/private-repository.md similarity index 100% rename from sites/friday/src/development/private-repository.md rename to sites/upsun/src/development/private-repository.md diff --git a/sites/friday/src/development/regions.md b/sites/upsun/src/development/regions.md similarity index 84% rename from sites/friday/src/development/regions.md rename to sites/upsun/src/development/regions.md index 906bcf3bb1..b613f0e35b 100644 --- a/sites/friday/src/development/regions.md +++ b/sites/upsun/src/development/regions.md @@ -29,6 +29,23 @@ For example, to get a list of the regions and their carbon intensities, run the See all available information in the [API documentation](https://api.platform.sh/docs/#tag/Regions). +### Greener Region Discount + +You can get a 3% discount on your resource usage if you host your project in one of Upsun's eco-friendly regions: + +- Quebec, Canada (`ca-central-1`), +- Stockholm, Sweden (`eu-north-1`), +- Paris, France (`francecentral`), +- OVH (`gra7`), +- Quincy, Washington (`westus2`), +- Zurich, Switzerland (`europe-west6`). + +The 3% discount covers application CPU, application memory, service CPU, service memory, and build resources. +It **doesn’t** apply to the project fee or other billing aspects. +It can be combined with other offers or discounts. + +See [more information on the greener region discount](https://platform.sh/company/press/a-first-for-cloud-industry-platformsh-greener-region-discount/). + ## Region availability The regions listed here may be different from those available to you when you create a new project. diff --git a/sites/friday/src/development/sanitize-db/_index.md b/sites/upsun/src/development/sanitize-db/_index.md similarity index 100% rename from sites/friday/src/development/sanitize-db/_index.md rename to sites/upsun/src/development/sanitize-db/_index.md diff --git a/sites/friday/src/development/sanitize-db/mariadb.md b/sites/upsun/src/development/sanitize-db/mariadb.md similarity index 100% rename from sites/friday/src/development/sanitize-db/mariadb.md rename to sites/upsun/src/development/sanitize-db/mariadb.md diff --git a/sites/friday/src/development/sanitize-db/postgresql-symfony.md b/sites/upsun/src/development/sanitize-db/postgresql-symfony.md similarity index 100% rename from sites/friday/src/development/sanitize-db/postgresql-symfony.md rename to sites/upsun/src/development/sanitize-db/postgresql-symfony.md diff --git a/sites/friday/src/development/sanitize-db/postgresql.md b/sites/upsun/src/development/sanitize-db/postgresql.md similarity index 98% rename from sites/friday/src/development/sanitize-db/postgresql.md rename to sites/upsun/src/development/sanitize-db/postgresql.md index 0185e08db7..a556e2cc67 100644 --- a/sites/friday/src/development/sanitize-db/postgresql.md +++ b/sites/upsun/src/development/sanitize-db/postgresql.md @@ -64,7 +64,7 @@ Set up a script by following these steps: ``` To sanitize only on the initial deploy and not all future deploys, - on sanitization create a file on a [mount](/create-apps/app-reference.md#mounts). + on sanitization create a file on a [mount](/create-apps/app-reference/single-runtime-image.md#mounts). Then add a check for the file as in the following example: ```bash {location="sanitize.sh"} diff --git a/sites/friday/src/development/ssh/_index.md b/sites/upsun/src/development/ssh/_index.md similarity index 98% rename from sites/friday/src/development/ssh/_index.md rename to sites/upsun/src/development/ssh/_index.md index 214adf7da2..f700f8de20 100644 --- a/sites/friday/src/development/ssh/_index.md +++ b/sites/upsun/src/development/ssh/_index.md @@ -3,7 +3,7 @@ title: Connect securely with SSH weight: 12 description: Keep your project and apps safe by connecting with SSH when you're interacting with your deployed environments or using the {{% vendor/name %}} CLI. layout: single -keywords: +keywords: - 2fa - twofactor - two factor @@ -60,7 +60,7 @@ Once you've connected, you get a welcome message detailing which environment you Now you can interact with the environment as you want. Note that your app's file system is read-only, -except for any [mounts you've defined](../../create-apps/app-reference.md#mounts). +except for any [mounts you've defined](/create-apps/app-reference/single-runtime-image.md#mounts). ## Connect to services diff --git a/sites/friday/src/development/ssh/ssh-keys.md b/sites/upsun/src/development/ssh/ssh-keys.md similarity index 100% rename from sites/friday/src/development/ssh/ssh-keys.md rename to sites/upsun/src/development/ssh/ssh-keys.md diff --git a/sites/friday/src/development/ssh/troubleshoot-ssh.md b/sites/upsun/src/development/ssh/troubleshoot-ssh.md similarity index 100% rename from sites/friday/src/development/ssh/troubleshoot-ssh.md rename to sites/upsun/src/development/ssh/troubleshoot-ssh.md diff --git a/sites/friday/src/development/submodules.md b/sites/upsun/src/development/submodules.md similarity index 100% rename from sites/friday/src/development/submodules.md rename to sites/upsun/src/development/submodules.md diff --git a/sites/friday/src/development/troubleshoot.md b/sites/upsun/src/development/troubleshoot.md similarity index 96% rename from sites/friday/src/development/troubleshoot.md rename to sites/upsun/src/development/troubleshoot.md index 6ff80c5863..64788748b8 100644 --- a/sites/friday/src/development/troubleshoot.md +++ b/sites/upsun/src/development/troubleshoot.md @@ -111,7 +111,7 @@ it indicates your application is crashing or unavailable. Typical causes and potential solutions include: - Your app is listening at the wrong place. - - Check your app's [upstream properties](../create-apps/app-reference.md#upstream). + - Check your app's [upstream properties](/create-apps/app-reference/single-runtime-image.md#upstream). - If your app listening at a port, make sure it's using the [`PORT` environment variable](./variables/use-variables.md#use-provided-variables). - Your `{{< vendor/configfile "app" >}}` configuration has an error and a process isn't starting or requests can't be forwarded to it correctly. @@ -200,8 +200,8 @@ If you attempt to write to disk outside a `build` hook, you may encounter a `rea Except where you define it, the file system is all read-only, with code changes necessary through git. This gives you benefits like repeatable deployments, consistent backups, and traceability. -To generate anything you need later, [write to disk during a `build` hook](../create-apps/app-reference.md#writable-directories-during-build). -Or [declare mounts](../create-apps/app-reference.md#mounts), +To generate anything you need later, [write to disk during a `build` hook](/create-apps/app-reference/single-runtime-image.md#writable-directories-during-build). +Or [declare mounts](/create-apps/app-reference/single-runtime-image.md#mounts), which are writable even during and after deploy. They can be used for your data: file uploads, logs, and temporary files. @@ -232,7 +232,7 @@ To determine if your environment is being stuck in the build or the deployment, If the activity has the result `success`, the build has completed successfully and the system is trying to deploy. If the result is still `running`, the build is stuck. -In most regions, stuck builds terminate after one hour. +In most regions, stuck builds terminate after one hour. When a deployment is blocked, you should try the following: @@ -243,7 +243,7 @@ When a deployment is blocked, you should try the following: If a `sync` of `activate` process is stuck, try the above on the parent environment. -Note that, for PHP apps, +Note that, for PHP apps, you can [restart processes that get stuck during a build or deployment](../languages/php/troubleshoot.md#restart-php-processes-stuck-during-a-build-or-deployment) from your app container. @@ -277,7 +277,7 @@ strace -T {{< variable "YOUR_HOOK_COMMAND" >}} # Print a system call report ### Cron jobs -Containers can't be shutdown while long-running [cron jobs and scheduled tasks](../create-apps/app-reference.md#crons) are active. +Containers can't be shutdown while long-running [cron jobs and scheduled tasks](/create-apps/app-reference/single-runtime-image.md#crons) are active. That means long-running cron jobs block a container from being shut down to make way for a new deploy. Make sure your custom cron jobs run quickly and properly. @@ -297,7 +297,7 @@ and [cookie entry](../define-routes/cache.md#cookies). Because the router cache follows cache headers from your app, your app needs to send the correct `cache-control` header. -For static assets, set cache headers using the `expires` key in your [app configuration](../create-apps/app-reference.md#locations). +For static assets, set cache headers using the `expires` key in your [app configuration](/create-apps/app-reference/single-runtime-image.md#locations). ## Language-specific troubleshooting diff --git a/sites/friday/src/development/variables/_index.md b/sites/upsun/src/development/variables/_index.md similarity index 100% rename from sites/friday/src/development/variables/_index.md rename to sites/upsun/src/development/variables/_index.md diff --git a/sites/friday/src/development/variables/set-variables.md b/sites/upsun/src/development/variables/set-variables.md similarity index 97% rename from sites/friday/src/development/variables/set-variables.md rename to sites/upsun/src/development/variables/set-variables.md index aced375684..9551112f1c 100644 --- a/sites/friday/src/development/variables/set-variables.md +++ b/sites/upsun/src/development/variables/set-variables.md @@ -11,7 +11,7 @@ All of the variables can also be [overridden via script](#set-variables-via-scri ## Set variables in your app -Set variables [in code](../../create-apps/app-reference.md#variables) using the `{{< vendor/configfile "app" >}}` file. +Set variables [in code](/create-apps/app-reference/single-runtime-image.md#variables) using the `{{< vendor/configfile "app" >}}` file. These values are the same across all environments and present in the Git repository, which makes them a poor fit for API keys and other such secrets. @@ -179,7 +179,7 @@ value updates trigger a rebuild of the application in the same way that a commit ## Set variables via script -You can also provide a `.environment` file as in [your app root](../../create-apps/app-reference.md#root-directory). +You can also provide a `.environment` file as in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). This file runs as a script in dash when the container starts and on all SSH logins. It can be used to set any environment variables directly, such as the PATH variable. @@ -213,7 +213,7 @@ The following example looks for a `deploy/environment.tracker.txt` file. It displays a different message if it's found or not, which helps you track what variables are being set. ```bash {location=".environment"} -if [ -f "deploy/environment.tracker.txt" ]; then +if [ -f "deploy/environment.tracker.txt" ]; then echo "File found." export DEPLOY='Friday' else @@ -233,8 +233,8 @@ protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at .../rsync/compat.c(61) [receiver=2.6.9] -[ProcessFailedException] -The command failed with the exit code: 2 +[ProcessFailedException] +The command failed with the exit code: 2 ``` This failure comes because `mount:download` and `rsync` don't expect output when the SSH connection is made. diff --git a/sites/friday/src/development/variables/use-variables.md b/sites/upsun/src/development/variables/use-variables.md similarity index 98% rename from sites/friday/src/development/variables/use-variables.md rename to sites/upsun/src/development/variables/use-variables.md index 8d89e6b1ac..87e432cfb2 100644 --- a/sites/friday/src/development/variables/use-variables.md +++ b/sites/upsun/src/development/variables/use-variables.md @@ -167,7 +167,7 @@ public class App { ### Access complex values Variables can have nested structures. -The following example shows nested structures in an [app configuration](../../create-apps/app-reference.md#variables): +The following example shows nested structures in an [app configuration](/create-apps/app-reference/single-runtime-image.md#variables): {{% version/specific %}} @@ -365,8 +365,8 @@ and at runtime. | `{{< vendor/prefix >}}_SOURCE_DIR` | Yes | No | The path to the root directory of your code repository in the context of a running [source operation](../../create-apps/source-operations.md). The directory contains a writable copy of your repository that you can commit to during the operation. | | `{{< vendor/prefix >}}_TREE_ID` | Yes | Yes | The ID of the tree the application was built from, essentially the SHA hash of the tree in Git. Use when you need a unique ID for each build. | | `{{< vendor/prefix >}}_VARIABLES` | Some | Some | A base64-encoded JSON object with all user-defined project and environment variables that don't use a [prefix](./_index.md#variable-prefixes). The keys are the variable names and the values are the variable values. Availability during builds and at runtime depends on the settings for each variable. See how to [access individual variables](#access-variables-in-a-shell). | -| `PORT` | No | Yes | A `string` representing the port to which requests are sent if the [`web.upstream.socket_family` property](../../create-apps/app-reference.md#upstream) is unset or set to `tcp`. | -| `SOCKET` | No | Yes | A `string` representing the path to the Unix socket file to use if the [`web.upstream.socket_family` property](../../create-apps/app-reference.md#upstream) is set to `unix`. | +| `PORT` | No | Yes | A `string` representing the port to which requests are sent if the [`web.upstream.socket_family` property](/create-apps/app-reference/single-runtime-image.md#upstream) is unset or set to `tcp`. | +| `SOCKET` | No | Yes | A `string` representing the path to the Unix socket file to use if the [`web.upstream.socket_family` property](/create-apps/app-reference/single-runtime-image.md#upstream) is set to `unix`. | ### `PLATFORM_APPLICATION` @@ -410,7 +410,7 @@ The following example shows the process, though you have to modify it to fit you ```yaml {configFile="app"} applications: - {{< variable "APP_NAME" >}} + {{< variable "APP_NAME" >}} mounts: /config: source: storage diff --git a/sites/friday/src/domains/_index.md b/sites/upsun/src/domains/_index.md similarity index 100% rename from sites/friday/src/domains/_index.md rename to sites/upsun/src/domains/_index.md diff --git a/sites/friday/src/domains/cdn/_index.md b/sites/upsun/src/domains/cdn/_index.md similarity index 100% rename from sites/friday/src/domains/cdn/_index.md rename to sites/upsun/src/domains/cdn/_index.md diff --git a/sites/friday/src/domains/cdn/cloudflare.md b/sites/upsun/src/domains/cdn/cloudflare.md similarity index 100% rename from sites/friday/src/domains/cdn/cloudflare.md rename to sites/upsun/src/domains/cdn/cloudflare.md diff --git a/sites/friday/src/domains/cdn/fastly.md b/sites/upsun/src/domains/cdn/fastly.md similarity index 100% rename from sites/friday/src/domains/cdn/fastly.md rename to sites/upsun/src/domains/cdn/fastly.md diff --git a/sites/friday/src/domains/steps/_index.md b/sites/upsun/src/domains/steps/_index.md similarity index 100% rename from sites/friday/src/domains/steps/_index.md rename to sites/upsun/src/domains/steps/_index.md diff --git a/sites/friday/src/domains/steps/custom-domains-preview-environments.md b/sites/upsun/src/domains/steps/custom-domains-preview-environments.md similarity index 100% rename from sites/friday/src/domains/steps/custom-domains-preview-environments.md rename to sites/upsun/src/domains/steps/custom-domains-preview-environments.md diff --git a/sites/friday/src/domains/steps/dns.md b/sites/upsun/src/domains/steps/dns.md similarity index 100% rename from sites/friday/src/domains/steps/dns.md rename to sites/upsun/src/domains/steps/dns.md diff --git a/sites/friday/src/domains/steps/subdomains.md b/sites/upsun/src/domains/steps/subdomains.md similarity index 100% rename from sites/friday/src/domains/steps/subdomains.md rename to sites/upsun/src/domains/steps/subdomains.md diff --git a/sites/friday/src/domains/steps/tls.md b/sites/upsun/src/domains/steps/tls.md similarity index 100% rename from sites/friday/src/domains/steps/tls.md rename to sites/upsun/src/domains/steps/tls.md diff --git a/sites/friday/src/domains/troubleshoot.md b/sites/upsun/src/domains/troubleshoot.md similarity index 100% rename from sites/friday/src/domains/troubleshoot.md rename to sites/upsun/src/domains/troubleshoot.md diff --git a/sites/friday/src/environments/_index.md b/sites/upsun/src/environments/_index.md similarity index 100% rename from sites/friday/src/environments/_index.md rename to sites/upsun/src/environments/_index.md diff --git a/sites/friday/src/environments/backup.md b/sites/upsun/src/environments/backup.md similarity index 53% rename from sites/friday/src/environments/backup.md rename to sites/upsun/src/environments/backup.md index 53e607a738..d8cc0912f4 100644 --- a/sites/friday/src/environments/backup.md +++ b/sites/upsun/src/environments/backup.md @@ -23,7 +23,7 @@ first activate it. 1. As an [admin user](../administration/users.md), you can do a backup of your environment. This backup includes the complete data and code of the environment. All persistent data from all running [services](../add-services/_index.md) - and any files stored on [mounts](../create-apps/app-reference.md#mounts) are included. + and any files stored on [mounts](/create-apps/app-reference/single-runtime-image.md#mounts) are included. The backup is stored internally on {{% vendor/name %}}. That is, the backup can be applied to environments on {{% vendor/name %}}, but it can't be downloaded. If you need to download backups, instead [export your mount and service data](/learn/tutorials/exporting.md)). @@ -57,20 +57,123 @@ To avoid this downtime, use [live backups](#live-backups). For consistent backups, create the backups during non-peak hours for your site. -## Retention +## Data retention -For information on how long backups are retained, see the [data retention policy](../security/data-retention.md). +### Manual backups -## Use automated backups +[Manual backups](../environments/backup.md#create-a-manual-backup) are retained until you delete them or replace them with another backup. -{{< vendor/name >}} provides 1 automated backup a day for your production environment, -with a [2-day retention](/security/data-retention.md) (2 days worth of backups are retained at any given point). +You can configure the maximum number of manual backups. Once that number is reached, any new manual backup automatically replaces the oldest backup. + +### Automated backups -For more information on the backups {{< vendor/name >}} provides, -see the [{{< vendor/name >}} backup policy](/security/backups.md). +[Automated backups](#use-automated-backups) are retained for 2 days when you use the [default backup policy](#default-backup-policy) +(meaning, 2 days worth of backups are retained at any given point). + +When you [configure your own automated backup policy](#configure-a-backup-policy), +the retention time varies based on that configuration. Automated backups are always [live](#live-backups). +## Backup policy + +### Default backup policy + +By default, {{< vendor/name >}} provides 1 automated backup a day for your production environment, +with a [2-day retention](/security/data-retention.md) (2 days worth of backups are retained at any given point). + +You can [configure your own backup policy](#configure-a-backup-policy). +The default backup policy is equivalent to a custom backup policy using a `1d` interval and a count of `2` (see below). + +### Configure a backup policy + +{{< vendor/name >}} allows you to fully configure your own backup policy. +You can setup a different automated backup schedule per environment type (production, staging, and development environments). + +On a given environment type, you can configure: + +- The total number of backups (manual and automated) +- The total number of manual backups specifically +- Multiple schedules for automated backups + +An automated backup schedule is composed of an interval and a count.
+The interval defines the frequency of the backups. +An interval can be a couple of hours, days, weeks, months, or years. +To configure an interval, use the following values: + +- ``h`` for hour +- ``d`` for day +- ``w`` for week +- ``M`` for month +- ``y`` for year + +The count defines the number of backups to retain. + +### Configuration examples + +To take a backup every day and keep up to 7 backups, +run the following command: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:curl settings -X PATCH \ + -d '{ + "data_retention": { + "production": { + "default_config": { + "schedule": [ + {"interval": "1d", "count": 7}, + ] + } + } + } + }' +``` + +#### Configure multiple automated backup schedules + +You can use multiple schedules to implement you own backup policy. +For instance, you may want to keep multiple recent backups and fewer older backups, +using a command similar to the following: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:curl settings -X PATCH \ + -d '{ + "data_retention": { + "production": { + "default_config": { + "schedule": [ + {"interval": "1d", "count": 7}, + {"interval": "1w", "count": 4}, + {"interval": "1M", "count": 12} + ] + } + } + } + }' +``` + +The command results in: + +- A backup every day for 7 days +- A backup every week for 4 weeks +- A backup every month for 12 months + +#### Set a limit for backups + +To configure the maximum number of backups (automated and manual backups alike) on your production environment, +run a command similar to the following: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:curl /settings -X PATCH -d '{"data_retention": {"production": {"max_backups": 10}}}' +``` + +To configure the maximum number of manual backups on the production environment, +run a command similar to the following: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:curl /settings -X PATCH -d '{"data_retention": {"production": {"default_config": {"manual_count": 1}}}}' +``` + ## Live backups You can create backups without any downtime. @@ -105,10 +208,6 @@ When [creating the backup](#create-a-manual-backup), select **Run live backup** ## Create a manual backup -{{< vendor/name >}} provides up to 2 manual backups of your production environment, -plus 2 manual backups you can use for your [preview environments](/glossary/_index.md). -For more information, see the [{{< vendor/name >}} backup policy](/security/backups.md). - You can create a manual backup using the [CLI](../administration/cli/_index.md) or in the [Console](../administration/web/_index.md). {{< codetabs >}} @@ -129,15 +228,17 @@ title=In the Console {{< /codetabs >}} +See more information on [backup policies](#backup-policy) and [data retention](#data-retention). + ### Automate manual backups -You can also automate the process of creating manual backups through [cron jobs](../create-apps/app-reference.md#crons). +You can also automate the process of creating manual backups through [cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). The cron job uses the CLI command to back up the environment. It requires you to [set up the CLI on the environment with an API token](../administration/cli/api-tokens.md#authenticate-in-an-environment). Although this process is automated, -backups created in this way count as manual for the [backup schedule](#backup-schedule). -They don't affect the automated backups taken as part of the schedule. +backups created in this way count as [manual backups](#manual-backups). +They don't affect the automated backups taken as part of [a schedule](#configure-a-backup-policy). ## Physical storage location diff --git a/sites/friday/src/environments/cancel-activity.md b/sites/upsun/src/environments/cancel-activity.md similarity index 100% rename from sites/friday/src/environments/cancel-activity.md rename to sites/upsun/src/environments/cancel-activity.md diff --git a/sites/friday/src/environments/change-parent.md b/sites/upsun/src/environments/change-parent.md similarity index 100% rename from sites/friday/src/environments/change-parent.md rename to sites/upsun/src/environments/change-parent.md diff --git a/sites/friday/src/environments/deactivate-environment.md b/sites/upsun/src/environments/deactivate-environment.md similarity index 100% rename from sites/friday/src/environments/deactivate-environment.md rename to sites/upsun/src/environments/deactivate-environment.md diff --git a/sites/friday/src/environments/default-environment.md b/sites/upsun/src/environments/default-environment.md similarity index 100% rename from sites/friday/src/environments/default-environment.md rename to sites/upsun/src/environments/default-environment.md diff --git a/sites/friday/src/environments/http-access-control.md b/sites/upsun/src/environments/http-access-control.md similarity index 100% rename from sites/friday/src/environments/http-access-control.md rename to sites/upsun/src/environments/http-access-control.md diff --git a/sites/friday/src/environments/restore.md b/sites/upsun/src/environments/restore.md similarity index 100% rename from sites/friday/src/environments/restore.md rename to sites/upsun/src/environments/restore.md diff --git a/sites/friday/src/environments/search-engine-visibility.md b/sites/upsun/src/environments/search-engine-visibility.md similarity index 97% rename from sites/friday/src/environments/search-engine-visibility.md rename to sites/upsun/src/environments/search-engine-visibility.md index c7ff88cc00..c6260f78fb 100644 --- a/sites/friday/src/environments/search-engine-visibility.md +++ b/sites/upsun/src/environments/search-engine-visibility.md @@ -59,7 +59,7 @@ It's automatically on for all `{{% vendor/cli %}}.site` domains. You can also send instructions to search engine indexers using a `robots.txt` file. Your app can serve this as a static file from its disk or as a dynamic response from its `passthru`. -Control either with the [`location` section of your app configuration](../create-apps/app-reference.md#locations). +Control either with the [`location` section of your app configuration](/create-apps/app-reference/single-runtime-image.md#locations). If your `robots.txt` file includes instructions to ignore a page, search engine indexers may ignore it even if you have configured {{% vendor/name %}} to not send the header. diff --git a/sites/friday/src/feedback/_index.md b/sites/upsun/src/feedback/_index.md similarity index 100% rename from sites/friday/src/feedback/_index.md rename to sites/upsun/src/feedback/_index.md diff --git a/sites/friday/src/feedback/report.html b/sites/upsun/src/feedback/report.html similarity index 100% rename from sites/friday/src/feedback/report.html rename to sites/upsun/src/feedback/report.html diff --git a/sites/friday/src/get-started/_index.md b/sites/upsun/src/get-started/_index.md similarity index 100% rename from sites/friday/src/get-started/_index.md rename to sites/upsun/src/get-started/_index.md diff --git a/sites/upsun/src/get-started/here/_index.md b/sites/upsun/src/get-started/here/_index.md new file mode 100644 index 0000000000..16bda08e15 --- /dev/null +++ b/sites/upsun/src/get-started/here/_index.md @@ -0,0 +1,25 @@ +--- +sidebarTitle: Introduction +title: Getting started with {{% vendor/name %}} +weight: -100 +layout: single +# aliases: +# - /get-started/_index.md +--- + +Welcome to {{% vendor/name %}}! + +Follow this guide to set up your very first custom application on {{% vendor/name %}}. +In the process, you will learn more about {{% vendor/name %}}, what it does, and how you can work with it to your best advantage. + +{{< note title="Have you seen the demo?" theme="info" >}} + +Find out how {{% vendor/name %}} works and gain a better understanding of what it provides. To check the demo out, [create a new project](https://console.upsun.com/projects/create-project) and select **Deploy demo project**. + +{{< /note >}} + +Once you have finished the demo, you'll go through the following steps to accomplish your custom deployment: + +{{< get-started/steps >}} + +{{< guide-buttons next="Setup" nextLink="/get-started/here/setup.md" type="*" >}} diff --git a/sites/friday/src/get-started/here/configure/_index.md b/sites/upsun/src/get-started/here/configure/_index.md similarity index 95% rename from sites/friday/src/get-started/here/configure/_index.md rename to sites/upsun/src/get-started/here/configure/_index.md index 04447eb28f..b19d016366 100644 --- a/sites/friday/src/get-started/here/configure/_index.md +++ b/sites/upsun/src/get-started/here/configure/_index.md @@ -61,10 +61,10 @@ Commit your new files: git add . && git commit -m "Add configuration for {{% vendor/name %}}." ``` -Push up to your Upsun project: +Push up to your {{% vendor/name %}} project: ```bash -upsun push +{{% vendor/cli %}} push ``` {{% vendor/name %}} now reads your configuration files, begins building your application image and allocates resources to your various containers. @@ -85,7 +85,7 @@ title=Using {{% vendor/name %}} CLI Found 749 commits E: Error parsing configuration files: -- : Configuration directory '.upsun' not found. +- : Configuration directory '.{{% vendor/cli %}}' not found. E: Error: Invalid configuration files, aborting build ``` @@ -96,7 +96,7 @@ title=Using Console ![Create project options](/images/console/first-fail.png "0.4") {{< /codetabs >}} -This error is triggered because you have not yet added Upsun configuration to your project to setup deployments. +This error is triggered because you have not yet added {{% vendor/name %}} configuration to your project to setup deployments. ## Errors diff --git a/sites/friday/src/get-started/here/configure/nodejs.md b/sites/upsun/src/get-started/here/configure/nodejs.md similarity index 85% rename from sites/friday/src/get-started/here/configure/nodejs.md rename to sites/upsun/src/get-started/here/configure/nodejs.md index ec018594fe..03a42cd206 100644 --- a/sites/friday/src/get-started/here/configure/nodejs.md +++ b/sites/upsun/src/get-started/here/configure/nodejs.md @@ -5,7 +5,7 @@ weight: 10 --- When dealing with Javascript/Node.js stacks, the information below may help customize your configuration. -These sections provide Javascript/Node.js-specific configuration details, but you can also refer to the common Upsun documentation: +These sections provide Javascript/Node.js-specific configuration details, but you can also refer to the common {{% vendor/name %}} documentation: - [Configuring applications](/create-apps) - [Setting up managed services](/add-services) @@ -13,7 +13,7 @@ These sections provide Javascript/Node.js-specific configuration details, but yo ## Build flavors -By default, Upsun makes assumptions about how you want to build your application. +By default, {{% vendor/name %}} makes assumptions about how you want to build your application. Namely, that you are managing your dependencies with npm, and that the very first thing you'd like to run is a particular and common production flavor of `npm install`. This is called a build `flavor`, but its assumption may prove inappropriate for your application and cause your builds to fail (such as if you'd like to use yarn or bun instead of npm). @@ -21,7 +21,7 @@ Therefore, you can [disable this feature](/languages/nodejs#dependencies). ## Available package managers -Certain package managers come pre-installed on all Upsun `nodejs` container types: +Certain package managers come pre-installed on all {{% vendor/name %}} `nodejs` container types: * *npm*; example: ``npm install platformsh-config`` * *npx*; example: ``npx create-strapi-app `` @@ -148,7 +148,7 @@ routes: ## Frameworks -The Upsun documentation includes a wide array of community resources to help with framework-specific configuration: +The {{% vendor/name %}} documentation includes a wide array of community resources to help with framework-specific configuration: - [Express](/get-started/stacks/express) - [Next.js](/get-started/stacks/nextjs) @@ -156,11 +156,11 @@ The Upsun documentation includes a wide array of community resources to help wit ## Get support -While there are virtually no restrictions to you deploying any kind of application on Upsun, configuration may still be unclear at this point. +While there are virtually no restrictions to you deploying any kind of application on {{% vendor/name %}}, configuration may still be unclear at this point. -Not to worry! The Upsun community is here to help. +Not to worry! The {{% vendor/name %}} community is here to help. Come and say hello, share your work, ask for help, and peek in on what others are working on. -Welcome to the Upsun community! +Welcome to the {{% vendor/name %}} community! {{% community-buttons %}} diff --git a/sites/friday/src/get-started/here/configure/php.md b/sites/upsun/src/get-started/here/configure/php.md similarity index 73% rename from sites/friday/src/get-started/here/configure/php.md rename to sites/upsun/src/get-started/here/configure/php.md index 5f0bc07f23..82cab4a74f 100644 --- a/sites/friday/src/get-started/here/configure/php.md +++ b/sites/upsun/src/get-started/here/configure/php.md @@ -5,7 +5,7 @@ weight: 15 --- When dealing with PHP stacks, the information below may help customize your configuration. -These sections provide PHP-specific configuration details, but you can also refer to the common Upsun documentation: +These sections provide PHP-specific configuration details, but you can also refer to the common {{% vendor/name %}} documentation: - [Configuring applications](/create-apps) - [Setting up managed services](/add-services) @@ -13,7 +13,7 @@ These sections provide PHP-specific configuration details, but you can also refe ## Build flavors -By default, Upsun makes assumptions about how you want to build your application. +By default, {{% vendor/name %}} makes assumptions about how you want to build your application. Namely, that you are managing your dependencies with Composer, and that the very first thing you'd like to run is a particular and common production flavor of `composer install`. This is called a build `flavor`, but its assumption may prove inappropriate for your application and cause your builds to fail. @@ -25,7 +25,7 @@ Packagist is the primary Composer repository for public PHP packages. But you ca ## PHP settings -Upsun provides additional configuration possibilities to control: +{{% vendor/name %}} provides additional configuration possibilities to control: - [PHP-FPM runtime configuration](/create-apps/app-reference#runtime) - [PHP settings](/languages/php#php-settings) @@ -39,25 +39,25 @@ See which [PHP extensions](/languages/php/extensions) are available for your ver ## Web servers -While PHP-FPM is the default behavior, Upsun provides some support for different web servers by modifying the `web.commands.start` property: +While PHP-FPM is the default behavior, {{% vendor/name %}} provides some support for different web servers by modifying the `web.commands.start` property: - [Alternate start commands](/languages/php#alternate-start-commands) - [Swoole](/languages/php/swoole) ## Frameworks -The Upsun documentation includes a wide array of community resources to help with framework-specific configuration: +The {{% vendor/name %}} documentation includes a wide array of community resources to help with framework-specific configuration: - [Laravel](/get-started/stacks/laravel) - [Symfony](/get-started/stacks/symfony) ## Get support -While there are virtually no restrictions to you deploying any kind of application on Upsun, configuration may still be unclear at this point. +While there are virtually no restrictions to you deploying any kind of application on {{% vendor/name %}}, configuration may still be unclear at this point. -Not to worry! The Upsun community is here to help. +Not to worry! The {{% vendor/name %}} community is here to help. Come and say hello, share your work, ask for help, and peek in on what others are working on. -Welcome to the Upsun community! +Welcome to the {{% vendor/name %}} community! {{% community-buttons %}} diff --git a/sites/friday/src/get-started/here/configure/python.md b/sites/upsun/src/get-started/here/configure/python.md similarity index 63% rename from sites/friday/src/get-started/here/configure/python.md rename to sites/upsun/src/get-started/here/configure/python.md index 9aa2f731a7..b56b7c8cfa 100644 --- a/sites/friday/src/get-started/here/configure/python.md +++ b/sites/upsun/src/get-started/here/configure/python.md @@ -5,7 +5,7 @@ weight: 20 --- When dealing with Python stacks, the information below may help customize your configuration. -These sections provide Python-specific configuration details, but you can also refer to the common Upsun documentation: +These sections provide Python-specific configuration details, but you can also refer to the common {{% vendor/name %}} documentation: - [Configuring applications](/create-apps) - [Setting up managed services](/add-services) @@ -20,25 +20,25 @@ Alternatively, you can [use a different package manager](/languages/python/depen ## Configuring web servers -Upsun doesn't enforce an assumption of what Python web server package you are using to serve your applications. -You can use any server on Upsun by modifying the `web.commands.start` property of your application configuration. +{{% vendor/name %}} doesn't enforce an assumption of what Python web server package you are using to serve your applications. +You can use any server on {{% vendor/name %}} by modifying the `web.commands.start` property of your application configuration. For more information, see how to [configure web servers](/languages/python/server). ## Frameworks -The Upsun documentation includes a wide array of community resources to help with framework-specific configuration: +The {{% vendor/name %}} documentation includes a wide array of community resources to help with framework-specific configuration: - [Django](/get-started/stacks/django) - [Flask](/get-started/stacks/flask) ## Get support -While there are virtually no restrictions to you deploying any kind of application on Upsun, configuration may still be unclear at this point. +While there are virtually no restrictions to you deploying any kind of application on {{% vendor/name %}}, configuration may still be unclear at this point. -Not to worry! The Upsun community is here to help. +Not to worry! The {{% vendor/name %}} community is here to help. Come and say hello, share your work, ask for help, and peek in on what others are working on. -Welcome to the Upsun community! +Welcome to the {{% vendor/name %}} community! {{% community-buttons %}} diff --git a/sites/friday/src/get-started/here/create-project.md b/sites/upsun/src/get-started/here/create-project.md similarity index 78% rename from sites/friday/src/get-started/here/create-project.md rename to sites/upsun/src/get-started/here/create-project.md index 7efc0b6429..1f22cf663e 100644 --- a/sites/friday/src/get-started/here/create-project.md +++ b/sites/upsun/src/get-started/here/create-project.md @@ -10,7 +10,7 @@ To create a new project on {{% vendor/name %}}, you can take one of two paths:
Using the Console (recommended) -Open the [Upsun management console](https://console.upsun.com/-/create-project) to create your project. +Open the [{{% vendor/name %}} management console](https://console.upsun.com/-/create-project) to create your project. {{% note %}} If you haven't done so already, you are prompted to create your first organization where your project will reside. @@ -19,13 +19,13 @@ If you haven't done so already, you are prompted to create your first organizati ![Create project options](/images/console/create-project.png "0.4") From the Console, what you do next entirely depends on where the "source of truth" of your codebase is located. -In this guide, you will push your local repository to Upsun. +In this guide, you will push your local repository to {{% vendor/name %}}. That is, the only copy of your codebase you'd like to deploy is on your local computer. Click **Start from scratch** from the **Deploy with Git** option. {{< note theme="info" title="Git integrations">}} -This guide does not specifically address integrating an Upsun project with a third party repository such as one on GitHub, even though the **Connect repository** option is available at this stage. +This guide does not specifically address integrating an {{% vendor/name %}} project with a third party repository such as one on GitHub, even though the **Connect repository** option is available at this stage. For now, continue to work locally. Third party integrations will be addressed at the end of this guide. @@ -40,7 +40,7 @@ Add details about your project, such as: As suggested in the Console, connect the local copy of your repository to your project: ```bash -upsun project:set-remote {{< variable "PROJECT_ID" >}} +{{% vendor/cli %}} project:set-remote {{< variable "PROJECT_ID" >}} ``` Your local source code is automatically linked to your newly created {{% vendor/name %}} project through the creation of a `.{{% vendor/cli %}}/local/project.yaml` file. This file contains the corresponding `` and sets a Git remote to `{{% vendor/cli %}}`. @@ -64,17 +64,17 @@ Then, you are asked if you want to set the local remote to your new project. Ent Your local source code is automatically linked to your newly created {{% vendor/name %}} project through the creation of a `.{{% vendor/cli %}}/local/project.yaml` file. This file contains the corresponding `` and sets a Git remote to `{{% vendor/cli %}}`. -In this guide, you will push your local repository to Upsun. +In this guide, you will push your local repository to {{% vendor/name %}}. That is, the only copy of your codebase you'd like to deploy is on your local computer. {{< note theme="info" title="Git integrations">}} -This guide does not specifically address integrating an Upsun project with a third party repository such as one on GitHub, even though you will notice the **Connect repository** option available at this stage. +This guide does not specifically address integrating an {{% vendor/name %}} project with a third party repository such as one on GitHub, even though you will notice the **Connect repository** option available at this stage. For now, continue to work locally. Third party integrations will be addressed at the end of this guide. {{< /note >}} -So long as you chose `y` (yes) to the question `Set the new project as the remote for this repository?` during the `project:create` command, your local project is already integrated to the Upsun project. +So long as you chose `y` (yes) to the question `Set the new project as the remote for this repository?` during the `project:create` command, your local project is already integrated to the {{% vendor/name %}} project.
diff --git a/sites/friday/src/get-started/here/local/_index.md b/sites/upsun/src/get-started/here/local/_index.md similarity index 100% rename from sites/friday/src/get-started/here/local/_index.md rename to sites/upsun/src/get-started/here/local/_index.md diff --git a/sites/friday/src/get-started/here/local/tethered.md b/sites/upsun/src/get-started/here/local/tethered.md similarity index 100% rename from sites/friday/src/get-started/here/local/tethered.md rename to sites/upsun/src/get-started/here/local/tethered.md diff --git a/sites/friday/src/get-started/here/make-changes.md b/sites/upsun/src/get-started/here/make-changes.md similarity index 95% rename from sites/friday/src/get-started/here/make-changes.md rename to sites/upsun/src/get-started/here/make-changes.md index e6a771b0ef..fd7047f5fa 100644 --- a/sites/friday/src/get-started/here/make-changes.md +++ b/sites/upsun/src/get-started/here/make-changes.md @@ -5,7 +5,7 @@ weight: 50 description: How to work on a daily basis with an {{% vendor/name %}} project? --- -Upsun allows you to make changes to your project and test them on a preview environment before introducing them to Production. +{{% vendor/name %}} allows you to make changes to your project and test them on a preview environment before introducing them to Production. In your project, the default branch (e.g. `main`, `master`, whichever chosen during project creation) always represents the production environment. Other branches are for developing new features, fixing bugs, or updating the infrastructure. diff --git a/sites/friday/src/get-started/here/set-resources.md b/sites/upsun/src/get-started/here/set-resources.md similarity index 100% rename from sites/friday/src/get-started/here/set-resources.md rename to sites/upsun/src/get-started/here/set-resources.md diff --git a/sites/friday/src/get-started/here/setup.md b/sites/upsun/src/get-started/here/setup.md similarity index 87% rename from sites/friday/src/get-started/here/setup.md rename to sites/upsun/src/get-started/here/setup.md index 2110267405..bce0af288c 100644 --- a/sites/friday/src/get-started/here/setup.md +++ b/sites/upsun/src/get-started/here/setup.md @@ -41,13 +41,13 @@ While the guide has been written to accommodate the following stacks, it is not {{% guides/requirements %}} {{% note theme="info" title="Trials" %}} -When you create your first organization on Upsun, you are also activating your trial for that organization. +When you create your first organization on {{% vendor/name %}}, you are also activating your trial for that organization. Get [more information on trials](/glossary#trial). {{% /note %}} ## Initialize your Git repository -A Git repository is required for Upsun projects. +A Git repository is required for {{% vendor/name %}} projects. If you haven't already done so, initialize a Git repository for your codebase, and commit your files: ```bash {location="Terminal"} @@ -61,7 +61,7 @@ Your Git configuration may result in different default branches (like `master`), {{< note theme="info" title="Don't commit dependencies" >}} -Whether you're migrating your own project, or testing Upsun with a starter project, **never commit your app's dependencies**. +Whether you're migrating your own project, or testing {{% vendor/name %}} with a starter project, **never commit your app's dependencies**. Make sure you ignore directories containing dependencies by updating your `.gitignore` file. ```bash diff --git a/sites/friday/src/get-started/here/support.md b/sites/upsun/src/get-started/here/support.md similarity index 64% rename from sites/friday/src/get-started/here/support.md rename to sites/upsun/src/get-started/here/support.md index b71418f84a..b3ca25eb39 100644 --- a/sites/friday/src/get-started/here/support.md +++ b/sites/upsun/src/get-started/here/support.md @@ -3,9 +3,9 @@ title: Get support weight: 80 --- -There are virtually no restrictions to you deploying any kind of application on Upsun, and we're excited to hear about your experiments! +There are virtually no restrictions to you deploying any kind of application on {{% vendor/name %}}, and we're excited to hear about your experiments! Follow the links below to share your work, ask the community for help, and peek in on what others are working on. -Welcome to the Upsun community! +Welcome to the {{% vendor/name %}} community! {{% community-buttons %}} \ No newline at end of file diff --git a/sites/friday/src/get-started/here/third-party.md b/sites/upsun/src/get-started/here/third-party.md similarity index 56% rename from sites/friday/src/get-started/here/third-party.md rename to sites/upsun/src/get-started/here/third-party.md index c03e51e4df..e075b0d7df 100644 --- a/sites/friday/src/get-started/here/third-party.md +++ b/sites/upsun/src/get-started/here/third-party.md @@ -3,19 +3,19 @@ title: Third party integrations weight: 75 --- -In this guide, you've configured and deployed a local copy of your codebase to Upsun. -You can continue to work, but the primary remote your team would share would be Upsun itself. +In this guide, you've configured and deployed a local copy of your codebase to {{% vendor/name %}}. +You can continue to work, but the primary remote your team would share would be {{% vendor/name %}} itself. It's more likely that your codebase is on a third party Git service like GitHub, GitLab, or Bitbucket. -Now that you've learned the basics of Upsun configuration and deployment, you can create new projects within the management console, by choosing the **Connect repository** option to set up a GitHub application. +Now that you've learned the basics of {{% vendor/name %}} configuration and deployment, you can create new projects within the management console, by choosing the **Connect repository** option to set up a GitHub application. -At this stage, if you want to make another remote (i.e. `origin`) the primary remote, and Upsun a deployment mirror, you can override your current configuration by setting up an integration: +At this stage, if you want to make another remote (i.e. `origin`) the primary remote, and {{% vendor/name %}} a deployment mirror, you can override your current configuration by setting up an integration: - [BitBucket](/integrations/source/bitbucket.md) - [GitHub](/integrations/source/github.md) - [GitLab](/integrations/source/gitlab.md) -Once the integration is added, all commits on the service are mirrored, built, and deployed on Upsun. +Once the integration is added, all commits on the service are mirrored, built, and deployed on {{% vendor/name %}}. {{< guide-buttons previous="Back" next="Getting support" nextLink="/get-started/here/support" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/_index.md b/sites/upsun/src/get-started/stacks/_index.md new file mode 100644 index 0000000000..8d048317e0 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/_index.md @@ -0,0 +1,18 @@ +--- +title: Frameworks +weight: -80 +layout: single +# aliases: +# - /get-started/_index.md +--- + +{{% vendor/name %}} aims to provide sane defaults out-of-the-box, while exposing a high degree of flexibility when you are configuring your projects, environments, and applications. +Because of this, you can deploy most frameworks on {{% vendor/name %}}. +Below are some common examples sorted by programming language. + +{{< note theme="info" >}} +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here). +They provide all the core concepts and common commands you need to know before using the following materials. +{{< /note >}} + +{{< frameworks-landing >}} diff --git a/sites/upsun/src/get-started/stacks/django.md b/sites/upsun/src/get-started/stacks/django.md new file mode 100644 index 0000000000..789b59169f --- /dev/null +++ b/sites/upsun/src/get-started/stacks/django.md @@ -0,0 +1,222 @@ +--- +title: Deploying Django on {{% vendor/name %}} +sidebarTitle: Django +sectionBefore: Python +layout: single +weight: -80 +description: | + Complete the last required steps to successfully deploy Django on {{% vendor/name %}}. +--- + +{{< note title="Note" theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +For Django to successfully deploy and operate, after completing the [Getting started guide](/get-started/here/_index.md), +you still need to make a few changes to your {{% vendor/name %}} configuration. + +## 1. Leverage environment variables + +Your `settings.py` file may allow for environment variables to be set for common pieces of configuration. +In this case, add and commit a `.environment` file that includes those details. + +```bash {location=".environment"} +export DJANGO_SETTINGS_MODULE=config.settings.production +export DJANGO_SECRET_KEY="$PLATFORM_PROJECT_ENTROPY" +export DJANGO_ALLOWED_HOSTS=".{{< vendor/urlraw "hostname" >}}" +``` + +{{< note theme="warning" title="Warning" >}} + +Not all Django apps allow for configuration in this way. +See the following sections to see how other common settings should be set on {{% vendor/name %}}. + +{{< /note >}} + +## 2. Configure `ALLOWED_HOSTS` + +Your `settings.py` file may not allow you to use an environment variable like `DJANGO_ALLOWED_HOSTS`. +If so, to configure allowed hosts, update your `settings.py` file to include `{{< vendor/urlraw "hostname" >}}`: + +```py {location="settings.py"} +ALLOWED_HOSTS = [ + 'localhost', + '127.0.0.1', + '.{{< vendor/urlraw "hostname" >}}', +] +``` + +Appending `.{{< vendor/urlraw "hostname" >}}` to `ALLOWED_HOSTS` allows for all URLs generated for {{% vendor/name %}} preview environments. + +## 3. {{% vendor/name %}}-specific settings + +Near the bottom of your `settings.py` file, define a block that: + +- Detects when Django is running on an {{% vendor/name %}} environment +- Override previous settings + +If your configuration is split into a `production.py` file for production settings, place it there instead. + +```py {location="settings.py"} +# Production/{{% vendor/name %}} settings. +if (os.getenv('PLATFORM_APPLICATION_NAME') is not None): + DEBUG = False + + # Static dir. + if (os.getenv('PLATFORM_APP_DIR') is not None): + STATIC_ROOT = os.path.join(os.getenv('PLATFORM_APP_DIR'), 'static') + + # Secret Key. + if (os.getenv('PLATFORM_PROJECT_ENTROPY') is not None): + SECRET_KEY = os.getenv('PLATFORM_PROJECT_ENTROPY') + + # Production database configuration. + if (os.getenv('PLATFORM_ENVIRONMENT') is not None): + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': os.getenv('DATABASE_PATH'), + 'USER': os.getenv('DATABASE_USERNAME'), + 'PASSWORD': os.getenv('DATABASE_PASSWORD'), + 'HOST': os.getenv('DATABASE_HOST'), + 'PORT': os.getenv('DATABASE_PORT'), + }, + 'sqlite': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } + } +``` + +This update includes a few important changes: + +1. **Overwrites.** If the `PLATFORM_APPLICATION_NAME` {{% vendor/name %}} built-in variable is found (that is, Django is running on an {{% vendor/name %}} environment), override your previous settings. +No matter what environment type we run on {{% vendor/name %}}, this file uses production settings for {{% vendor/name %}} (i.e. `DEBUG = False`). +1. **Static.** `STATIC_ROOT`, and the `static` files path is updated relative to the application root on {{% vendor/name %}}. + +1. **Secret key.** All {{% vendor/name %}} projects come with a unique hash environment variable `PLATFORM_PROJECT_ENTROPY` that can be used to update your `SECRET_KEY`. + +1. **Databases.** When Django is running on an {{% vendor/name %}} enviroment _at runtime_, it has access to service containers like databases and caches. +Every service container you configure in `.upsun/config.yaml` has a unique relationship name (`applications::relationships:`). +{{% vendor/name %}} automatically uses this relationship name to expose connection credentials through environment variables (for example, via `RELATIONSHIPNAME_HOST`).
+Update `settings.py` according to the example above (which configures a PostgreSQL service), where the relationship `database` results in environment variables that are leveraged to update the `DATABASES` setting for your application.
+You can use the exact same logic to configure `CACHES` from the `rediscache` relationship using the exposed `REDISCACHE_` environment variables to setup `django_redis.cache.RedisCache`. + +## 4. Start the app + +In your app configuration, locate the `web:commands:start` section and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + web: + commands: + start: "gunicorn -b unix:$SOCKET config.wsgi" + upstream: + socket_family: unix +``` + +Note that if your Django instance requires a different web server, +{{% vendor/name %}} also supports [several other options](/languages/python/server.md). + +## 5. Configure static assets + +To access Django's static assets, you need to add a second location to the `web:locations` section of your app configuration. +Locate the `web:locations` section and add a location for `/static`: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + web: + locations: + "/": + "passthru": true + "/static": + "allow": true + "expires": "1h" + "root": "static" +``` + +## 6. Install dependencies and builds + +Instruct {{% vendor/name %}} to install your Python and Node (if needed) dependencies. +Locate the `hooks:build` section and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + build: | + set -eux + + pip install --upgrade pip + pip install -r requirements.txt + npm install + npm run build +``` + +Remove the `npm` steps if not required for your app's assets. +Note that if your project uses a different package manager, +{{% vendor/name %}} also supports [several other options](/languages/python/dependencies.md). + +## 7. Configure the deploy phase + +In your app configuration, locate the `deploy` section and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + deploy: | + set -eux + + python manage.py collectstatic --noinput + python manage.py migrate +``` + +## 8. Allow write access where needed + +Since Django can require a writable locations at runtime, you need to set up writable mounts. +To do so, locate the `mounts` section (currently commented), and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + mounts: + "/staticfiles": + source: "local" + source_path: "static_assets" +``` + +You can now commit all of the above changes and push to {{% vendor/name %}}. + +```bash {location="Terminal"} +git add . +git commit -m "Add changes to complete my {{% vendor/name %}} configuration" +git push +``` + +## Further resources + +### Documentation + +- [Python documentation](/languages/python/) +- [Managing dependencies](/languages/python/dependencies) +- [Configuring web servers](/languages/python/server) + +### Community content + +- [Django topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=django) +- [Python topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=python) + +### Blogs + +- [_Up(sun) and running with Django_](https://upsun.com/blog/setting-up-django-on-upsun/) + + diff --git a/sites/upsun/src/get-started/stacks/express/_index.md b/sites/upsun/src/get-started/stacks/express/_index.md new file mode 100644 index 0000000000..7bcbd3d656 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/express/_index.md @@ -0,0 +1,344 @@ +--- +title: Deploying Express on {{% vendor/name %}} +sectionBefore: Javascript/Node.js +sidebarTitle: Express +weight: -100 +layout: single +description: | + Complete the last required steps to successfully deploy Express on {{% vendor/name %}}. +--- + +{{< note title="Note" theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +{{% guides/requirements name="Express" %}} + +## 1. Create an Express app + +To create your Express app, follow these steps. + +1. Follow the Express [installation guide](https://expressjs.com/en/starter/installing.html). + To fast track the process, run the following commands: + + ```bash {location="Terminal"} + mkdir my-express-app && cd my-express-app + npx express-generator + ``` + +2. To initialize the local Git repository and commit local files, run the following commands: + + ```bash {location="Terminal"} + git init + echo "node_modules" >> .gitignore + git add . + git commit -m "Init Express application." + ``` + +{{< note theme="info" >}} +You can view your running app locally by installing dependencies (`npm install`) and running `npm run dev`. +The local server is visible at `localhost:3000`. +{{< /note >}} + +## 2. Create a new project + +To create a project on {{% vendor/name %}}, +follow these steps. + +{{< note title="Remember" >}} +After creating your {{% vendor/name %}} project, copy your new **project ID** for later use. +{{< /note >}} + +{{< codetabs >}} ++++ +title=Using the CLI ++++ +To create a new project with the {{% vendor/name %}} CLI, use the following command and follow the prompts: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:create +``` + +{{< note >}} + +When creating a new project using the {{% vendor/name %}} CLI command `project:create`, +you are asked if you want to set the local remote to your new project. Enter **Yes (y)**. + +Your local source code is automatically linked to your newly created {{% vendor/name %}} project +through the creation of a `.{{% vendor/cli %}}/local/project.yaml`. +This file contains the corresponding `` for the {{% vendor/name %}} CLI to use, +and sets a Git remote to `{{% vendor/cli %}}`. + +{{< /note >}} + +<---> ++++ +title=Using the Console ++++ + +1. Create an organization or select an existing one. + +2. Click **Create from scratch**. + +3. Fill in details like the project name and [region](/development/regions.md). + + {{% note %}} + + You can define resources for your project later on, after your first push. + + {{% /note %}} + +4. To link your local source code to your new {{% vendor/name %}} project, + run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:set-remote + ``` + + This command adds a new remote called `{{% vendor/cli %}}` to your local Git repository, + which is equivalent to the following commands: + + ```bash {location="Terminal"} + git remote + origin + {{% vendor/cli %}} + ``` + + It also creates a new `.{{% vendor/cli %}}/local/project.yaml` file that contains the `` + for the `{{% vendor/cli %}}` CLI to use. + + {{< note theme="info" title="Tip" >}} + + If you forget your ``, run the following command and find your project in the list: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:list + ``` + {{< /note >}} + +{{< /codetabs >}} + +## 3. Choose your Git workflow + +You can use {{% vendor/name %}} projects as a classic Git repository, +where you are able to push your source code in different ways, +using either the Git CLI or the {{% vendor/name %}} CLI. +You can choose which way —or Git workflow— you want to use for your project from the following options: + +- Your project source code is **hosted on a {{% vendor/name %}} Git repository** +- Your project source code is **hosted on your own GitHub repository** + +{{< codetabs >}} ++++ +title={{% vendor/name %}} Git repository ++++ +For the rest of this guide, you will use the normal Git workflow (`git add . && git commit -m "message" && git push {{% vendor/cli %}}`) to commit your source code changes to Git history. +You will also use the {{% vendor/name %}} CLI to deploy your [{{% vendor/name %}} environment](/environments.html) with the latest code updates. + +<---> ++++ +title=GitHub repository ++++ +{{% vendor/name %}} provides a [Github integration](integrations/source/github.md) that allows your {{% vendor/name %}} project to be fully integrated with your Github repository. +This enables you, as a developer, to use a normal Git workflow (`git add . && git commit -m "message" && git push`) to deploy your environment—with no need to connect to the {{% vendor/name %}} Console. + +{{< note >}} +Make sure you complete the following steps before adding a [Github integration](integrations/source/github.md): + +1. Create a Git repository in your own organization following the relevant [Github repository creation guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository). +2. Create a [Github integration](integrations/source/github.md). +3. Add a Git remote to your local project, from the root of your Express directory.
+ To do so, run the following commands: + + ```bash {location="Terminal"} + git remote add origin + git add . && git commit -m "init express" + git push origin + ``` +{{< /note >}} + +{{< /codetabs >}} + +## 4. Configure your project + +To host your Express application on {{% vendor/name %}}, +you need to have a few YAML configuration files at the root of your project. +These files manage your app's behavior. +They are located in a `.{{% vendor/cli %}}/` folder at the root of your source code +and structured in a similar way to this: + +```txt +my-express-app +├── .{{% vendor/cli %}} +│ └── config.yaml +├── [.environment] +└── +``` + +To generate these files, run the following command at the root of your project: + +``` {location="Terminal"} +{{% vendor/cli %}} project:init +``` + +Follow the prompts. + +To commit your new files, run the following commands: + +```bash {location="Terminal"} +git add . +git commit -m "Add {{% vendor/name %}} config files" +``` + +## 5. Deploy + +And just like that, it’s time to deploy! + +Depending on the Git workflow you chose at the beginning of this tutorial, +there are two ways to deploy your source code changes. + +{{< codetabs >}} + ++++ +title=Using {{% vendor/name %}} Git repository ++++ + +You can push your code using the normal Git workflow (`git add . && git commit -m "message" && git push`). This pushes your source code changes to your `{{% vendor/cli %}}` remote repository. Alternatively, you can use the following {{% vendor/name %}} CLI command: + +```bash {location="Terminal"} +{{% vendor/cli %}} push +``` + +<---> ++++ +title=Using a third-party Git repository ++++ + +When you choose to use a third-party Git hosting service, the {{< vendor/name >}} Git +repository becomes a read-only mirror of the third-party repository. All your +changes take place in the third-party repository. + +Add an integration to your existing third-party repository: + +- [BitBucket](/integrations/source/bitbucket.md) +- [GitHub](/integrations/source/github.md) +- [GitLab](/integrations/source/gitlab.md) + +If you are using an integration, on each code updates, +use the normal Git workflow (`git add . && git commit -m "message" && git push`) to push your code to your external repository. +To do so, run the following command: + +```bash {location="Terminal"} +git push origin +``` + +Your GitHub, GitLab, or Bibucket integration process then automatically deploys changes to your environment. +If you're pushing a new Git branch, a new environment is created. + +{{< /codetabs >}} + +{{% vendor/name %}} then reads your configuration files, +and deploys your project using [default container resources](/manage-resources/resource-init.md). +If you don't want to use those default resources, +define your own [resource initialization strategy](/manage-resources/resource-init.md#define-a-resource-initialization-strategy), +or [amend those default container resources](/manage-resources/adjust-resources.md) after your project is deployed. + +Et voilà, your Express application is live! + +{{< note title="Tip" theme="info" >}} + +Each environment has its own domain name. +To open the URL of your new environment, run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} environment:url --primary + ``` +{{< /note >}} + +## 6. Make changes to your project + +Now that your project is deployed, you can start making changes to it. +For example, you might want to fix a bug or add a new feature. + +In your project, the `main` branch always represents the production environment. +Other branches are for developing new features, fixing bugs, or updating the infrastructure. + +To make changes to your project, follow these steps: + +1. Create a new environment (a Git branch) to make changes without impacting production: + + ```bash {location="Terminal"} + {{% vendor/cli %}} branch feat-a + ``` + + This command creates a new local `feat-a` Git branch based on the main Git branch, + and activates a related environment on {{< vendor/name >}}. + The new environment inherits the data (service data and assets) of its parent environment (the production environment here). + +2. Make changes to your project. + For example, edit the `views/index.jade` file and make the following changes: + + ```diff + diff --git a/views/index.jade b/views/index.jade + index 3d63b9a..77aee43 100644 + --- a/views/index.jade + +++ b/views/index.jade + @@ -2,4 +2,4 @@ extends layout + + block content + h1= title + - p Welcome to #{title} + + p Welcome to #{title} on {{% vendor/name %}} + `` + +3. Commit your changes: + + ```bash {location="Terminal"} + git add views/index.jade + git commit -m "Update index page view." + ``` + +4. Deploy your changes to the `feat-a` environment: + + ```bash {location="Terminal"} + {{% vendor/cli %}} push + ``` + +5. Iterate by changing the code, committing, and deploying. + When satisfied with your changes, merge them to the main branch, + and remove the feature branch: + + ```bash {location="Terminal"} + {{% vendor/cli %}} merge + Are you sure you want to merge feat-a into its parent, main? [Y/n] y + {{% vendor/cli %}} checkout main + git pull {{% vendor/cli %}} main + {{% vendor/cli %}} environment:delete feat-a + git fetch --prune + ``` + + Note that deploying to production is fast because the image built for the `feat-a` environment is reused. + + For a long running branch, to keep the code up-to-date with the main branch, use `git merge main` or `git rebase main`. + You can also keep the data in sync with the production environment by using `{{% vendor/cli %}} env:sync`. + +## Further resources + +### Documentation + +- [JavaScript/Node.js documentation](/languages/nodejs/) +- [Managing dependencies](/languages/nodejs#dependencies) +- [Add a database to Express](/get-started/stacks/express/add-database) + +### Community content + +- [ExpressJS topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=express) +- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) +- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) + +### Blogs + +- [A quick-start guide on hosting Express on {{% vendor/name %}}](https://upsun.com/blog/setting-up-express-on-upsun/) diff --git a/sites/upsun/src/get-started/stacks/express/add-database.md b/sites/upsun/src/get-started/stacks/express/add-database.md new file mode 100644 index 0000000000..a1408bf05c --- /dev/null +++ b/sites/upsun/src/get-started/stacks/express/add-database.md @@ -0,0 +1,234 @@ +--- +title: "Add a database" +weight: -130 +description: | + Once your Express app has been deployed on {{% vendor/name %}}, you might want to add a service to it. +--- + +{{% description %}} + +{{% vendor/name %}} projects already include a [variety of managed services](/add-services.html#available-services), so you don’t have to subscribe to an external cache or search-engine services. + +As these services are included in your project, you can manage them through Git. +They’re backed up along with the rest of your project. +You can add new services and manage existing service configurations from your `.{{% vendor/cli %}}/config.yaml` file. + +For example, to add a [MariaDB database engine](/add-services/mysql.html) to your Express project, complete the following steps: + +## 1. Create a new branch for testing + +To create a new branch, run the following command: + +```bash {location="Terminal"} +{{% vendor/cli %}} environment:branch add-mysql-database +``` + +## 2. Add a MariaDB service + +Configure the MariaDB service by adding a `database` service to your `.{{% vendor/cli %}}/config.yaml` file: + +```yaml {location=".upsun/config.yaml"} +applications: + my-express-app: + source: + root: "/" + type: "nodejs:20" + + [...] + +{{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: + database: + type: mariadb:{{% latest "mariadb" %}} +``` + +To connect the service to your application (``app``), add the following relationship: + +```yaml {location=".upsun/config.yaml"} +applications: + my-express-app: + source: + root: "/" + type: "nodejs:20" + + [...] + + relationships: + database: "database:mysql" + +{{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: + database: + type: mariadb:{{% latest "mariadb" %}} +``` + +Commit your change: + +```bash {location="Terminal"} +git commit -am "adding MariaDb database service" +{{% vendor/cli %}} push +``` + +{{% vendor/name %}} now reads your configuration files and deploys your project using [default container resources](/manage-resources/resource-init.md). +If you don't want to use those default resources, +define your own [resource initialization strategy](/manage-resources/resource-init.md#define-a-resource-initialization-strategy), +or [amend those default container resources](/manage-resources/adjust-resources.md) after your project is deployed. + +## 3. Connect to the service + +To configure your Express app so it uses your new database, +you need a Node.s module named `mysql2`. +To install it, run the following command: + +```bash {location="Terminal"} +npm install mysql2 +``` + +Wherever your application code attemps to connect to the database service, +{{% vendor/name %}} will automatically generate environment variables containing connection credentials as a function of the relationship name. + +In this example, the MariaDB service access is granted to the application container via the relationship `database`. +{{% vendor/name %}} will therefore generate the variable `DATABASE_HOST` (among many others), using this name. + +Here's an example of how this credential variable naming convention is used to connect to a MariaDB service: + +```javascript {location="index.js"} +const express = require('express') +const app = express() +const mysql = require("mysql2/promise"); +const port = (process.env.PORT || '3000'); + +function openConnection() { + return mysql.createConnection({ + host: process.env.DATABASE_HOST, + port: process.env.DATABASE_PORT, + user: process.env.DATABASE_USERNAME, + password: process.env.DATABASE_PASSWORD, + database: process.env.DATABASE_DATABASE + }); +} + +function createTable(connection) { + return connection.execute( + `CREATE TABLE IF NOT EXISTS {{% vendor/cli %}}info ( + uid INT(10) NOT NULL AUTO_INCREMENT, + username VARCHAR(64) NULL DEFAULT NULL, + departname VARCHAR(128) NULL DEFAULT NULL, + created DATE NULL DEFAULT NULL, + PRIMARY KEY (uid) + ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;` + ); +} + +function insertData(connection) { + return connection.execute( + "INSERT INTO {{% vendor/cli %}}info (username, departname, created) VALUES ('{{% vendor/cli %}}', 'Deploy Friday', '2023-09-29')" + ); +} + +function readData(connection) { + return connection.query("SELECT * FROM {{% vendor/cli %}}info"); +} + +function dropTable(connection) { + return connection.execute("DROP TABLE {{% vendor/cli %}}info"); +} + +// Define the main route. +app.get('/', async function(req, res){ + + // Connect to MariaDB. + const connection = await openConnection(); + + await createTable(connection); + await insertData(connection); + + const [rows] = await readData(connection); + + const droppedResult = await dropTable(connection); + + // Make the output. + const outputString = `Hello, World! - A simple Express web framework template for {{% vendor/name %}} + +MariaDB Tests: + +* Connect and add row: + - Row ID (1): ${rows[0].uid} + - Username ({{% vendor/cli %}}): ${rows[0].username} + - Department (Deploy Friday): ${rows[0].departname} + - Created (2023-09-29): ${rows[0].created} +* Delete row: + - Status (0): ${droppedResult[0].warningStatus}`; + + res.set('Content-Type', 'text/plain'); + res.send(outputString); +}); + +// Get PORT and start the server +app.listen(port, function() { + console.log(`Listening on port ${port}`) +}); +``` + +Commit and deploy your changes: + +```bash {location="Terminal"} +git add package.json package-lock.json index.js && git commit -m "adding MariaDb database service" +{{% vendor/cli %}} push +{{% vendor/cli %}} environment:url --primary +``` + +## 4. Merge to production + +When satisfied with your changes, merge them to the main branch: + +```bash {location="Terminal"} +{{% vendor/cli %}} merge +``` + +{{< note >}} +You can [adjust your project resources](/manage-resources/adjust-resources.md) at any time. +{{< /note >}} + +## 5. Remove the feature branch + +Then, remove the feature branch: + +```bash {location="Terminal"} +{{% vendor/cli %}} checkout main +git pull {{% vendor/cli %}} main +{{% vendor/cli %}} environment:delete add-mysql-database +git fetch --prune +``` + +{{< note >}} +When the `environment:delete` CLI command is run, the CLI suggests you deactivate and delete your `add-mysql-database` environment. +Make sure you opt in. +{{< /note >}} + +## Tips & Tricks + +You can get your project's relationship information using the following command: + +```bash {location="Terminal"} +{{% vendor/cli %}} relationships + ... + database: + - + username: user + scheme: mysql + service: mariadb + fragment: null + ip: 198.12.123.45 + hostname: abcdefghijklm1234567890123.mariadb.service._..{{< vendor/urlraw "hostname" >}} + public: false + cluster: abcdefgh1234567-add-mysql-database-abcd123 + host: mariadb.internal + rel: mysql + query: + is_master: true + path: main + password: '' + type: 'mariadb:10.6' + port: 3306 + host_mapped: false + url: 'mysql://user:@mariadb.internal:3306/main' +``` diff --git a/sites/upsun/src/get-started/stacks/flask.md b/sites/upsun/src/get-started/stacks/flask.md new file mode 100644 index 0000000000..84b62f10ef --- /dev/null +++ b/sites/upsun/src/get-started/stacks/flask.md @@ -0,0 +1,387 @@ +--- +title: Deploying Flask on {{% vendor/name %}} +sidebarTitle: Flask +weight: -75 +description: | + Complete the last required steps to successfully deploy Flask on {{% vendor/name %}}. +--- + +{{< note title="Note" theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +For Flask to successfully deploy and operate, after completing the [Getting started guide](/get-started/here/_index.md), +you still need to make a few changes to your {{% vendor/name %}} configuration. + +## 1. Leverage environment variables + +The CLI generated a `.environment` file during the Getting started guide. +Notice it has already created some environmental variables for you to connect to your database service. + +```bash {location=".environment"} +export RELATIONSHIPS_JSON="$(echo $PLATFORM_RELATIONSHIPS | base64 --decode)" + +# Set database environment variables +export DB_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].host')" +export DB_PORT="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].port')" +export DB_DATABASE="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].path')" +export DB_USERNAME="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].username')" +export DB_PASSWORD="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].password')" +export DB_CONNECTION="$(echo $RELATIONSHIPS_JSON | jq -r '.postgresql[0].scheme')" +export DATABASE_URL="postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}" +``` + +To configure all the environment variables Flask needs to run smoothly, follow these steps. + +1. Set the `FLASK_APP` environment variable to specify how to load the app. + + ```bash {location=".environment"} + export FLASK_APP="autoapp.py" + ``` + + The above example uses the file `autoapp.py` as the main entry. + Adjust according to your situation. + + +2. Set the `FLASK_ENV` environment variable to enable behaviors based on the environment type. + + {{% vendor/name %}} provides information about what type of environment the app is running in via the `PLATFORM_ENVIRONMENT_TYPE` environment variable. + Its values can be ``production``, ``development``, or ``staging``. + Use this information to set the value for `FLASK_ENV`. + + ```bash {location=".environment"} + export FLASK_ENV="${PLATFORM_ENVIRONMENT_TYPE}" + ``` + + Several other environmental variables need to change based on the environment type. + Leverage the information in `PLATFORM_ENVIRONMENT_TYPE` for these other variables too. + +3. Set the `FLASK_DEBUG` environment variable to ``1`` (enabled) if you're not running in production. + + ```bash {location=".environment"} + export FLASK_DEBUG=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo 0 || echo 1) + ``` + +4. Do the same for `LOG_LEVEL`. + + ```bash {location=".environment"} + export LOG_LEVEL=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo "info" || echo "debug") + ``` + +5. Set the `SEND_FILE_MAX_AGE_DEFAULT` to ``0`` (disabled) if you're not in production, but a higher value if you are. + + ```bash {location=".environment"} + export SEND_FILE_MAX_AGE_DEFAULT=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo 31556926 || echo 0) + ``` + +6. Optional: You may also need to set a `SECRET_KEY` environment variable. + It's used for securely signing the session cookie and can be used for any other security-related needs by extensions or your app. + It usually is a long random string. + + Set the `SECRET_KEY` environment variable to leverage the [`PLATFORM_PROJECT_ENTROPY` variable](/development/variables/use-variables.md#use-provided-values) provided by {{% vendor/name %}}: + + ```bash {location=".environment"} + export SECRET_KEY="${PLATFORM_PROJECT_ENTROPY}" + ``` + + Your `.environment` file should now look similar to the following: + + ```bash {location=".environment"} + # Set database environment variables + export DB_HOST="$POSTGRESQL_HOST" + export DB_PORT="$POSTGRESQL_PORT" + export DB_PATH="$POSTGRESQL_PATH" + export DB_USERNAME="$POSTGRESQL_USERNAME" + export DB_PASSWORD="$POSTGRESQL_PASSWORD" + export DB_SCHEME="postgresql" + export DATABASE_URL="${DB_SCHEME}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_PATH}" + + export FLASK_ENV="${PLATFORM_ENVIRONMENT_TYPE}" + export FLASK_DEBUG=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo 0 || echo 1) + export LOG_LEVEL=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo "info" || echo "debug") + export SEND_FILE_MAX_AGE_DEFAULT=$( [ "${PLATFORM_ENVIRONMENT_TYPE}" = "production" ] && echo 31556926 || echo 0) + export SECRET_KEY="${PLATFORM_PROJECT_ENTROPY}" + ``` + +## 2. Configure static assets + +You need to add some writable disk space to hold the static assets that `flask-static-digest` generates and `npm` builds. + +To do so, define the `.//static` directory as [a mount](/create-apps/app-reference/single-runtime-image#mounts). +In your app configuration, locate the section dedicated to mounts and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + mounts: + "/static": + source: "storage" + source_path: "static_assets" +``` + +Replace `` with the `app_name` you defined when creating your Flask project. + +## 3. Install dependencies and builds + +Instruct {{% vendor/name %}} to automatically run `npm install` in addition to installing your Python dependencies +when building the application container. + +To do so, customize your [build hook](/create-apps/hooks/hooks-comparison.html#build-hook). +In your app configuration, locate the section dedicated to it and update it as follows: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + # The build hook is run after any build flavor. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook + build: | + set -eux + pip install -r requirements.txt +``` + + The {{% vendor/name %}} CLI automatically added `pip install -r requirements.txt` to your build hook configuration when you + [configured your {{% vendor/name %}} project](/get-started/here/configure/_index.md). + + If you want `pip` to be upgraded first to the latest version, add `pip install --upgrade pip` to the above line. + Then, add `npm install`: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + # The build hook is run after any build flavor. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook + build: | + set -eux + pip install --upgrade pip + pip install -r requirements.txt + npm install +``` + +Note that if your project uses a different package manager, {{% vendor/name %}} also supports [several other options](/languages/python/dependencies.md). + +## 4. Configure the deploy phase + +Instruct {{% vendor/name %}} to automatically run `npm run build` when building the application container. +To do so, customize your [deploy hook](/create-apps/hooks/hooks-comparison.html#deploy-hook). +In your app configuration, locate the section dedicated to it: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + # echo 'Put your deploy command here' +``` + +Add `npm run build`: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + npm run build +``` + +## 5. Configure the web server + +[Configure the web server](/create-apps/_index.md#configure-whats-served) running in front of your app to define how your app handles dynamic requests. +To do so, in your app configuration, locate the section dedicated to the web server: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # The web key configures the web server running in front of your app. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web + web: + # Commands are run once after deployment to start the application process. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands +``` + +To add a basic Flask server, replace the default information added by the {{% vendor/name %}} CLI with `flask run -p $PORT`. +Also, change the `socket_family` value from `unix` to `tcp`: + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + # The web key configures the web server running in front of your app. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web + web: + # Commands are run once after deployment to start the application process. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands + commands: + start: "flask run -p $PORT" + upstream: + socket_family: tcp +``` + +You can now commit all of the above changes and push to {{% vendor/name %}}. + +```bash {location="Terminal"} +git add . +git commit -m "Add changes to complete my {{% vendor/name %}} configuration" +git push +``` + +Note that if your Flask project requires a different web server, +{{% vendor/name %}} also supports [several other options](/languages/python/server.md), including Gunicorn, Daphne, +Uvicorn, and Hypercorn. + +If you use Pip, make sure you add your chosen web server to your `requirements.txt` file. + +## 6. Handle database migrations + +### Prepare database migrations + +If you have a new Flask project that uses [Flask-migrate](https://flask-migrate.readthedocs.io/en/latest/), +or an existing app but need to set up the initial migrations, you can do so using the database service you created earlier. + +To do so, follow these steps. + +1. Set up a virtual environment where your project can run: + + ```bash {location="Terminal"} + python3 -m venv env && source venv/bin/activate + ``` + +2. Just like in your build hook, update pip and install the requirements: + + ```bash {location="Terminal"} + pip install --upgrade pip && pip install -r requirements.txt + ``` + +3. Set up a way for your local instance of Flask to communicate with your database service: + + ```bash {location="Terminal"} + {{% vendor/cli %}} tunnel:open -y + ``` + + This opens an SSH tunnel to all the services for the app. + You can use this connection to allow your local instance to communicate with live services as if they too were local.
+ To do so, you need to configure more environment variables. + +4. Reopen your `.environment` file. + Note the use of the `$PLATFORM_RELATIONSHIPS` environment variable to retrieve information about services and their credentials.
+ The tunnel you created gives you access to that same data, + allowing you to generate a local `PLATFORM_RELATIONSHIPS` environment variable containing the same information. + + Set the following environment variable: + + ```bash {location=".environment"} + export PLATFORM_RELATIONSHIPS="$({{% vendor/cli %}} tunnel:info --encode)" + ``` + + Since you now have this environmental variable set locally, you can reuse your `.environment` file for {{% vendor/name %}} to recreate + many of the other environmental variables you need to run locally. + +5. Set the following environment variables as they aren't set via ``PLATFORM_RELATIONSHIPS``: + + ```bash {location=".environment"} + export PLATFORM_ENVIRONMENT_TYPE=production + export PORT=8888 + export PLATFORM_PROJECT_ENTROPY=$(openssl rand -base64 32) + ``` + +6. Source your `.environment` file to finish setting up all the environmental variables in your current bash: + + ```bash {location="Terminal"} + source ./.environment + ``` + + You now have everything you need for Flask-Migrate to be able to connect to the database and generate your migration files. + +### Generate database migrations + +1. Initiate the migrations directory and prepare for the ``migrate`` command: + + ```bash {location="Terminal"} + flask db init + ``` + +2. Generate your migrations: + + ```bash {location="Terminal"} + flask db migrate + ``` + +3. Commit your generated migrations: + + ```bash {location="Terminal"} + git add migrations/* && git commit -m "Adds migrations" + ``` + +4. Instruct {{% vendor/name %}} to run the Flask-migrate upgrade command when deploying + so any migration changes are automatically applied.
+ To do so, re-open your `.upsun/config.yaml` file. + Locate the `deploy` hook where you added `npm run build` previously and update it as follows: + + ```yaml {location=".upsun/config.yaml"} + applications: + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + npm run build + flask db upgrade + ``` + +5. Commit all your changes and push to {{% vendor/name %}}. + + ```bash {location="Terminal"} + git add . + git commit -m "Add changes to complete my {{% vendor/name %}} configuration" + git push + ``` + +## Further resources + +### Documentation + +- [Python documentation](/languages/python/) +- [Managing dependencies](/languages/python/dependencies) +- [Configuring web servers](/languages/python/server) + +### Community content + +- [Flask topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=flask) +- [Python topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=python) + +### Blogs + +- [Up(sun) and running with Django](https://upsun.com/blog/setting-up-django-on-upsun/) + + diff --git a/sites/upsun/src/get-started/stacks/laravel/_index.md b/sites/upsun/src/get-started/stacks/laravel/_index.md new file mode 100644 index 0000000000..5083b17985 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/_index.md @@ -0,0 +1,48 @@ +--- +title: Deploying Laravel on {{% vendor/name %}} +sidebarTitle: Laravel +sectionBefore: PHP +layout: single +weight: -65 +description: | + Complete the last required steps to successfully deploy Laravel on {{% vendor/name %}}. +--- + +{{< note theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +{{< get-started/steps >}} + +## Further resources + +### Documentation + +- [PHP documentation](/languages/php/) + +- [Extensions](/languages/php/extensions) + +- [Performance tuning](/languages/php/tuning) + +- [PHP-FPM sizing](/languages/php/fpm) + +- [Swoole on {{% vendor/name %}}](/languages/php/swoole) + +- [Authenticated Composer](/languages/php/composer-auth) + +### Community content + +- [Laravel topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=laravel) + +- [PHP topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=php) + +### Blogs + +- [_Upsun: the missing PaaS to scale Laravel applications_](https://upsun.com/blog/paas-to-scale-laravel-apps/) + + + +{{< guide-buttons next="Get started" nextLink="/get-started/stacks/laravel/get-started.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/blackfire.md b/sites/upsun/src/get-started/stacks/laravel/blackfire.md new file mode 100644 index 0000000000..20f6f43365 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/blackfire.md @@ -0,0 +1,23 @@ +--- +title: "Continous Observability with Blackfire" +sidebarTitle: "Blackfire" +weight: -90 +description: Set up a continuous observability strategy for your Laravel app with Blackfire. +--- + +[Blackfire.io](/increase-observability/application-metrics/blackfire.md) is the recommended solution +for monitoring and profiling web sites and apps. +Blackfire works seamlessly with any app built with Laravel. + +Blackfire PHP SDK provides the following [integrations with +Laravel](https://docs.blackfire.io/php/integrations/laravel/index): + +- [Laravel Artisan](https://docs.blackfire.io/php/integrations/laravel/artisan) +- [Laravel Horizon and queue services](https://docs.blackfire.io/php/integrations/laravel/horizon) +- [Laravel Tests](https://docs.blackfire.io/php/integrations/laravel/tests) +- [Laravel Octane](https://docs.blackfire.io/php/integrations/laravel/octane) + +Please refer to the [Blackfire documentation](https://docs.blackfire.io/testing-cookbooks/tests#the-code-blackfire-yaml-code-file) to set up a `.blackfire.yml` configuration to enable custom [performance tests](https://docs.blackfire.io/testing-cookbooks/index) +and automated [builds](https://docs.blackfire.io/builds-cookbooks/index). + +{{< guide-buttons previous="Back" next="Debug with Telescope" nextLink="/get-started/stacks/laravel/laravel-telescope.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/crons.md b/sites/upsun/src/get-started/stacks/laravel/crons.md new file mode 100644 index 0000000000..59eeadeda7 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/crons.md @@ -0,0 +1,76 @@ +--- +title: "Set up cron jobs" +weight: -105 +description: | + Understand how to configure Laravel cron jobs. +--- + +Cron jobs allow you to run scheduled tasks at specified times or intervals. + +While you can run your own custom tasks, Laravel provides a scheduler to simplify the implementation. +To implement it, see the Laravel [Task Scheduling documentation](https://laravel.com/docs/master/scheduling). + +## Set up a cron job + +To set up a cron job, update your {{% vendor/name %}} configuration as follows: + +```yaml {configFile="app"} +applications: + myapp: + [...] + crons: + snapshot: + spec: * * * * * + cmd: | + php artisan schedule:run >> /dev/null 2>&1 +``` + +## Run cron jobs based on environment type + +To run a command in a cron hook for specific environment types, +use the `PLATFORM_ENVIRONMENT_TYPE` environment variable: + +```yaml {configFile="app"} +applications: + myapp: + [...] + crons: + snapshot: + spec: 0 5 * * * + cmd: | + # only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + php artisan schedule:run >> /dev/null 2>&1 + fi +``` + +## Run the Laravel scheduler every minute + +Cron job execution on the default {{< vendor/name >}} offering are limited to once every 5 minutes. +For more information, see the [documentation on crons](/create-apps/app-reference.html#crons). + +However, you can add a [worker](/create-apps/app-reference#workers) +and specify a start command that [runs the scheduler every minute](https://laravel.com/docs/11.x/scheduling#running-the-scheduler-locally). +To do so, use the following configuration: + +```yaml {configFile="app"} +applications: + [...] + {{< variable "APP_NAME" >}}: + [...] + workers: + scheduler: + commands: + start: | + php artisan schedule:work +``` + +{{< note title="Warning" theme="warning" >}} + +Web and worker containers don't share mount targets. +You can't share files between those containers using the filesystem. +To share data between containers, use [services](/add-services/_index.md). + +{{< /note >}} + +{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/laravel/blackfire.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/environment-variables.md b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md new file mode 100644 index 0000000000..6e2373a26c --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md @@ -0,0 +1,251 @@ +--- +title: "Environment Variables" +weight: -120 +description: | + Learn about the environment variables added by the {{% vendor/name %}} CLI. +--- + +By default, {{% vendor/name %}} exposes some [environment variables](/development/variables/use-variables#use-provided-variables). + +Laravel relies heavily on environment variables to configure application services (such as the database or the mailer). +Therefore, the default configuration generated by `{{% vendor/cli %}} project:init` includes +the [environment variables for all the services](#service-environment-variables) connected to your app in the `.environment` file. + +{{< note title="Tip" theme="info" >}} + +You can tweak the `.environment` configuration to fit your needs and add specific project-level variables.
+You may need a variable to change per environment. If so, use the `{{% vendor/cli %}} variable` command to add all the needed per-environment variables. + +{{< /note >}} + +## Default environment variables + +{{% vendor/name %}} automatically exposes [environment variables](/development/variables/use-variables#use-provided-variables) +about the app and its infrastructure. + +Assuming that MySQL, PostgreSQL, and Redis services have been added to your environment, +and that the app has been granted access to those services via the following [relationships](/create-apps/app-reference/single-runtime-image#relationships): + +```yaml {location=".upsun/config.yaml"} +applications: + myapp: + ... + relationships: + mysql: ... + postgresql: ... + redis: ... +``` + +You can transpose these variables to set up Laravel's default configuration in a `.environment` file: + +```bash {configFile="env"} +# Set MySQL database environment variables +export DB_HOST="$MYSQL_HOST" +export DB_PORT="$MYSQL_PORT" +export DB_PATH="$MYSQL_PATH" +export DB_USERNAME="$MYSQL_USERNAME" +export DB_PASSWORD="$MYSQL_PASSWORD" +export DB_SCHEME="$MYSQL_SCHEME" +export DATABASE_URL="${DB_SCHEME}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_PATH}" + +# Or for PostgreSQL +export DB_HOST="$POSTGRESQL_HOST" +export DB_PORT="$POSTGRESQL_PORT" +export DB_PATH="$POSTGRESQL_PATH" +export DB_USERNAME="$POSTGRESQL_USERNAME" +export DB_PASSWORD="$POSTGRESQL_PASSWORD" +export DB_SCHEME="$POSTGRESQL_SCHEME" +export DATABASE_URL="${DB_SCHEME}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_PATH}" + +# Set Laravel-specific environment variables +export DB_CONNECTION="$DB_SCHEME" +export DB_DATABASE="$DB_PATH" + +# Set Cache environment variables +export CACHE_HOST="$REDIS_HOST" +export CACHE_PORT="$REDIS_PORT" +export CACHE_SCHEME="$REDIS_SCHEME" +export CACHE_URL="${CACHE_SCHEME}://${CACHE_HOST}:${CACHE_PORT}" + +# Set Redis environment variables +export REDIS_URL="$CACHE_URL" +``` + +## Service environment variables + +Each exposed environment variable is prefixed by the relationship name. +For example, if you have the following relationships in your configuration: + +```yaml {configFile="app"} +relationships: + database: "securitydb:postgresql" +``` + +The environment variables for the database service is prefixed by `DATABASE_`, +which is the upper-cased version of the key defined in the relationship. +For example, you could have a `DATABASE_URL` environment variable. + +{{< note theme="warning" >}} + +Environment variables aren't exposed when the build hook script is running, +as services aren't available during the [build process](/learn/overview/build-deploy.md#the-build).
+To add specific variables available during the build, run `{{% vendor/cli %}} variable:create`. + +{{< /note >}} + +### Emails + +{{% vendor/name %}} provides a SMTP service for sending emails. +To configure email in Laravel, add the following mapping to your `.environment` file: + +```bash {configFile="env"} +# Email +export MAIL_MAILER="smtp" +export MAIL_HOST="${PLATFORM_SMTP_HOST}" +export MAIL_PORT="25" +``` + +### HTTP + +If your project has multiple apps, +the configuration is exposed via the following environment variables +(where `SOME_SERVICE` is the upper-cased version of the key defined in the relationship): + +- `SOME_SERVICE_URL`: The full URL of the service +- `SOME_SERVICE_IP`: The HTTP service IP +- `SOME_SERVICE_PORT`: The HTTP service port +- `SOME_SERVICE_SCHEME`: The HTTP service scheme +- `SOME_SERVICE_HOST`: The HTTP service host + +### MySQL/MariaDB + +The [MySQL/MariaDB](/add-services/mysql) configuration is exposed via the following environment variables +(where `DATABASE` is the upper-cased version of the key defined in the relationship above): + +- `DATABASE_URL`: The database URL (in PHP or Go format depending on your app) +- `DATABASE_SERVER`: The database server +- `DATABASE_DRIVER`: The database driver +- `DATABASE_VERSION`: The database version +- `DATABASE_HOST`: The database host +- `DATABASE_PORT`: The database port +- `DATABASE_NAME`: The database name +- `DATABASE_DATABASE`: Alias for `DATABASE_NAME` +- `DATABASE_USERNAME`: The database username +- `DATABASE_PASSWORD`: The database password + +{{< note title="Tip">}} + +The database version and a default charset are included in the database URL. +To override them, use the `DATABASE_VERSION` and `DATABASE_CHARSET` environment variables respectively. + +{{< /note >}} + +### PostgreSQL + +The [PostgreSQL](/add-services/postgresql) configuration is exposed via the following environment variables +(where `DATABASE` is the upper-cased version of the key defined in the relationship): + +- `DATABASE_URL`: The database URL (in PHP or Go format depending on your app) +- `DATABASE_SERVER`: The database server +- `DATABASE_DRIVER`: The database driver +- `DATABASE_VERSION`: The database version +- `DATABASE_HOST`: The database host +- `DATABASE_PORT`: The database port +- `DATABASE_NAME`: The database name +- `DATABASE_DATABASE`: Alias for `DATABASE_NAME` +- `DATABASE_USERNAME`: The database username +- `DATABASE_PASSWORD`: The database password + +{{< note title="Tip">}} + +The database version and a default charset are included in the database URL. +To override them, use the `DATABASE_VERSION` and `DATABASE_CHARSET` environment variables respectively. + +{{< /note >}} + +### Redis + +The [Redis](/add-services/redis) configuration is exposed via the following environment variables +(where `REDIS` is the upper-cased version of the key defined in the relationship): + +- `REDIS_URL`: The Redis URL +- `REDIS_HOST`: The Redis host +- `REDIS_PORT`: The Redis port +- `REDIS_SCHEME`: The Redis scheme + +You can specify the Redis client in your `.environment` file: + +```bash {configFile="env"} +export REDIS_CLIENT="phpredis" +``` + +### Memcached + +The [Memcached](/add-services/memcached) configuration is exposed via the following environment variables +(where `CACHE` is the upper-cased version of the key defined in the relationship): + +- `CACHE_HOST` +- `CACHE_PORT` +- `CACHE_IP` + +### Elasticsearch + +The [Elasticsearch](/add-services/elasticsearch) configuration is exposed via the following environment variables +(where `ELASTICSEARCH` is the upper-cased version of the key defined in the relationship): + +- `ELASTICSEARCH_URL`: The full URL of the Elasticsearch service +- `ELASTICSEARCH_HOST`: The Elasticsearch host +- `ELASTICSEARCH_PORT`: The Elasticsearch port +- `ELASTICSEARCH_SCHEME`: The Elasticsearch protocol scheme (`http` or `https`) + +### RabbitMQ + +The [RabbitMQ](/add-services/rabbitmq) configuration is exposed via the following environment variables +(where `RABBITMQ` is the upper-cased version of the key defined in the relationship): + +- `RABBITMQ_URL`: The RabbitMQ standardized URL +- `RABBITMQ_SERVER`: The RabbitMQ server +- `RABBITMQ_HOST`: The RabbitMQ host +- `RABBITMQ_PORT`: The RabbitMQ port +- `RABBITMQ_SCHEME`: The RabbitMQ scheme +- `RABBITMQ_USER`: The RabbitMQ username +- `RABBITMQ_USERNAME`: The RabbitMQ username +- `RABBITMQ_PASSWORD`: The RabbitMQ password + +### MongoDB + +The [MongoDB](/add-services/mongodb) configuration is exposed via the following environment variables +(where `MONGODB` is the upper-cased version of the key defined in the relationship): + +- `MONGODB_SERVER` +- `MONGODB_HOST` +- `MONGODB_PORT` +- `MONGODB_SCHEME` +- `MONGODB_NAME` +- `MONGODB_DATABASE` +- `MONGODB_USER` +- `MONGODB_USERNAME` +- `MONGODB_PASSWORD` + +### InfluxDB + +The [InfluxDB](/add-services/influxdb) configuration is exposed via the following environment variables +(where `TIMEDB` is the upper-cased version of the key defined in the relationship): + +- `TIMEDB_SCHEME` +- `TIMEDB_HOST` +- `TIMEDB_PORT` +- `TIMEDB_IP` + +### Kafka + +The [Apache Kafka](/add-services/kafka) configuration is exposed via the following environment variables +(where `KAFKA` is the upper-cased version of the key defined in the relationship): + +- `KAFKA_URL` +- `KAFKA_SCHEME` +- `KAFKA_HOST` +- `KAFKA_PORT` +- `KAFKA_IP` + +{{< guide-buttons previous="Back" next="Set up Redis" nextLink="/get-started/stacks/laravel/setup-redis.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/faq.md b/sites/upsun/src/get-started/stacks/laravel/faq.md new file mode 100644 index 0000000000..58c48c2ffc --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/faq.md @@ -0,0 +1,97 @@ +--- +title: "FAQ" +weight: 200 +description: | + Troubleshoot issue you might encounter using [Laravel](https://laravel.com/), a PHP framework on {{% vendor/name %}}. +--- + +## How can I access my application logs? + +To display the application log file (`app` file), run the following command: + +```bash +{{% vendor/cli %}} log app --tail +``` + +All the log messages generated by your app are sent to this `app` file. +This includes language errors such as PHP errors, warnings, notices, +as well as uncaught exceptions. + +The file also contains your application logs if you log on `stderr`. +This log doesn't include the default `laravel.log` located in `/storage`. + +{{% note %}} + +{{% vendor/name %}} manages the `app` file for you. +This is to prevent disks from getting filled and using very fast local drives instead of slower network disks. +Make sure your apps always output their logs to `stderr`. + +{{% /note %}} + +With Laravel, you can change your logging configuration to use `memory` and stream `php://stderr`. +In your `config/logging.php` file, add or update the following configuration: + +```php {location="config/logging.php"} +'memory' => [ + 'driver' => 'monolog', + 'handler' => Monolog\Handler\StreamHandler::class, + 'with' => [ + 'stream' => 'php://stderr', + ], + 'processors' => [ + // Simple syntax... + Monolog\Processor\MemoryUsageProcessor::class, + + // With options... + [ + 'processor' => Monolog\Processor\PsrLogMessageProcessor::class, + 'with' => ['removeUsedContextFields' => true], + ], + ], +], +``` + +{{< note theme="warning" title="Warning">}} + +If you log deprecations, make sure you **also** log them on `stderr`. + +{{< /note >}} + +## What's this "`Oops! An Error Occurred`" message about? + +The `Oops! An Error Occurred` message comes from your app and is automatically generated based on the Laravel error template. + +### The server returned a "`500 Internal Server Error`" + +If your app's working as expected locally but you see the previous error message on {{% vendor/name %}}, +it usually means you have a configuration error or a missing dependency. + +To fix this issue, search your application logs. +They likely contain an error message describing the root cause: + +```bash +{{% vendor/cli %}} logs all + [app] [14-Aug-2020 10:52:27 UTC] [critical] Uncaught PHP Exception Exception: [...] + [app] + [php.access] 2020-08-14T10:52:27Z GET 500 2.386 ms 2048 kB 419.11% / + [access] 78.247.136.119 - - [14/Aug/2020:10:52:27 +0000] "GET / HTTP/1.1" 500 843 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36" +``` + +If the error occurs on a preview environment, +or on the main environment of a non-production project, +you can also enable Laravel's dev/debug mode to inspect the cause of the error +via the `APP_DEBUG` [environment variable](./environment-variables.md) in your +`.environment` file or via [{{% vendor/cli %}} console](/development/variables): + +```bash +# Enable debug mode +export APP_DEBUG=1 +# Disable debug mode +export APP_DEBUG=0 +``` + +## Other issues + +For other issues unrelated to Laravel, see [Troubleshoot development](/development/troubleshoot.html). + +{{< guide-buttons previous="Back" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/get-started.md b/sites/upsun/src/get-started/stacks/laravel/get-started.md new file mode 100644 index 0000000000..7f45387e60 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/get-started.md @@ -0,0 +1,198 @@ +--- +title: Get started +weight: -255 +description: | + See how to get started deploying Laravel on {{% vendor/name %}}. +--- + +This guide provides instructions for deploying and working with Laravel on {{% vendor/name %}}. + +{{% guides/requirements name="Laravel" %}} + +## 1. Create your Laravel app + +1. To create a new Laravel project, run the following commands: + + ```bash {location="Terminal"} + composer create-project laravel/laravel:^11.0 {{< variable "PROJECT_NAME" >}} + cd {{< variable "PROJECT_NAME" >}} + git init . + ``` + + Alternatively, you can deploy an **existing Laravel project**. To do so, `cd` into your Laravel repository root folder. + +2. To generate a sensible default {{% vendor/name %}} configuration, + run the following command from within the project's directory: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:init + ``` + + The {{% vendor/name %}} CLI detects a PHP & Laravel stack. + Follow the prompts to specify a name for your project and select the needed services. + While optional, it is recommended to add [Redis](/add-services/redis.md) to your project to handle Laravel cache, queues & sessions. + + The `{{< vendor/configfile "app" >}}` and `.environment` configuration files are generated. + +3. Enable the PHP extensions required by the services you selected.
+ For example, `pdo_mysql` is enabled by default, but you may need to enable others like `redis` or `pdo_pgsql`: + + ```yaml {configFile="app"} + applications: + myapp: + ... + runtime: + extensions: + - redis + - pdo_pgsql + ``` + See all the [available PHP extensions](/languages/php/extensions.html). + +3. Laravel requires an [encryption key](https://laravel.com/docs/master/encryption#gracefully-rotating-encryption-keys).
+ To generate the key locally, run `php artisan key:generate`. + Copy the key from your local `.env` file into `.environment` as follows: + + ```bash {configFile="env"} + export APP_KEY="base64:{{< variable "APP_KEY" >}}" + ``` + +4. Add and commit your changes: + + ```bash {location="Terminal"} + git add {{< vendor/configfile "app" >}} .environment + git commit -m "Add {{% vendor/name %}} configuration" + ``` + +## 2. Create your {{% vendor/name %}} project + +To create a project on {{% vendor/name %}}, run the following command from within the project's directory: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:create --title {{< variable "PROJECT_TITLE" >}} --set-remote +``` + +The `--set-remote` flag sets the new project as the remote for this repository. + +{{< note title="Tip" >}} + +You can link any repository to an existing {{% vendor/name %}} project using the following command: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:set-remote {{< variable "PROJECT_ID" >}} +``` + +{{< /note >}} + +## 3. Deploy your project + +To deploy your project, run the following command: + +```bash {location="Terminal"} +{{% vendor/cli %}} push +``` + +During deployment, the logs from the {{% vendor/name %}} API are displayed in your terminal so you can monitor progress. +To stop the display of the logs **without interrupting the deployment**, +use `CTRL+C` in your terminal. +To go back to displaying the logs, run `{{% vendor/cli %}} activity:log`. + +Congratulations, your first Laravel app has been deployed on {{% vendor/name %}}! + +{{< note title="Tip" theme="info" >}} + +Now that your app is deployed in production mode, +you can [set up a custom domain](http://localhost:53846/domains/steps.html). +{{< /note >}} + +## 4. Configure write access + +The {{% vendor/name %}} default configuration stipulates three writable folders in `{{< vendor/configfile "app" >}}`: + +- `"/.config"` +- `"bootstrap/cache"` +- `"storage"` + +If your application writes content outside of these default ones, +you can [set up mounts](/create-apps/app-reference.html#mounts). + +## 5. Make changes to your project + +Now that your project is deployed, you can start making changes to it. +For example, you might want to fix a bug or add a new feature. + +In your project, the main branch always represents the production environment. +Other branches are for developing new features, fixing bugs, or updating the infrastructure. + +To make changes to your project, follow these steps: + +1. Create a new environment (a Git branch) to make changes without impacting production: + + ```bash {location="Terminal"} + {{% vendor/cli %}} branch feat-a + ``` + + This command creates a new local `feat-a` Git branch based on the main Git branch, + and activates a related environment on {{% vendor/name %}}. + The new environment inherits the data (service data and assets) of its parent environment (the production environment here). + +2. Make changes to your project. + + For example, edit the `resources/views/welcome.blade.php` template and make the following visual changes: + + ```html {location="resources/views/welcome.blade.php"} + + - Laravel + + Laravel On {{% vendor/name %}} + + ``` + +3. Add and commit your changes: + + ```bash {location="Terminal"} + add . + git commit -a -m "Update title" + ``` + +4. Deploy your changes to the `feat-a` environment: + + ```bash {location="Terminal"} + {{% vendor/cli %}} deploy + ``` + + Note that each environment has its own domain name. + To view the domain name of your new environment, run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} url --primary + ``` + +5. Iterate by changing the code, committing, and deploying. + When satisfied with your changes, merge them to the main branch, deploy, + and remove the feature branch: + + ```bash {location="Terminal"} + git checkout main + git merge feat-a + {{% vendor/cli %}} environment:delete feat-a + git branch -d feat-a + {{% vendor/cli %}} deploy + ``` + + Note that deploying to production is fast because the image built for the `feat-a` environment is reused. + + For a long running branch, keep the code up-to-date with the main branch by using `git merge main` or `git rebase main`. + Also, keep the data in sync with the production environment by using `{{% vendor/cli %}} env:sync`. + +## 6. Optional: Use a third-party Git provider + +When you choose to use a third-party Git hosting service, +the {{% vendor/name %}} Git repository becomes a read-only mirror of the third-party repository. +All your changes take place in the third-party repository. + +Add an integration to your existing third-party repository: + +- [BitBucket](/integrations/source/bitbucket.md) +- [GitHub](/integrations/source/github.md) +- [GitLab](/integrations/source/gitlab.md) + +{{< guide-buttons previous="Back" next="Environment variables" nextLink="/get-started/stacks/laravel/environment-variables.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md new file mode 100644 index 0000000000..81a69a138b --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md @@ -0,0 +1,96 @@ +--- +title: "Handle queues with Horizon" +weight: -118 +description: | + Setting up Laravel Horizon +--- + +[Laravel Horizon](https://laravel.com/docs/master/horizon#main-content) provides an appealing dashboard and code-driven configuration +for your Laravel powered Redis queues. +Horizon allows you to easily monitor key metrics of your queue system, +such as job throughput, runtime, and job failures. + +## 1. Add Laravel Horizon + +{{% note theme="warning" %}} +This procedure assumes you have followed the steps on [how to configure Redis and queues](./setup-redis.html#using-redis-for-laravel-queues). +{{% /note %}} + +1. To add Laravel Horizon, run the following command: + + ```bash {location="Terminal"} + composer require laravel/horizon && php artisan horizon:install + ``` + +2. Add the `install` command to your `build` hook in your app configuration, so it's run on every deploy. + + ```yaml {configFile="app"} + applications: + myapp: + [...] + hooks: + build: | + set -eux + composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev + php artisan horizon:install + ``` + +## 2. Create a worker to run Horizon + +To run Horizon on your project, you need to add a separate [worker](/create-apps/app-reference#workers). +To do so, use the following configuration: + +```yaml {configFile="app"} +applications: + [...] + {{< variable "APP_NAME" >}}: + [...] + workers: + horizon: + commands: + start: | + php artisan horizon +``` + +To enable the worker, push your changes to {{< vendor/name >}}: + +```bash {location="Terminal"} +git add . +git commit -m "Enable Laravel Horizon" +{{< vendor/cli >}} push +``` + +A new container is started automatically. +It will spawn the Horizon process after the next deploy. + +## 3. Access your Horizon dashboard + +If you have restricted access to Horizon in your `HorizonServiceProvider.php`, +log in to your app through the web. +Then, go to `/horizon` to access your Horizon dashboard. + +![Laravel Horizon Dashboard](/images/guides/laravel/horizon-dashboard.png "0.5") + +## 4. Optional: Customize Horizon + +Horizon handles jobs that are populated by the queue. +If you need to customize how Horizon works (queues, processes, etc.), +see the official [Laravel Horizon documentation](https://laravel.com/docs/master/horizon#main-content). + +{{< note title="Warning" theme="warning" >}} + +Web and worker containers don't share mount targets. +You can't share files between those containers using the filesystem. +To share data between containers, use [services](/add-services/_index.md). + +See more information on [workers](/create-apps/app-reference#workers). + +{{< /note >}} + +Note that you can customize the resources of your Horizon worker container from the {{% vendor/name %}} Console. + +![Laravel Horizon Resources](/images/guides/laravel/horizon-resources.png "0.5") + +For more information, see how to [configure resources](/manage-resources/adjust-resources.md). + +{{< guide-buttons previous="Back" next="Set up cron jobs" nextLink="/get-started/stacks/laravel/crons.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md b/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md new file mode 100644 index 0000000000..d4d1208979 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md @@ -0,0 +1,77 @@ +--- +title: "Debug with Laravel Telescope" +weight: -87 +description: | + Setting up Laravel Telescope for debugging Laravel +--- + +Laravel Telescope complements your local Laravel development environment. +With Telescope, get insight into the requests coming into your app, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more. + +To set up Laravel Telescope on your **non-production** environments, +follow these steps. + +## 1. Create the APP_DEBUG variable + +To add the `APP_DEBUG` & `TELESCOPE_ENABLED` variables on your project, run the following commands: + +```bash {location="Terminal"} +{{< vendor/cli >}} variable:create --level environment --name env:APP_DEBUG --value false +{{< vendor/cli >}} variable:create --level environment --name env:TELESCOPE_ENABLED --value false +``` + +Note that the default values for your main environment are set to `false`. +To override them on other non-production environments, run the following commands: + +```bash {location="Terminal"} +{{< vendor/cli >}} variable:update -e {{< variable "ENVIRONMENT" >}} --value true env:APP_DEBUG +{{< vendor/cli >}} variable:update -e {{< variable "ENVIRONMENT" >}} --value true env:TELESCOPE_ENABLED +``` + +## 2. Add Telescope to your project + +1. Run the following Composer command: + + ```bash {location="Terminal"} + composer require laravel/telescope && php artisan telescope:install + ``` + +2. Add the `install` command to your `build` hook in your app configuration, + so it's run on every deploy. + + ```yaml {configFile="app"} + applications: + myapp: + [...] + hooks: + build: | + set -eux + composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev + php artisan telescope:install + ``` + +For more options and information on how to manage authentication for the dashboard, +see the [Laravel Telecope documentation](https://laravel.com/docs/master/telescope#installation). + +## 3. Deploy the new release + +To enable Telescope, push your changes to {{% vendor/name %}}: + +```bash {location="Terminal"} +git add . +git commit -m "Enable Laravel Horizon" +{{< vendor/cli >}} push +``` + +You can now access the `/telescope` endpoint of your app. + +![Laravel Horizon Dashboard](/images/guides/laravel/telescope-dashboard.png "0.5") + +{{< note theme="tip" >}} + +Telescope uses a gate defined in `TelescopeServiceProvider.php` to authorize access to the dashboard. +Check that the logic here matches your needs. + +{{< /note >}} + +{{< guide-buttons previous="Back" next="FAQ" nextLink="/get-started/stacks/laravel/faq.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md new file mode 100644 index 0000000000..114280874a --- /dev/null +++ b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md @@ -0,0 +1,97 @@ +--- +title: "Set up Redis" +weight: -119 +description: | + Setting up Redis for cache, sessions & queues +--- + +With Laravel, you can use Redis to handle session storage, cache storage, and queues. + +## 1. Add the Redis service + +1. [Add the service](/add-services.md#add-a-service) to your app configuration using the `services` top-level key: + + ```yaml {configFile="app"} + services: + [...] + redis: + type: redis:7.0 + ``` + +2. To connect the service to your app, add the following relationship: + + ```yaml {configFile="app"} + applications: + myapp: + [...] + relationships: + redis: "redis:redis" + + services: + [...] + redis: + type: redis:7.0 + ``` + +## 2. Configure your Redis service + +The [Redis](/add-services/redis) configuration is exposed via the following environment variables +(where `REDIS` is the upper-cased version of the key defined in the relationship): + +- `REDIS_URL`: The Redis URL +- `REDIS_HOST`: The Redis host +- `REDIS_PORT`: The Redis port +- `REDIS_SCHEME`: The Redis scheme + +If the relationship is named `redis`, Laravel automatically detects these variables and configure its own Redis driver the right way. +If not, you can map the variables in the `.environment` file. + +You can specify the Redis client in your `.environment` file: + +```bash {configFile="env"} +export REDIS_CLIENT="phpredis" +``` + +{{< note theme="warning" >}} + +If using `phpredis`, make sure you add `redis` in the list of PHP `runtime` extensions in your `{{< vendor/configfile "app" >}}`: + +```yaml {configFile="app"} +applications: + myapp: + [...] + runtime: + extensions: + - redis +``` + +{{< /note >}} + +## 3. Store the Laravel cache in Redis + +To enable cache storage in Redis, add the following environment variable to your `.environment` file: + +```bash {configFile="env"} +export CACHE_STORE="redis" +``` + +## 4. Store Laravel sessions in Redis + +Laravel relies on the `SESSION_DRIVER` variable to store sessions. Therefore, add the following environment variable to your `.environment` file: + +```bash {configFile="env"} +export SESSION_DRIVER="redis" +``` + +## 5. Use Redis for Laravel queues + +For a basic queueing system, configure the `QUEUE_CONNECTION` in your `.environment` file as follows: + +```bash {configFile="env"} +export QUEUE_CONNECTION="redis" +``` + +For more information, see the [Laravel Queues documentation](https://laravel.com/docs/master/queues) +and {{% vendor/name %}}'s [Horizon configuration page](./laravel-horizon). + +{{< guide-buttons previous="Back" next="Handle queues with Horizon" nextLink="/get-started/stacks/laravel/laravel-horizon.md" type="*" >}} \ No newline at end of file diff --git a/sites/upsun/src/get-started/stacks/nextjs.md b/sites/upsun/src/get-started/stacks/nextjs.md new file mode 100644 index 0000000000..b0f2c03ba6 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/nextjs.md @@ -0,0 +1,345 @@ +--- +title: Deploying Next.js on {{% vendor/name %}} +sidebarTitle: Next.js +weight: -97 +layout: single +description: | + Complete the last required steps to successfully deploy Next.js on {{% vendor/name %}}. +--- + +{{< note title="Note" theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +{{% guides/requirements name="Next.js" %}} + +## 1. Create a Next.js app + +To create your Next.js app, follow these steps. + +1. Follow the Next.js [installation guide](https://nextjs.org/docs/getting-started/installation). + To fast track the process, run the following commands: + + ```bash {location="Terminal"} + npx create-next-app@latest + ``` + +2. To initialize the local Git repository and commit local files, run the following commands: + + ```bash {location="Terminal"} + cd my-app + git init + git add . + git commit -m "Init Next.js application." + ``` + +{{< note theme="info" >}} +You can view the running app locally by running `npm run dev`. +{{< /note >}} + +## 2. Create a new project + +To create a project on {{% vendor/name %}}, +follow these steps. + +{{< note title="Remember" >}} +After creating your {{% vendor/name %}} project, copy your new **project ID** for later use. +{{< /note >}} + +{{< codetabs >}} ++++ +title=Using the CLI ++++ +To create a new project with the {{% vendor/name %}} CLI, use the following command and follow the prompts: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:create +``` + +{{< note >}} + +When creating a new project using the {{% vendor/name %}} CLI command `project:create`, +you are asked if you want to set the local remote to your new project. Enter **Yes (y)**. + +Your local source code is automatically linked to your newly created {{% vendor/name %}} project +through the creation of a `.{{% vendor/cli %}}/local/project.yaml`. +This file contains the corresponding `` for the {{% vendor/name %}} CLI to use, +and sets a Git remote to `{{% vendor/cli %}}`. + +{{< /note >}} + +<---> ++++ +title=Using the Console ++++ + +1. Create an organization or select an existing one. + +2. Click **Create from scratch**. + +3. Fill in details like the project name and [region](/development/regions.md). + + {{% note %}} + + You can define resources for your project later on, after your first push. + + {{% /note %}} + +4. To link your local source code to your new {{% vendor/name %}} project, + run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:set-remote + ``` + + This command adds a new remote called `{{% vendor/cli %}}` to your local Git repository, + which is equivalent to the following commands: + + ```bash {location="Terminal"} + git remote + origin + {{% vendor/cli %}} + ``` + + It also creates a new `.{{% vendor/cli %}}/local/project.yaml` file that contains the `` + for the `{{% vendor/cli %}}` CLI to use. + + {{< note theme="info" title="Tip" >}} + + If you forget your ``, run the following command and find your project in the list: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:list + ``` + {{< /note >}} + +{{< /codetabs >}} + +## 3. Choose your Git workflow + +You can use {{% vendor/name %}} projects as a classic Git repository, +where you are able to push your source code in different ways, +using either the Git CLI or the {{% vendor/name %}} CLI. +You can choose which way —or Git workflow— you want to use for your project from the following options: + +- Your project source code is **hosted on a {{% vendor/name %}} Git repository** +- Your project source code is **hosted on your own GitHub repository** + +{{< codetabs >}} ++++ +title={{% vendor/name %}} Git repository ++++ +For the rest of this guide, you will use the normal Git workflow (`git add . && git commit -m "message" && git push {{% vendor/cli %}}`) to commit your source code changes to Git history. +You will also use the {{% vendor/name %}} CLI to deploy your [{{% vendor/name %}} environment](/environments.html) with the latest code updates. + +<---> ++++ +title=GitHub repository ++++ +{{% vendor/name %}} provides a [Github integration](integrations/source/github.md) that allows your {{% vendor/name %}} project to be fully integrated with your Github repository. +This enables you, as a developer, to use a normal Git workflow (`git add . && git commit -m "message" && git push`) to deploy your environment—with no need to connect to the {{% vendor/name %}} Console. + +{{< note >}} +Make sure you complete the following steps before adding a [Github integration](integrations/source/github.md): + +1. Create a Git repository in your own organization following the relevant + [Github repository creation guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository). + +2. Create a [Github integration](integrations/source/github.md). + +3. Add a Git remote to your local project, from the root of your Next.js directory.
+ To do so, run the following commands: + + ```bash {location="Terminal"} + git remote add origin + git add . && git commit -m "init next.js" + git push origin + ``` +{{< /note >}} + +{{< /codetabs >}} + +## 4. Configure your project + +To host your Next.js application on {{% vendor/name %}}, +you need to have a few YAML configuration files at the root of your project. +These files manage your app's behavior. +They are located in a `.{{% vendor/cli %}}/` folder at the root of your source code +and structured in a similar way to this: + +```txt +my-express-app +├── .{{% vendor/cli %}} +│ └── config.yaml +├── [.environment] +└── +``` + +To generate these files, run the following command at the root of your project: + +``` {location="Terminal"} +{{% vendor/cli %}} project:init +``` + +Follow the prompts. + +To commit your new files, run the following commands: + +```bash {location="Terminal"} +git add . +git commit -m "Add {{% vendor/name %}} config files" +``` + +## 5. Deploy + +And just like that, it’s time to deploy! + +Depending on the Git workflow you chose at the beginning of this tutorial, +there are two ways to deploy your source code changes. + +{{< codetabs >}} + ++++ +title=Using {{% vendor/name %}} Git repository ++++ + +You can push your code using the normal Git workflow (`git add . && git commit -m "message" && git push`). +This pushes your source code changes to your `{{% vendor/cli %}}` remote repository. +Alternatively, you can use the following {{% vendor/name %}} CLI command: + +```bash {location="Terminal"} +{{% vendor/cli %}} push +``` + +<---> ++++ +title=Using third-party Git repository ++++ + +When you choose to use a third-party Git hosting service, the {{< vendor/name >}} Git +repository becomes a read-only mirror of the third-party repository. All your +changes take place in the third-party repository. + +Add an integration to your existing third-party repository: + +- [BitBucket](/integrations/source/bitbucket.md) +- [GitHub](/integrations/source/github.md) +- [GitLab](/integrations/source/gitlab.md) + +If you are using an integration, on each code updates, +use the normal Git workflow (`git add . && git commit -m "message" && git push`) to push your code to your external repository. +To do so, run the following command: + +```bash {location="Terminal"} +git push origin +``` + +Your GitHub, GitLab, or Bibucket integration process then automatically deploys changes to your environment. +If you're pushing a new Git branch, a new environment is created. + +{{< /codetabs >}} + +{{% vendor/name %}} then reads your configuration files, +and deploys your project using [default container resources](/manage-resources/resource-init.md). +If you don't want to use those default resources, +define your own [resource initialization strategy](/manage-resources/resource-init.md#define-a-resource-initialization-strategy), +or [amend those default container resources](/manage-resources/adjust-resources.md) after your project is deployed. + +Et voilà, your Next.js application is live! + +{{< note title="Tip" theme="info" >}} + +Each environment has its own domain name. +To open the URL of your new environment, run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} environment:url --primary + ``` +{{< /note >}} + +## 6. Make changes to your project + +Now that your project is deployed, you can start making changes to it. +For example, you might want to fix a bug or add a new feature. + +In your project, the `main` branch always represents the production environment. +Other branches are for developing new features, fixing bugs, or updating the infrastructure. + +To make changes to your project, follow these steps: + +1. Create a new environment (a Git branch) to make changes without impacting production: + + ```bash {location="Terminal"} + {{% vendor/cli %}} branch feat-a + ``` + + This command creates a new local `feat-a` Git branch based on the main Git branch, + and activates a related environment on {{< vendor/name >}}. + The new environment inherits the data (service data and assets) of its parent environment (the production environment here). + +2. Make changes to your project. + For example, edit the `views/index.jade` file and make the following changes: + + ```diff + diff --git a/views/index.jade b/views/index.jade + index 3d63b9a..77aee43 100644 + --- a/views/index.jade + +++ b/views/index.jade + @@ -2,4 +2,4 @@ extends layout + + block content + h1= title + - p Welcome to #{title} + + p Welcome to #{title} on {{% vendor/name %}} + `` + +3. Commit your changes: + + ```bash {location="Terminal"} + git add views/index.jade + git commit -m "Update index page view." + ``` + +4. Deploy your changes to the `feat-a` environment: + + ```bash {location="Terminal"} + {{% vendor/cli %}} push + ``` + +5. Iterate by changing the code, committing, and deploying. + When satisfied with your changes, merge them to the main branch, + and remove the feature branch: + + ```bash {location="Terminal"} + {{% vendor/cli %}} merge + Are you sure you want to merge feat-a into its parent, main? [Y/n] y + {{% vendor/cli %}} checkout main + git pull {{% vendor/cli %}} main + {{% vendor/cli %}} environment:delete feat-a + git fetch --prune + ``` + + Note that deploying to production is fast because the image built for the `feat-a` environment is reused. + + For a long running branch, to keep the code up-to-date with the main branch, use `git merge main` or `git rebase main`. + You can also keep the data in sync with the production environment by using `{{% vendor/cli %}} env:sync`. + +## Further resources + +### Documentation + +- [JavaScript/Node.js documentation](/languages/nodejs/) +- [Managing dependencies](/languages/nodejs#dependencies) + +### Community content + +- [Next.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=nextjs) +- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) +- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) + +### Blogs + +- [A quick-start guide on hosting Next.js on {{% vendor/name %}}](https://upsun.com/blog/setting-up-next-js-on-upsun/) diff --git a/sites/upsun/src/get-started/stacks/strapi/_index.md b/sites/upsun/src/get-started/stacks/strapi/_index.md new file mode 100644 index 0000000000..c6e7b976ec --- /dev/null +++ b/sites/upsun/src/get-started/stacks/strapi/_index.md @@ -0,0 +1,402 @@ +--- +title: Deploying Strapi on {{% vendor/name %}} +sidebarTitle: Strapi +weight: -90 +layout: single +description: | + Complete the last required steps to successfully deploy Strapi on {{% vendor/name %}}. +--- + +{{< note title="Note" theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md). +They provide all of the core concepts and common commands you need to know before using the materials below. + +{{< /note >}} + +{{% guides/requirements name="Strapi" %}} + +## 1. Create a Strapi project + +To create your Strapi app, follow these steps. + +1. Follow the Strapi [installation guide](https://docs.strapi.io/dev-docs/installation).
+ To fast track the process, run the following commands: + + ```bash {location="Terminal"} + npx create-strapi-app@latest my-strapi-project --quickstart --no-run + ``` + + {{< note >}} + If the `create-strapi-app` script fails, run `export SHARP_IGNORE_GLOBAL_LIBVIPS=true`, + remove the previous attempt (`rm -rf my-strapi-project`), and run the command again. + {{< /note >}} + +2. To initialize the local Git repository and commit local files, run the following commands: + + ```bash {location="Terminal"} + cd my-strapi-project + git init + echo "\nhttp:" >> .gitignore + git add . + git commit -m "Init Strapi application." + ``` + + {{< note >}} + You can view the running app locally by running `yarn develop`. + The local server will be visible at `localhost:1337`. + You can create your first administrator user locally, but you will have to recreate that user once you've deployed to {{% vendor/name %}}. + {{< /note >}} + +## 2. Create a new project + +To create a project on {{% vendor/name %}}, +follow these steps. + +{{< note title="Remember" >}} +After creating your {{% vendor/name %}} project, copy your new **project ID** for later use. +{{< /note >}} + +{{< codetabs >}} ++++ +title=Using the CLI ++++ +To create a new project with the {{% vendor/name %}} CLI, use the following command and follow the prompts: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:create +``` + +{{< note >}} + +When creating a new project using the {{% vendor/name %}} CLI command `project:create`, +you are asked if you want to set the local remote to your new project. Enter **Yes (y)**. + +Your local source code is automatically linked to your newly created {{% vendor/name %}} project +through the creation of a `.{{% vendor/cli %}}/local/project.yaml`. +This file contains the corresponding `` for the {{% vendor/name %}} CLI to use, +and sets a Git remote to `{{% vendor/cli %}}`. + +{{< /note >}} + +<---> ++++ +title=Using the Console ++++ + +1. Create an organization or select an existing one. + +2. Click **Create from scratch**. + +3. Fill in details like the project name and [region](/development/regions.md). + + {{% note %}} + + You can define resources for your project later on, after your first push. + + {{% /note %}} + +4. To link your local source code to your new {{% vendor/name %}} project, + run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:set-remote + ``` + + This command adds a new remote called `{{% vendor/cli %}}` to your local Git repository, + which is equivalent to the following commands: + + ```bash {location="Terminal"} + git remote + origin + {{% vendor/cli %}} + ``` + + It also creates a new `.{{% vendor/cli %}}/local/project.yaml` file that contains the `` + for the `{{% vendor/cli %}}` CLI to use. + + {{< note theme="info" title="Tip" >}} + + If you forget your ``, run the following command and find your project in the list: + + ```bash {location="Terminal"} + {{% vendor/cli %}} project:list + ``` + {{< /note >}} + +{{< /codetabs >}} + +## 3. Choose your Git workflow + +You can use {{% vendor/name %}} projects as a classic Git repository, +where you are able to push your source code in different ways, +using either the Git CLI or the {{% vendor/name %}} CLI. +You can choose which way —or Git workflow— you want to use for your project from the following options: + +- Your project source code is **hosted on a {{% vendor/name %}} Git repository** +- Your project source code is **hosted on your own GitHub repository** + +{{< codetabs >}} ++++ +title={{% vendor/name %}} Git repository ++++ +For the rest of this guide, you will use the normal Git workflow (`git add . && git commit -m "message" && git push {{% vendor/cli %}}`) to commit your source code changes to Git history. +You will also use the {{% vendor/name %}} CLI to deploy your [{{% vendor/name %}} environment](/environments.html) with the latest code updates. + +<---> ++++ +title=GitHub repository ++++ +{{% vendor/name %}} provides a [Github integration](integrations/source/github.md) that allows your {{% vendor/name %}} project to be fully integrated with your Github repository. +This enables you, as a developer, to use a normal Git workflow (`git add . && git commit -m "message" && git push`) to deploy your environment—with no need to connect to the {{% vendor/name %}} Console. + +{{< note >}} +Make sure you complete the following steps before adding a [Github integration](integrations/source/github.md): + +1. Create a Git repository in your own organization following the relevant [Github repository creation guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository). +2. Create a [Github integration](integrations/source/github.md). +3. Add a Git remote to your local project, from the root of your Strapi directory.
+ To do so, run the following commands: + + ```bash {location="Terminal"} + git remote add origin + git add . && git commit -m "init strapi" + git push origin + ``` +{{< /note >}} + +{{< /codetabs >}} + +## 4. Configure your project + +To host your Strapi application on {{% vendor/name %}}, +you need to have a few YAML configuration files at the root of your project. +These files manage your app's behavior. +They are located in a `.{{% vendor/cli %}}/` folder at the root of your source code +and structured in a similar way to this: + +```txt +my-strapi-project +├── .{{% vendor/cli %}} +│ └── config.yaml +├── [.environment] +└── +``` + +To generate these files, run the following command at the root of your project: + +``` {location="Terminal"} +{{% vendor/cli %}} project:init +``` + +Follow the prompts. + +To commit your new files, run the following commands: + +```bash {location="Terminal"} +git add . +git commit -m "Add {{% vendor/name %}} config files" +``` + +## 5. Deploy + +And just like that, it’s time to deploy! + +Depending on the Git workflow you chose at the beginning of this tutorial, +there are two ways to deploy your source code changes. + +{{< codetabs >}} + ++++ +title=Using {{% vendor/name %}} Git repository ++++ + +You can push your code using the normal Git workflow (`git add . && git commit -m "message" && git push`). This pushes your source code changes to your `{{% vendor/cli %}}` remote repository. Alternatively, you can use the following {{% vendor/name %}} CLI command: + +```bash {location="Terminal"} +{{% vendor/cli %}} push +``` + +<---> ++++ +title=Using a third-party Git repository ++++ + +When you choose to use a third-party Git hosting service, the {{< vendor/name >}} Git +repository becomes a read-only mirror of the third-party repository. All your +changes take place in the third-party repository. + +Add an integration to your existing third-party repository: + +- [BitBucket](/integrations/source/bitbucket.md) +- [GitHub](/integrations/source/github.md) +- [GitLab](/integrations/source/gitlab.md) + +If you are using an integration, on each code updates, +use the normal Git workflow (`git add . && git commit -m "message" && git push`) to push your code to your external repository. +To do so, run the following command: + +```bash {location="Terminal"} +git push origin +``` + +Your GitHub, GitLab, or Bibucket integration process then automatically deploys changes to your environment. +If you're pushing a new Git branch, a new environment is created. + +{{< /codetabs >}} + +{{% vendor/name %}} then reads your configuration files, +and deploys your project using [default container resources](/manage-resources/resource-init.md). +If you don't want to use those default resources, +define your own [resource initialization strategy](/manage-resources/resource-init.md#define-a-resource-initialization-strategy), +or [amend those default container resources](/manage-resources/adjust-resources.md) after your project is deployed. + +Et voilà, your Strapi application is live! + +{{< note title="Tip" theme="info" >}} + +Each environment has its own domain name. +To open the URL of your new environment, run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} environment:url --primary + ``` +{{< /note >}} + +## 6. Make changes to your project + +Now that your project is deployed, you can start making changes to it. +For example, you might want to fix a bug or add a new feature. + +In your project, the `main` branch always represents the production environment. +Other branches are for developing new features, fixing bugs, or updating the infrastructure. + +To make changes to your project, follow these steps: + +1. Create a new environment (a Git branch) to make changes without impacting production: + + ```bash {location="Terminal"} + {{% vendor/cli %}} branch feat-a + ``` + + This command creates a new local `feat-a` Git branch based on the main Git branch, + and activates a related environment on {{< vendor/name >}}. + The new environment inherits the data (service data and assets) of its parent environment (the production environment here). + +2. Make changes to your project.
+ For example, you can create a new API and Collection (Content Type). + To do so, run the following command: + + ```bash {location="Terminal"} + npm run strapi -- generate content-type + ``` + + Then follow the prompts to set up the `Blog` API containing an `Article` Content Type (Collection): + + ```bash {location="Suggested responses"} + ? Content type display name Article + ? Content type singular name article + ? Content type plural name articles + ? Please choose the model type Collection Type + ? Use draft and publish? Yes + ? Do you want to add attributes? Yes + ? Name of attribute title + ? What type of attribute string + ? Do you want to add another attribute? Yes + ? Name of attribute body + ? What type of attribute richtext + ? Do you want to add another attribute? Yes + ? Name of attribute image + ? What type of attribute media + ? Choose media type Single + ? Do you want to add another attribute? No + ? Where do you want to add this model? Add model to new API + ? Name of the new API? blog + ? Bootstrap API related files? Yes + ✔ ++ /api/blog/content-types/article/schema.json + ✔ +- /api/blog/content-types/article/schema.json + ✔ ++ /api/blog/controllers/article.js + ✔ ++ /api/blog/services/article.js + ✔ ++ /api/blog/routes/article.js + ``` + + Verify that the new `Article` collection has been created. + To do so, run the local server (`yarn develop`) again, + and visit [http://localhost:1337/admin/content-manager](http://localhost:1337/admin/content-manager). + + This results in the following changes: + + ```bash + $ git status + On branch feat-a + Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: types/generated/contentTypes.d.ts + + Untracked files: + (use "git add ..." to include in what will be committed) + src/api/blog/ + + no changes added to commit (use "git add" and/or "git commit -a") + ``` + +3. Commit your changes: + + ```bash {location="Terminal"} + git add . + git commit -m "Add Article collection" + ``` + +4. Deploy your changes to the `feat-a` environment: + + ```bash {location="Terminal"} + {{% vendor/cli %}} push + ``` + + {{< note title="Tip" theme="info" >}} + + Note that each environment has its own domain name. + To open the URL of your new environment, run the following command: + + ```bash {location="Terminal"} + {{% vendor/cli %}} environment:url --primary + ``` + + {{< /note >}} + +5. Iterate by changing the code, committing, and deploying.
+ When satisfied with your changes, merge them to the main branch, + and remove the feature branch: + + ```bash {location="Terminal"} + {{% vendor/cli %}} merge + Are you sure you want to merge feat-a into its parent, main? [Y/n] y + {{% vendor/cli %}} checkout main + git pull {{% vendor/cli %}} main + {{% vendor/cli %}} environment:delete feat-a + git fetch --prune + ``` + + Note that deploying to production is fast because the image built for the `feat-a` environment is reused. + + For a long running branch, to keep the code up-to-date with the main branch, use `git merge main` or `git rebase main`. + You can also keep the data in sync with the production environment by using `{{% vendor/cli %}} env:sync`. + +## Further resources + +### Documentation + +- [JavaScript/Node.js documentation](/languages/nodejs/) +- [Managing dependencies](/languages/nodejs#dependencies) +- [Add a database to Strapi](/get-started/stacks/strapi/add-database) + +### Community content + +- [Strapi topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=strapi) +- [Node.js topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=node) +- [JavaScript topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=js) + +### Blogs + +- [Up(sun) and running with Strapi: a seamless journey to a powerful decoupled headless CMS](https://upsun.com/blog/strapi-deployment-on-upsun/) diff --git a/sites/upsun/src/get-started/stacks/strapi/add-database.md b/sites/upsun/src/get-started/stacks/strapi/add-database.md new file mode 100644 index 0000000000..07730176ff --- /dev/null +++ b/sites/upsun/src/get-started/stacks/strapi/add-database.md @@ -0,0 +1,229 @@ +--- +title: "Add a database" +weight: -130 +description: | + Once Your Strapi application has been deployed on {{% vendor/name %}}, you might want to add and configure a service to your application. +--- + +{{% description %}} + +This guide will show you how to provision and connect to two different databases on {{% vendor/name %}}: + +- PostgreSQL +- Oracle MySQL + +## 1. Branch + +Like all updates to your {{% vendor/name %}} projects, first create a new dedicated environment to test this change. + +```bash +git checkout -b upgrade-db +``` + +## 2. Install the Node.js package + +{{< codetabs >}} ++++ +title=PostgreSQL ++++ +```bash +yarn add pg +``` +<---> + ++++ +title=Oracle MySQL ++++ +```bash +yarn add mysql +``` +{{< /codetabs >}} + +## 3. Add a new service + +Add a new service to your `.upsun/config.yaml` file: + +{{< codetabs >}} ++++ +title=PostgreSQL ++++ +```yaml {location=".upsun/config.yaml"} +applications: + my-strapi-project: + source: + root: "/" + type: "nodejs:20" + + [...] + +services: + database: + type: postgresql:{{% latest "postgresql" %}} +``` +<---> + ++++ +title=Oracle MySQL ++++ +```yaml {location=".upsun/config.yaml"} +applications: + my-strapi-project: + source: + root: "/" + type: "nodejs:20" + + [...] + +services: + database: + type: oracle-mysql:{{% latest "oracle-mysql" %}} +``` +{{< /codetabs >}} + +## 4. Add a new relationship + +Add a new relationship to your `.upsun/config.yaml` file to allow access to the new service + +{{< codetabs >}} ++++ +title=PostgreSQL ++++ +```yaml {location=".upsun/config.yaml"} +applications: + my-strapi-project: + source: + root: "/" + type: "nodejs:20" + + [...] + + relationships: + database: "database:postgresql" + +services: + database: + type: postgresql:{{% latest "postgresql" %}} +``` +<---> + ++++ +title=Oracle MySQL ++++ +```yaml {location=".upsun/config.yaml"} +applications: + my-strapi-project: + source: + root: "/" + type: "nodejs:20" + + [...] + + relationships: + database: "database:mysql" + +services: + database: + type: oracle-mysql:{{% latest "oracle-mysql" %}} +``` +{{< /codetabs >}} + +## 5. Update `.environment` + +When you previously ran `upsun project:init`, the command generated some Strapi-specific environment variables: + +```bash {location=".environment"} +# Set Strapi-specific environment variables +export DATABASE_HOST="$DB_HOST" +export DATABASE_PORT="$DB_PORT" +export DATABASE_NAME="$DB_PATH" +export DATABASE_USERNAME="$DB_USERNAME" +export DATABASE_PASSWORD="$DB_PASSWORD" +export DATABASE_SCHEME="$DB_SCHEME" + +# Set secrets needed by Strapi, if they are not set +# Prefer setting these as project secret variables with {{% vendor/cli %}} variable:create env:SECRET_NAME --sensitive=true +if [[ -z "$ADMIN_JWT_SECRET" ]]; then + export ADMIN_JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$JWT_SECRET" ]]; then + export JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$API_TOKEN_SALT" ]]; then + export API_TOKEN_SALT="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$APP_KEYS" ]]; then + export APP_KEYS="$PLATFORM_PROJECT_ENTROPY" +fi +``` + +{{% vendor/name %}} will actually generate service credentials automatically for you in the runtime container, so we don't need the first half of this file anymore. +Remove the first block (pertaining to `DATABASE` credentials). + +Then, add a single additional variable that will set the `DATABASE_CLIENT` variable at the appropriate time: + +{{< codetabs >}} ++++ +title=PostgreSQL ++++ +```bash {location=".environment"} +# Set secrets needed by Strapi, if they are not set +# Prefer setting these as project secret variables with {{% vendor/cli %}} variable:create env:SECRET_NAME --sensitive=true +if [[ -z "$ADMIN_JWT_SECRET" ]]; then + export ADMIN_JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$JWT_SECRET" ]]; then + export JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$API_TOKEN_SALT" ]]; then + export API_TOKEN_SALT="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$APP_KEYS" ]]; then + export APP_KEYS="$PLATFORM_PROJECT_ENTROPY" +fi + +# Switch to configure to the production database service _only_ at deploy time. +if [[ -z "$PLATFORM_ENVIRONMENT" ]]; then + export DATABASE_CLIENT="postgres" +fi +``` +<---> + ++++ +title=Oracle MySQL ++++ +```bash {location=".environment"} +# Set secrets needed by Strapi, if they are not set +# Prefer setting these as project secret variables with {{% vendor/cli %}} variable:create env:SECRET_NAME --sensitive=true +if [[ -z "$ADMIN_JWT_SECRET" ]]; then + export ADMIN_JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$JWT_SECRET" ]]; then + export JWT_SECRET="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$API_TOKEN_SALT" ]]; then + export API_TOKEN_SALT="$PLATFORM_PROJECT_ENTROPY" +fi +if [[ -z "$APP_KEYS" ]]; then + export APP_KEYS="$PLATFORM_PROJECT_ENTROPY" +fi + +# Switch to configure to the production database service _only_ at deploy time. +if [[ -z "$PLATFORM_ENVIRONMENT" ]]; then + export DATABASE_CLIENT="mysql" +fi +``` +{{< /codetabs >}} + +## 6. Push to the environment + +Commit and push the changes to the {{% vendor/name %}} environment: + +```bash +git commit -am "Add a new service" +git push origin upgrade-db +``` + +{{< note theme="info">}} +If you are using {{% vendor/name %}} as your primary remote, you can use the `{{% vendor/cli %}} branch` and `{{% vendor/cli %}} push` commands directly. +If instead you had already set up an integration to GitHub, GitLab or Bitbucket, make sure to open a pull/merge request to judge the revision. +{{< /note >}} diff --git a/sites/friday/src/get-started/stacks/symfony/_index.md b/sites/upsun/src/get-started/stacks/symfony/_index.md similarity index 89% rename from sites/friday/src/get-started/stacks/symfony/_index.md rename to sites/upsun/src/get-started/stacks/symfony/_index.md index 9d335d990f..39cf7f3ebd 100644 --- a/sites/friday/src/get-started/stacks/symfony/_index.md +++ b/sites/upsun/src/get-started/stacks/symfony/_index.md @@ -1,10 +1,10 @@ --- -title: Deploying Symfony on Upsun +title: Deploying Symfony on {{% vendor/name %}} sidebarTitle: Symfony layout: single -weight: -65 +weight: -60 description: | - Welcome to the Upsun documentation specific to the [Symfony](https://www.symfony.com/) framework on Upsun. + Welcome to the {{% vendor/name %}} documentation specific to the [Symfony](https://www.symfony.com/) framework on {{% vendor/name %}}. It includes common reference materials useful for deploying Symfony, but also external community and blog resources that cover more advanced topics relevant for the framework. --- diff --git a/sites/friday/src/get-started/stacks/symfony/blackfire.md b/sites/upsun/src/get-started/stacks/symfony/blackfire.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/blackfire.md rename to sites/upsun/src/get-started/stacks/symfony/blackfire.md diff --git a/sites/friday/src/get-started/stacks/symfony/crons.md b/sites/upsun/src/get-started/stacks/symfony/crons.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/crons.md rename to sites/upsun/src/get-started/stacks/symfony/crons.md diff --git a/sites/friday/src/get-started/stacks/symfony/environment-variables.md b/sites/upsun/src/get-started/stacks/symfony/environment-variables.md similarity index 98% rename from sites/friday/src/get-started/stacks/symfony/environment-variables.md rename to sites/upsun/src/get-started/stacks/symfony/environment-variables.md index df892d63a1..a4f38e892a 100644 --- a/sites/friday/src/get-started/stacks/symfony/environment-variables.md +++ b/sites/upsun/src/get-started/stacks/symfony/environment-variables.md @@ -99,11 +99,13 @@ symfony ssh -- symfony var:export --multiline ``` Each exposed environment variable is prefixed by the relationship name. -For example, if you have the following relationships in your configuration: +For example, if you have the following [relationships](/create-apps/app-reference/single-runtime-image#relationships) in your configuration: ```yaml relationships: - database: "securitydb:postgresql" + database: + service: securitydb + endpoint: postgresql ``` The environment variables for the database service is prefixed by `DATABASE_` diff --git a/sites/friday/src/get-started/stacks/symfony/faq.md b/sites/upsun/src/get-started/stacks/symfony/faq.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/faq.md rename to sites/upsun/src/get-started/stacks/symfony/faq.md diff --git a/sites/friday/src/get-started/stacks/symfony/get-started.md b/sites/upsun/src/get-started/stacks/symfony/get-started.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/get-started.md rename to sites/upsun/src/get-started/stacks/symfony/get-started.md diff --git a/sites/friday/src/get-started/stacks/symfony/integration.md b/sites/upsun/src/get-started/stacks/symfony/integration.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/integration.md rename to sites/upsun/src/get-started/stacks/symfony/integration.md diff --git a/sites/friday/src/get-started/stacks/symfony/local.md b/sites/upsun/src/get-started/stacks/symfony/local.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/local.md rename to sites/upsun/src/get-started/stacks/symfony/local.md diff --git a/sites/friday/src/get-started/stacks/symfony/workers.md b/sites/upsun/src/get-started/stacks/symfony/workers.md similarity index 100% rename from sites/friday/src/get-started/stacks/symfony/workers.md rename to sites/upsun/src/get-started/stacks/symfony/workers.md diff --git a/sites/upsun/src/get-started/stacks/wordpress.md b/sites/upsun/src/get-started/stacks/wordpress.md new file mode 100644 index 0000000000..4ff213b740 --- /dev/null +++ b/sites/upsun/src/get-started/stacks/wordpress.md @@ -0,0 +1,276 @@ +--- +title: Deploy WordPress on {{% vendor/name %}} +sidebarTitle: WordPress +weight: -55 +description: | + Complete the last required steps to successfully deploy WordPress on Upsun. +--- + +{{< note theme="info" >}} + +Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) +and the main [Getting started guide](/get-started/here/_index.md). +They provide all the core concepts and common commands you need to know before using the following materials. + +{{< /note >}} + +For WordPress to successfully deploy and operate, after completing the [Getting started guide](/get-started/here/_index.md), +you still need to add some required files and make a few changes to your {{% vendor/name %}} configuration. + +## Before you begin + +There are many ways you can set up a WordPress site or {{% vendor/name %}} project. +The instructions on this page were designed based on the following assumptions: + +- You are building a composer-based WordPress site using John P Bloch's [WordPress Composer Fork](https://github.com/johnpbloch/wordpress). +- You do not have a `composer.json` file, or are comfortable making changes to your existing version. +- You selected PHP as your runtime, and MariaDB as a service during the Getting Started guide. It's also assumed that while using the Getting Started guide you named the project `myapp`, which you will notice is the top-level key in all configuration below. + +## 1. Add required files + +To ensure you have all the required files and directories in your project, follow these steps: + +1. Copy the following files from the [Platform.sh WordPress Composer template](https://github.com/platformsh-templates/wordpress-composer/) + and add them to the root of your project: + + - The [composer.json](https://raw.githubusercontent.com/platformsh-templates/wordpress-composer/61da65da21039b280b588642cd329a2eb253e472/composer.json) file declares project dependencies and specifies project settings and metadata for [Composer](https://getcomposer.org/) to use + - The [wp-cli.yml](https://github.com/platformsh-templates/wordpress-composer/blob/61da65da21039b280b588642cd329a2eb253e472/wp-cli.yml) file contains the configuration values, related to your site, for the [WordPress CLI](https://wp-cli.org/) to use + - The [wp-config.php](https://github.com/platformsh-templates/wordpress-composer/blob/61da65da21039b280b588642cd329a2eb253e472/wp-config.php) file contains your site's base configuration details, such as database connection information + +2. Optional: To support non-public plugins, add a `plugins` directory to your project. +To ensure Git tracks empty folders, add a `plugins/.gitkeep` file as well. + +3. Add and commit your changes. + + ```bash {location="Terminal"} + git add . + git commit -m "Add files and directory" + git push + ``` + +Now that you have pushed all the necessary files and directories to Upsun, +make the following changes to your `./.upsun/config.yaml` file. + +## 2. Configure your root location + +Locate the `web:locations` section and update the root (`/`) location as follows: + +```yaml {location="./.upsun/config.yaml"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + web: + locations: + "/": + passthru: "/index.php" + root: "wordpress" + index: + - "index.php" + expires: 600 + scripts: true + allow: true + rules: + ^/license\.text$: + allow: false + ^/readme\.html$: + allow: false +``` + +{{< note theme="info" >}} +If you're migrating your site, you may already have a `composer.json` file. +You may even have generated your own instead of starting from the Platform.sh template version.
+If so, you may also have added a [`wordpress-install-dir` property](https://github.com/johnpbloch/wordpress-core-installer?tab=readme-ov-file#usage) for `extras` in your `composer.json` file.
+In this case, set `root:` to the name of the directory where you are installing WordPress. +{{< /note >}} + +## 3. Set up a location for uploads + +WordPress needs a writable location to store uploaded media. +To set one up, follow these steps: + +1. Create the location.
+ To do so, add a `/wp-content/uploads` location as follows: + + ```yaml {location="./.upsun/config.yaml"} + applications: + myapp: + source: + root: "/" + type: 'php:8.3' + web: + locations: + "/": + passthru: "/index.php" + root: "wordpress" + index: + - "index.php" + expires: 600 + scripts: true + allow: true + rules: + ^/license\.text$: + allow: false + ^/readme\.html$: + allow: false + "/wp-content/uploads": + root: "wordpress/wp-content/uploads" + scripts: false + allow: false + rules: + '(? + To do so, locate the `mounts:` section that is commented it out, and update it as follows: + + ```yaml {location="./.upsun/config.yaml"} + applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + mounts: + "wordpress/wp-content/uploads": + source: storage + source_path: "uploads" + ``` + + {{< note theme="info" >}} + If you have designated a different directory through the `wordpress-install-dir` property in your `composer.json` file, update the + mount location accordingly. + {{< /note >}} + +## 4. Install dependencies during the build hook + +To ensure your Composer dependencies are installed during the [build stage](/learn/overview/build-deploy.md#the-build), +locate the `build:` section (below the `hooks:` section).
+Update the `build:` section as follows: + +```yaml {location="./.upsun/config.yaml"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + hooks: + build: | + set -eux + composer install --prefer-dist --optimize-autoloader --apcu-autoloader --no-progress --no-ansi --no-interaction + rsync -a plugins/ wordpress/wp-content/plugins/ +``` + +You can adjust the `composer install` command to meet your specific requirements. + +If you aren't using the `plugins` directory to manage non-public plugins, remove the `rsync` command. + +## 5. Launch tasks during the deploy hook + +Some tasks need to be performed after the images for our application are built, +but before the newly built application can receive requests. +Therefore, the best time to launch them is during the [deploy hook](/learn/overview/build-deploy.md#deploy-steps). + +Such tasks include: + +- Flushing the object cache, which might have changed between current production and newly deployed changes +- Running the WordPress database update procedure, in case core is being updated with the newly deployed changes +- Running any due cron jobs + +To launch these tasks during the deploy hook, +locate the `deploy:` section (below the `build:` section).
+Update the `deploy:` section as follows: + +```yaml {location="./.upsun/config.yaml"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + hooks: + deploy: | + set -eux + # Flushes the object cache + wp cache flush + # Runs the WordPress database update procedure + wp core update-db + # Runs all due cron events + wp cron event run --due-now +``` + +## 6. Configure your default route + +Next, instruct the [router](learn/overview/structure.md#router) how to handle requests to your WordPress app. +To do so, locate the `routes:` section, and beneath it, the `"https://{default}/":` route. + +Update the route as follows: + +```yaml {location="./.upsun/config.yaml"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + +routes: + "https://{default}/": + type: upstream + upstream: "myapp:http" + cache: + enabled: true + cookies: + - '/^wordpress_*/' + - '/^wp-*/' +``` + +Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. +If these strings aren't the same, the WordPress deployment will not succeed. + +## 7. Update your MariaDB service relationship + +You need to update the name used to represent the [relationship](/create-apps/app-reference/single-runtime-image.md#relationships) between your app and your MariaDB service. +To do so, locate the `relationships:` top-level property. +Update the relationship for the database service as follows: + +```yaml {location="./.upsun/config.yaml"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + relationships: + database: "mariadb:mysql" +``` + +You can now commit all the changes made to `.upsun/config.yaml` and push to Upsun. + + ```bash {location="Terminal"} + git add . + git commit -m "Add changes to complete my {{% vendor/name %}} configuration" + git push + ``` + + +## Further resources + +### Documentation + +- [PHP documentation](/languages/php/) +- [Authenticated Composer repositories](/languages/php/composer-auth.md) + +### Community content + +- [PHP topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=php) +- [WordPress topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=wordpress) + +### Blogs + +- [To Upsun, a WordPress migration story](https://upsun.com/blog/to-upsun-a-wordpress-migration-story/) + + diff --git a/sites/friday/src/glossary/_index.md b/sites/upsun/src/glossary/_index.md similarity index 100% rename from sites/friday/src/glossary/_index.md rename to sites/upsun/src/glossary/_index.md diff --git a/sites/friday/src/increase-observability/_index.md b/sites/upsun/src/increase-observability/_index.md similarity index 100% rename from sites/friday/src/increase-observability/_index.md rename to sites/upsun/src/increase-observability/_index.md diff --git a/sites/friday/src/increase-observability/application-metrics/_index.md b/sites/upsun/src/increase-observability/application-metrics/_index.md similarity index 100% rename from sites/friday/src/increase-observability/application-metrics/_index.md rename to sites/upsun/src/increase-observability/application-metrics/_index.md diff --git a/sites/friday/src/increase-observability/application-metrics/blackfire.md b/sites/upsun/src/increase-observability/application-metrics/blackfire.md similarity index 100% rename from sites/friday/src/increase-observability/application-metrics/blackfire.md rename to sites/upsun/src/increase-observability/application-metrics/blackfire.md diff --git a/sites/friday/src/increase-observability/application-metrics/cont-prof.md b/sites/upsun/src/increase-observability/application-metrics/cont-prof.md similarity index 100% rename from sites/friday/src/increase-observability/application-metrics/cont-prof.md rename to sites/upsun/src/increase-observability/application-metrics/cont-prof.md diff --git a/sites/friday/src/increase-observability/application-metrics/go.md b/sites/upsun/src/increase-observability/application-metrics/go.md similarity index 93% rename from sites/friday/src/increase-observability/application-metrics/go.md rename to sites/upsun/src/increase-observability/application-metrics/go.md index c155b77757..e0bf156a12 100644 --- a/sites/friday/src/increase-observability/application-metrics/go.md +++ b/sites/upsun/src/increase-observability/application-metrics/go.md @@ -13,10 +13,13 @@ It is available directly from the Console under the `Profiling` tab of your envi The GO continuous profiling is currently made accross 6 dimensions: - **Allocations**: Number of objects allocated - **Allocated Memory**: Number of bytes allocated -- **CPU**: Time spent running on the CPU +- **CPU**: Time spent running on the CPU - **Goroutines**: Number of goroutines (both on-CPU and off-CPU) -- **Heap Live Objects**: Number of objects allocated that are not yet garbage collected. -- **Heap Live Size**: Number of bytes allocated that are not yet garbage collected. +- **Heap Live Objects**: Number of objects allocated that are not yet garbage collected +- **Heap Live Size**: Number of bytes allocated that are not yet garbage collected + +The default sampling frequency is 100 Hz. This means the Go continuous profiler is +collecting information 100 times per second. ## Prerequisites @@ -63,7 +66,7 @@ The `Start` function accepts the following options: - `WithCPUDuration`: specifies the length at which to collect CPU profiles. The default is 45 seconds. Can also be set via the environment variable `BLACKFIRE_CONPROF_CPU_DURATION`. -- `WithCPUProfileRate`: sets the CPU profiling rate to Hz samples per second. +- `WithCPUProfileRate`: sets the CPU profiling rate in Hz (number of samples per second). The default is defined by the Go runtime as 100 Hz. Can also be set via the environment variable `BLACKFIRE_CONPROF_CPU_PROFILERATE`. diff --git a/sites/friday/src/increase-observability/application-metrics/nodejs.md b/sites/upsun/src/increase-observability/application-metrics/nodejs.md similarity index 87% rename from sites/friday/src/increase-observability/application-metrics/nodejs.md rename to sites/upsun/src/increase-observability/application-metrics/nodejs.md index a5841533a3..c5412516ec 100644 --- a/sites/friday/src/increase-observability/application-metrics/nodejs.md +++ b/sites/upsun/src/increase-observability/application-metrics/nodejs.md @@ -2,7 +2,7 @@ title: Continuous profiling for Node.js sidebarTitle: "Node.js continuous profiler" description: Configure and use the NodeJS continuous profiler. -weight: 40 +weight: 30 --- ## Continuous profiling on {{% vendor/name %}} @@ -10,9 +10,13 @@ weight: 40 {{< vendor/name >}} Continuous Profiling is powered by [Blackfire](../../../increase-observability/application-metrics/blackfire.md). It is available directly from the Console under the `Profiling` tab of your environments. -The Node.js continuous profiling is currently made accross 2 dimensions: -- **wall-time**: elapsed time per function call -- **heap**: memory allocation and reserved space over time +The Node.js continuous profiling is currently made accross 3 dimensions: +- **CPU Time**: Time spent running on the CPU +- **Wall-time**: Elapsed time per function call +- **Heap**: Memory allocation and reserved space over time + +The default sampling frequency is 100 Hz. This means the Node.js continuous profiler is +collecting information 100 times per second. ## Prerequisites diff --git a/sites/upsun/src/increase-observability/application-metrics/php.md b/sites/upsun/src/increase-observability/application-metrics/php.md new file mode 100644 index 0000000000..ca25a050c0 --- /dev/null +++ b/sites/upsun/src/increase-observability/application-metrics/php.md @@ -0,0 +1,36 @@ +--- +title: Continuous profiling for PHP +sidebarTitle: "PHP continuous profiler" +description: Configure and use the PHP continuous profiler. +weight: 30 +--- + +{{< vendor/name >}} [Continuous Profiler](./cont-prof.md) is powered by [Blackfire](../../../increase-observability/application-metrics/blackfire.md). +It is available directly the [Console](/administration/web/_index.md), under the **Profiling** tab of your environments. + +The PHP continuous profiling is currently made accross 4 dimensions: +- **CPU Time**: Time spent running on the CPU +- **Wall-time**: Elapsed time per function call +- **Allocated Memory**: Number of bytes allocated in memory +- **Allocations**: Time spent running on the CPU + +The default sampling frequency is 100 Hz. This means the PHP continuous profiler is +collecting information 100 times per second. + +## Prerequisites + +{{< vendor/name >}} Continuous Profiler requires [`PHP >=8.2`](/languages/php/_index.md). + +## Installation + +The Blackfire Continuous Profiler PHP library is included by default in all +PHP images matching its requirements. There is no installation required. + +## Configuration + +The PHP continuous profiler is enabled by default without configuration. + +Optionally, you can override the following environment variables: + +- `DD_PROFILING_ENABLED=true`: forces the PHP continuous profiler activation/deactivation +- `DD_PROFILING_LOG_LEVEL=off`: controls the PHP continuous profiler log level \ No newline at end of file diff --git a/sites/upsun/src/increase-observability/application-metrics/python.md b/sites/upsun/src/increase-observability/application-metrics/python.md new file mode 100644 index 0000000000..d44d4505ed --- /dev/null +++ b/sites/upsun/src/increase-observability/application-metrics/python.md @@ -0,0 +1,72 @@ +--- +title: Continuous profiling for Python +sidebarTitle: "Python continuous profiler" +description: Configure and use the Python continuous profiler. +weight: 30 +--- + +{{< vendor/name >}} [Continuous Profiler](./cont-prof.md) is powered by [Blackfire](../../../increase-observability/application-metrics/blackfire.md). +It is available directly from the [Console](/administration/web/_index.md), under the **Profiling** tab of your environments. + +The PHP continuous profiling is currently made accross 4 dimensions: +- **CPU Time**: Time spent running on the CPU +- **Wall-time**: Elapsed time per function call +- **Heap Live Size**: Number of bytes allocated that are not yet garbage collected +- **Allocated Memory**: Number of bytes allocated in memory +- **Allocations**: Time spent running on the CPU + +The default sampling frequency is 100 Hz. This means the Python continuous profiler is +collecting information 100 times per second. + +## Prerequisites + +{{< vendor/name >}} Continuous Profiler requires [`Python >=3.7.0`](/languages/python/_index.md). + +## Installation + +The [Blackfire Continuous Profiler Python library](https://github.com/blackfireio/python-continuous-profiling) is included by default in all +Python images matching its requirements. There is no installation required. + +## Python continuous profiler API + +The Python profiler API (`profiler`) can be initiated with the following options: + +- `application_name`: the application name. +- `period`: specifies the length at which to collect CPU profiles. The default is 45 seconds. +- `upload_timeout`: observability data upload timeout. The default is 10 seconds. +- `labels`: a dict containing the custom labels specific to the profile payload that is sent. + +The Python continuous profiler API has two functions: + +``` python +def start(): +def stop(): +``` + +| Function | Description | +| ---------------------- | ----------- | +| `def start():` | The `start` function starts the continuous profiler probe.
It collects profiling information in the background and periodically uploads it to the Blackfire Agent until the ``stop`` function is called. | +| `def stop():` |Stops the continuous profiling probe. | + +## Example + +Here is an example of how you can initiate the Python `profiler` on a basic app: + +1. Create `example.py` with the following code: + + ``` python + def foo(): + import time + time.sleep(1.0) + + profiler = Profiler(application_name="my-python-app", labels={'my-extra-label': 'data'}) + profiler.start() + foo() + profiler.stop() + ``` + +2. Run the app: + + ``` bash + python example.py + ``` \ No newline at end of file diff --git a/sites/friday/src/increase-observability/application-metrics/understanding.md b/sites/upsun/src/increase-observability/application-metrics/understanding.md similarity index 100% rename from sites/friday/src/increase-observability/application-metrics/understanding.md rename to sites/upsun/src/increase-observability/application-metrics/understanding.md diff --git a/sites/friday/src/increase-observability/logs/_index.md b/sites/upsun/src/increase-observability/logs/_index.md similarity index 100% rename from sites/friday/src/increase-observability/logs/_index.md rename to sites/upsun/src/increase-observability/logs/_index.md diff --git a/sites/friday/src/increase-observability/logs/access-logs.md b/sites/upsun/src/increase-observability/logs/access-logs.md similarity index 95% rename from sites/friday/src/increase-observability/logs/access-logs.md rename to sites/upsun/src/increase-observability/logs/access-logs.md index 75df236d46..e63772b670 100644 --- a/sites/friday/src/increase-observability/logs/access-logs.md +++ b/sites/upsun/src/increase-observability/logs/access-logs.md @@ -73,7 +73,7 @@ hovering on the next unselected line gives you the amount of time that passed be Events that occur within an app container are logged within that container. The logs can be written to, but you should do so only with standard logging mechanisms. -If your app has its own logging mechanism, use it to write to a dedicated logs [mount](../../create-apps/app-reference.md#mounts). +If your app has its own logging mechanism, use it to write to a dedicated logs [mount](/create-apps/app-reference/single-runtime-image.md#mounts). To access the logs of various types of events: @@ -99,7 +99,7 @@ To view more lines, use the `--lines` flag. title=Using SSH directly +++ -1. Access the container by running +1. Access the container by running ``` bash {{% vendor/cli %}} ssh -e {{% variable "ENVIRONMENT_NAME" %}} @@ -120,7 +120,7 @@ title=Using SSH directly {{< /codetabs >}} All log files are trimmed to 100 MB automatically. -If you need larger logs, set up a [cron job](../../create-apps/app-reference.md#crons) to upload them to third-party storage. +If you need larger logs, set up a [cron job](/create-apps/app-reference/single-runtime-image.md#crons) to upload them to third-party storage. See an example of [uploading logs to Amazon S3](https://gitlab.com/contextualcode/platformsh-store-logs-at-s3) from Contextual Code. ### Types of container logs diff --git a/sites/friday/src/increase-observability/logs/forward-logs.md b/sites/upsun/src/increase-observability/logs/forward-logs.md similarity index 100% rename from sites/friday/src/increase-observability/logs/forward-logs.md rename to sites/upsun/src/increase-observability/logs/forward-logs.md diff --git a/sites/friday/src/increase-observability/metrics/_index.md b/sites/upsun/src/increase-observability/metrics/_index.md similarity index 98% rename from sites/friday/src/increase-observability/metrics/_index.md rename to sites/upsun/src/increase-observability/metrics/_index.md index 811c39f3d8..51c651a224 100644 --- a/sites/friday/src/increase-observability/metrics/_index.md +++ b/sites/upsun/src/increase-observability/metrics/_index.md @@ -105,7 +105,7 @@ Burst allows your container to use additional resources when they aren't needed If you have a container in a prolonged burst state, you might want to consider: * [Optimizing your code](../integrate-observability/_index.md) -* Changing your [app size](../../create-apps/app-reference.md#sizes) +* Changing your [app size](/create-apps/app-reference/single-runtime-image.md#sizes) or [service size](../../add-services/_index.md#size) * [Increasing your plan](../../administration/pricing/_index.md) @@ -124,7 +124,7 @@ If the resources are high and hovering close to the 100% threshold, you might want to consider: * [Optimizing your code](../integrate-observability/_index.md) (if possible) -* Changing your [app size](../../create-apps/app-reference.md#sizes) +* Changing your [app size](/create-apps/app-reference/single-runtime-image.md#sizes) or [service size](../../add-services/_index.md#size) * [Increasing your plan](../../administration/pricing/_index.md) diff --git a/sites/friday/src/increase-observability/metrics/http-metrics.md b/sites/upsun/src/increase-observability/metrics/http-metrics.md similarity index 100% rename from sites/friday/src/increase-observability/metrics/http-metrics.md rename to sites/upsun/src/increase-observability/metrics/http-metrics.md diff --git a/sites/friday/src/increase-observability/metrics/understand-metrics.md b/sites/upsun/src/increase-observability/metrics/understand-metrics.md similarity index 95% rename from sites/friday/src/increase-observability/metrics/understand-metrics.md rename to sites/upsun/src/increase-observability/metrics/understand-metrics.md index fd0cf72d08..83176797be 100644 --- a/sites/friday/src/increase-observability/metrics/understand-metrics.md +++ b/sites/upsun/src/increase-observability/metrics/understand-metrics.md @@ -6,9 +6,9 @@ description: Understand how to read metrics for {{< vendor/name >}} environments {{< vendor/name >}} environments consist of: -* App containers: one or more [app containers](../../create-apps/_index.md) +* App containers: one or more [app containers](/create-apps/_index.md) * Service containers: zero or more [service containers](../../add-services/_index.md) -* Worker containers: zero or more [worker instances](../../create-apps/app-reference.md#workers). +* Worker containers: zero or more [worker instances](/create-apps/app-reference/_index.md#workers). Infrastructure metrics report CPU, RAM, and disk space for app, service, and worker containers. These metrics are available for all of your environments. diff --git a/sites/friday/src/integrations/_index.md b/sites/upsun/src/integrations/_index.md similarity index 100% rename from sites/friday/src/integrations/_index.md rename to sites/upsun/src/integrations/_index.md diff --git a/sites/friday/src/integrations/activity/_index.md b/sites/upsun/src/integrations/activity/_index.md similarity index 100% rename from sites/friday/src/integrations/activity/_index.md rename to sites/upsun/src/integrations/activity/_index.md diff --git a/sites/friday/src/integrations/activity/discord.md b/sites/upsun/src/integrations/activity/discord.md similarity index 100% rename from sites/friday/src/integrations/activity/discord.md rename to sites/upsun/src/integrations/activity/discord.md diff --git a/sites/friday/src/integrations/activity/reference.md b/sites/upsun/src/integrations/activity/reference.md similarity index 99% rename from sites/friday/src/integrations/activity/reference.md rename to sites/upsun/src/integrations/activity/reference.md index dfd72d6cd5..79f80daf88 100644 --- a/sites/friday/src/integrations/activity/reference.md +++ b/sites/upsun/src/integrations/activity/reference.md @@ -126,7 +126,7 @@ The following table presents the possible activity types: | `environment.backup.delete` | A user deleted a [backup](/environments/backup.md). | | `environment.branch` | A [new branch](/environments.md#create-environments) has been created via the CLI, Console, or API. A branch created via Git shows up as `environment.push`. | | `environment.certificate.renewal` | An environment's SSL certificate has been [renewed](/define-routes/https.md#certificate-renewals). | -| `environment.cron` | A [cron job](/create-apps/app-reference.md#crons) has completed. | +| `environment.cron` | A [cron job](/create-apps/app-reference/single-runtime-image.md#crons) has completed. | | `environment.deactivate` | An environment has been made [inactive](/glossary.md#inactive-environment). | | `environment.delete` | An environment's code was deleted through Git. | | `environment.domain.create` | A new [domain](administration/web/configure-project.md#domains) has been associated with the environment. | @@ -333,8 +333,7 @@ To test responses, [set up a webhook](./webhooks.md#setup). ### Cron -When a cron job is triggered, the activity contains all -the [job's information](../../create-apps/app-reference.md#crons). +When a cron job is triggered, the activity contains all the [job's information](/create-apps/app-reference/single-runtime-image.md#crons). The following example response was triggered by a setting where the cron is scheduled to run every five minutes (`5 * * * *`) with the command `sleep 60 && echo sleep-60-finished && date` and times out after 86,400 seconds. @@ -571,8 +570,8 @@ The `environment` property contains the settings for the environment that was pu ``` The `deployment` property contains the settings for the deployment, -including the [image type](../../create-apps/app-reference.md#types) and -[resource allocation](../../create-apps/app-reference.md#sizes). +including the [image type](/create-apps/app-reference/single-runtime-image.md#types) and +[resource allocation](/create-apps/app-reference/single-runtime-image.md#sizes). The following example shows a shortened excerpt of the `deployment` property: diff --git a/sites/friday/src/integrations/activity/slack.md b/sites/upsun/src/integrations/activity/slack.md similarity index 100% rename from sites/friday/src/integrations/activity/slack.md rename to sites/upsun/src/integrations/activity/slack.md diff --git a/sites/friday/src/integrations/activity/utility.md b/sites/upsun/src/integrations/activity/utility.md similarity index 100% rename from sites/friday/src/integrations/activity/utility.md rename to sites/upsun/src/integrations/activity/utility.md diff --git a/sites/friday/src/integrations/activity/webhooks.md b/sites/upsun/src/integrations/activity/webhooks.md similarity index 100% rename from sites/friday/src/integrations/activity/webhooks.md rename to sites/upsun/src/integrations/activity/webhooks.md diff --git a/sites/friday/src/integrations/notifications.md b/sites/upsun/src/integrations/notifications.md similarity index 100% rename from sites/friday/src/integrations/notifications.md rename to sites/upsun/src/integrations/notifications.md diff --git a/sites/friday/src/integrations/overview.md b/sites/upsun/src/integrations/overview.md similarity index 100% rename from sites/friday/src/integrations/overview.md rename to sites/upsun/src/integrations/overview.md diff --git a/sites/friday/src/integrations/source/_index.md b/sites/upsun/src/integrations/source/_index.md similarity index 100% rename from sites/friday/src/integrations/source/_index.md rename to sites/upsun/src/integrations/source/_index.md diff --git a/sites/friday/src/integrations/source/bitbucket.md b/sites/upsun/src/integrations/source/bitbucket.md similarity index 100% rename from sites/friday/src/integrations/source/bitbucket.md rename to sites/upsun/src/integrations/source/bitbucket.md diff --git a/sites/friday/src/integrations/source/github.md b/sites/upsun/src/integrations/source/github.md similarity index 100% rename from sites/friday/src/integrations/source/github.md rename to sites/upsun/src/integrations/source/github.md diff --git a/sites/friday/src/integrations/source/gitlab.md b/sites/upsun/src/integrations/source/gitlab.md similarity index 100% rename from sites/friday/src/integrations/source/gitlab.md rename to sites/upsun/src/integrations/source/gitlab.md diff --git a/sites/friday/src/integrations/source/troubleshoot.md b/sites/upsun/src/integrations/source/troubleshoot.md similarity index 100% rename from sites/friday/src/integrations/source/troubleshoot.md rename to sites/upsun/src/integrations/source/troubleshoot.md diff --git a/sites/friday/src/languages/_index.md b/sites/upsun/src/languages/_index.md similarity index 100% rename from sites/friday/src/languages/_index.md rename to sites/upsun/src/languages/_index.md diff --git a/sites/friday/src/languages/dotnet.md b/sites/upsun/src/languages/dotnet.md similarity index 97% rename from sites/friday/src/languages/dotnet.md rename to sites/upsun/src/languages/dotnet.md index 7bb0aa65b6..687377f5c8 100644 --- a/sites/friday/src/languages/dotnet.md +++ b/sites/upsun/src/languages/dotnet.md @@ -4,6 +4,8 @@ description: | {{% vendor/name %}} supports deploying .NET applications by allowing developers to define a build process and pass its variables to the .NET Core build environment. --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -67,7 +69,7 @@ Also, should the program terminate for any reason, it's automatically restarted. Note that the start command _must_ run in the foreground. Incoming requests are passed to the application using either a TCP (default) or Unix socket. -The application must use the [appropriate environment variable](../create-apps/app-reference.md#where-to-listen) to determine the URI to listen on. +The application must use the [appropriate environment variable](/create-apps/app-reference/single-runtime-image.md#where-to-listen) to determine the URI to listen on. For a TCP socket ([recommended](https://go.microsoft.com/fwlink/?linkid=874850)), the application must listen on `http://127.0.0.1`, using the `PORT` environment variable. diff --git a/sites/friday/src/languages/elixir.md b/sites/upsun/src/languages/elixir.md similarity index 88% rename from sites/friday/src/languages/elixir.md rename to sites/upsun/src/languages/elixir.md index 643a7169f9..568d7e740c 100644 --- a/sites/friday/src/languages/elixir.md +++ b/sites/upsun/src/languages/elixir.md @@ -3,6 +3,8 @@ title: "Elixir" description: "{{% vendor/name %}} supports building and deploying applications written in Elixir. There is no default flavor for the build phase, but you can define it explicitly in your build hook. {{% vendor/name %}} Elixir images support both committed dependencies and download-on-demand. The underlying Erlang version is 22.0.7." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -78,7 +80,7 @@ applications: {{< note >}} -That build hook works for most cases and assumes that your `mix.exs` file is located at [your app root](../create-apps/app-reference.md#root-directory). +That build hook works for most cases and assumes that your `mix.exs` file is located at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< /note >}} @@ -135,15 +137,21 @@ You can commit a `mix.exs` file in your repository and the system downloads the The services configuration is available in the environment variable `PLATFORM_RELATIONSHIPS`. -Given a relationship defined in `{{< vendor/configfile "app" >}}`: +Given a [relationship](/create-apps/app-reference/single-runtime-image#relationships) defined in `{{< vendor/configfile "app" >}}`: ```yaml {configFile="app"} applications: - app: + myapp: type: 'elixir:{{% latest "elixir" %}}' - ... + + [...] + + # Relationships enable an app container's access to a service. + # The example below shows simplified configuration leveraging a default service + # (identified from the relationship name) and a default endpoint. + # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresdatabase: "dbpostgres:postgresql" + postgresql: ``` Assuming you have in `mix.exs` the Poison library to parse JSON: @@ -160,7 +168,7 @@ And assuming you use `ecto` you could put in `config/config.exs`: ```elixir relationships = Poison.decode!(Base.decode64!(System.get_env("PLATFORM_RELATIONSHIPS"))) -[postgresql_config | _tail] = relationships["postgresdatabase"] +[postgresql_config | _tail] = relationships["postgresql"] config :my_app, Repo, database: postgresql_config["path"], diff --git a/sites/friday/src/languages/go.md b/sites/upsun/src/languages/go.md similarity index 99% rename from sites/friday/src/languages/go.md rename to sites/upsun/src/languages/go.md index 4eca8f254e..9ba068b3bc 100644 --- a/sites/friday/src/languages/go.md +++ b/sites/upsun/src/languages/go.md @@ -3,6 +3,8 @@ title: "Go" description: "{{% vendor/name %}} supports building and deploying applications written in Go using Go modules. They're compiled during the Build hook phase, and support both committed dependencies and download-on-demand." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions diff --git a/sites/friday/src/languages/java/_index.md b/sites/upsun/src/languages/java/_index.md similarity index 99% rename from sites/friday/src/languages/java/_index.md rename to sites/upsun/src/languages/java/_index.md index 836fdf23f2..e05d28da5b 100644 --- a/sites/friday/src/languages/java/_index.md +++ b/sites/upsun/src/languages/java/_index.md @@ -4,6 +4,8 @@ description: Java is a general-purpose programming language, and one of the most layout: single --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions diff --git a/sites/friday/src/languages/java/migration.md b/sites/upsun/src/languages/java/migration.md similarity index 90% rename from sites/friday/src/languages/java/migration.md rename to sites/upsun/src/languages/java/migration.md index 0afa4372d7..bd45641144 100644 --- a/sites/friday/src/languages/java/migration.md +++ b/sites/upsun/src/languages/java/migration.md @@ -4,6 +4,8 @@ weight: 2 sidebarTitle: "Moving to {{% vendor/name %}}" --- +{{% composable/disclaimer %}} + It is common to have a Java application that you want to migrate to {{% vendor/name %}}. {{% vendor/name %}} supports several styles of Java application, such as monolith, microservices, stateful, and stateless. @@ -49,12 +51,12 @@ applications: ``` 1. [A Java version](/languages/java/_index.md#supported-versions), e,g.: `java:{{% latest "java" %}}` 2. [Hooks define what happens when building the application](../../create-apps/hooks/_index.md). This build process typically generates an executable file such as a uber-jar. For example, `mvn clean package`. -3. [The commands key defines the command to launch the application](../../create-apps/app-reference.md#web-commands). For example, `java -jar file.jar`. +3. [The commands key defines the command to launch the application](/create-apps/app-reference/single-runtime-image.md#web-commands). For example, `java -jar file.jar`. 4. In the start's command needs to receive the port where the application will execute thought the `PORT` environment. That's best when your app follows the port bind principle. For example, `java -jar jar --port=$PORT`. {{< note >}} -Be aware that after the build, it creates a read-only system. You have the [mount option to create a writable folder](../../create-apps/app-reference.md#mounts). +Be aware that after the build, it creates a read-only system. You have the [mount option to create a writable folder](/create-apps/app-reference/single-runtime-image.md#mounts). {{< /note >}} @@ -123,9 +125,9 @@ While the table above shows examples for Platform.sh rather than for {{% vendor/ ## Access to managed services {{% vendor/name %}} provides [managed services](/add-services/_index.md) such as databases, cache and search engines. -However, you can use a database or any services such as a transition process, just be aware of the [firewall](../../create-apps/app-reference.md#firewall). +However, you can use a database or any services such as a transition process, just be aware of the [firewall](/create-apps/app-reference/single-runtime-image.md#firewall). -When applications need to access a service, it is important to include the [`relationships` key](../../create-apps/app-reference.md#relationships). +When applications need to access a service, it is important to include the [`relationships` key](/create-apps/app-reference/single-runtime-image.md#relationships). By default an application may not talk to any other container without a `relationship` explicitly allowing access. To connect to a service from your deployed application, you need to pass the relationships information into your application's configuration. @@ -143,9 +145,10 @@ Service credentials are available within the [service environment variables](/de +++ title= Service environment variables +++ +Assuming the relationship `postgresql` is configured to grant access to a PostgreSQL service container, you can map the automatically generated environment variable (`POSTGRESQL_HOST`) to whatever your application expects to use: ```bash {location=".environment"} -export DB_HOST=$DATABASE_HOST +export DB_HOST=$POSTGRESQL_HOST ``` This sets environment variables with the names your app needs, and the values from [service environment variables](/development/variables/_index.md#service-environment-variables). @@ -161,7 +164,7 @@ This variable is a base64-encoded JSON object with keys of the relationship name {{% vendor/name %}} supports the [`jq` tool](https://stedolan.github.io/jq/), which allows to extract information from this JSON. ```bash {location=".environment"} -export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".database[0].host"` +export DB_HOST=`echo $PLATFORM_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].host"` ``` This sets environment variables with names your app needs and the values from [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). @@ -186,7 +189,7 @@ you have the option to move the variable environment to another file: a [`.envir You can obtain relationship information through the [service environment variables](/development/variables/_index.md#service-environment-variables) themselves, or through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). -Say your application has a relationship named ``database`` to a database service named `mariadb`: +Say your application has a relationship named ``postgresql`` to a database service named `postgresql`: {{< codetabs >}} +++ @@ -194,10 +197,10 @@ title= Service environment variables +++ ```bash {location=".environment"} -export DB_HOST=${DATABASE_HOST} -export DB_PASSWORD=${DATABASE_PASSWORD} -export DB_USER=${DATABASE_USERNAME} -export DB_DATABASE=${DATABASE_PATH} +export DB_HOST=${POSTGRESQL_HOST} +export DB_PASSWORD=${POSTGRESQL_PASSWORD} +export DB_USER=${POSTGRESQL_USERNAME} +export DB_DATABASE=${POSTGRESQL_PATH} export JDBC=jdbc:postgresql://${HOST}/${DATABASE} export JAVA_MEMORY=-Xmx$(jq .info.limits.memory /run/config.json)m export JAVA_OPTS="$JAVA_MEMORY -XX:+ExitOnOutOfMemoryError" @@ -216,10 +219,10 @@ This `{{% vendor/prefix %}}_RELATIONSHIPS` variable is a base64-encoded JSON obj {{% vendor/name %}} supports the [`jq` tool](https://stedolan.github.io/jq/), which allows to extract information from this JSON. ```bash {location=".environment"} -export DB_HOST=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".database[0].host"` -export DB_PASSWORD=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".database[0].password"` -export DB_USER=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".database[0].username"` -export DB_DATABASE=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".database[0].path"` +export DB_HOST=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].host"` +export DB_PASSWORD=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].password"` +export DB_USER=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].username"` +export DB_DATABASE=`echo ${{% vendor/prefix %}}_RELATIONSHIPS | base64 --decode | jq -r ".postgresql[0].path"` export JDBC=jdbc:postgresql://${HOST}/${DATABASE} export JAVA_MEMORY=-Xmx$(jq .info.limits.memory /run/config.json)m export JAVA_OPTS="$JAVA_MEMORY -XX:+ExitOnOutOfMemoryError" @@ -241,7 +244,7 @@ applications: hooks: build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true relationships: - database: "db:postgresql" + postgresql: web: commands: start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar diff --git a/sites/friday/src/languages/java/tuning.md b/sites/upsun/src/languages/java/tuning.md similarity index 99% rename from sites/friday/src/languages/java/tuning.md rename to sites/upsun/src/languages/java/tuning.md index 281533f036..f4e60e195e 100644 --- a/sites/friday/src/languages/java/tuning.md +++ b/sites/upsun/src/languages/java/tuning.md @@ -4,6 +4,8 @@ weight: 2 sidebarTitle: "Tuning" --- +{{% composable/disclaimer %}} + There are a number of settings that can be adjusted for each application to optimize its performance on {{% vendor/name %}}. ## Memory limits diff --git a/sites/friday/src/languages/lisp.md b/sites/upsun/src/languages/lisp.md similarity index 98% rename from sites/friday/src/languages/lisp.md rename to sites/upsun/src/languages/lisp.md index 8305b5586e..f96e167696 100644 --- a/sites/friday/src/languages/lisp.md +++ b/sites/upsun/src/languages/lisp.md @@ -3,6 +3,8 @@ title: "Lisp" description: "{{% vendor/name %}} supports building and deploying applications written in Lisp using Common Lisp (the SBCL version) with ASDF and Quick Lisp support. They're compiled during the Build phase, and support both committed dependencies and download-on-demand." --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -141,7 +143,7 @@ applications: app: type: 'lisp:{{% latest "lisp" %}}' relationships: - pg: postgresql:postgresql + postgresql: ``` The following would access that relationship, and provide your Lisp program the credentials to connect to a PostgreSQL instance. Add this to your `.asd` file: @@ -156,7 +158,7 @@ Then in your program you could access the PostgreSQL instance as follows: (defvar *pg-spec* nil) (defun setup-postgresql () - (let* ((pg-relationship (first (jsown:val (relationships) "pg"))) + (let* ((pg-relationship (first (jsown:val (relationships) "postgresql"))) (database (jsown:val pg-relationship "path")) (username (jsown:val pg-relationship "username")) (password (jsown:val pg-relationship "password")) diff --git a/sites/friday/src/languages/nodejs/_index.md b/sites/upsun/src/languages/nodejs/_index.md similarity index 96% rename from sites/friday/src/languages/nodejs/_index.md rename to sites/upsun/src/languages/nodejs/_index.md index 12a61a6cee..52cd4e134f 100644 --- a/sites/friday/src/languages/nodejs/_index.md +++ b/sites/upsun/src/languages/nodejs/_index.md @@ -7,6 +7,8 @@ keywords: - bun runtime --- +{{% composable/disclaimer %}} + Node.js is a popular asynchronous JavaScript runtime. Deploy scalable Node.js apps of all sizes on {{% vendor/name %}}. You can also develop a microservice architecture mixing JavaScript and other apps with [multi-app projects](../../create-apps/multi-app/_index.md). @@ -156,13 +158,13 @@ applications: ## Dependencies By default, {{% vendor/name %}} assumes you're using npm as a package manager. -If your code has a `package.json`, the following command is run as part of the default [build flavor](../../create-apps/app-reference.md#build): +If your code has a `package.json`, the following command is run as part of the default [build flavor](/create-apps/app-reference/single-runtime-image.md#build): ```bash npm prune --userconfig .npmrc && npm install --userconfig .npmrc ``` -This means you can specify configuration in a `.npmrc` file in [your app root](../../create-apps/app-reference.md#root-directory). +This means you can specify configuration in a `.npmrc` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). ### Use Yarn as a package manager @@ -377,6 +379,6 @@ highlight=js All major Javascript/Node.js web frameworks can be deployed on {{% vendor/name %}}. See dedicated guides for deploying and working with them: -- [Express](/get-started/stacks/express.md) +- [Express](/get-started/stacks/express) - [Next.js](/get-started/stacks/nextjs.md) -- [Strapi](/get-started/stacks/strapi.md) +- [Strapi](/get-started/stacks/strapi) diff --git a/sites/friday/src/languages/nodejs/debug.md b/sites/upsun/src/languages/nodejs/debug.md similarity index 99% rename from sites/friday/src/languages/nodejs/debug.md rename to sites/upsun/src/languages/nodejs/debug.md index bd5eb1a07c..f780caa5b4 100644 --- a/sites/friday/src/languages/nodejs/debug.md +++ b/sites/upsun/src/languages/nodejs/debug.md @@ -3,6 +3,8 @@ title: "Debugging" weight: 1 --- +{{% composable/disclaimer %}} + Effectively debugging web apps takes effort, especially when an HTTP request goes through multiple layers before reaching your web app. Follow the steps below to debug a specific app. diff --git a/sites/friday/src/languages/nodejs/node-version.md b/sites/upsun/src/languages/nodejs/node-version.md similarity index 97% rename from sites/friday/src/languages/nodejs/node-version.md rename to sites/upsun/src/languages/nodejs/node-version.md index 0c4a7b9bee..ed681e0b8b 100644 --- a/sites/friday/src/languages/nodejs/node-version.md +++ b/sites/upsun/src/languages/nodejs/node-version.md @@ -4,6 +4,8 @@ weight: 1 description: See how to manage different Node.js versions in your {{% vendor/name %}} containers." --- +{{% composable/disclaimer %}} + Each {{% vendor/name %}} container image includes a specific language in a specific version. A set of dependencies is also provided based on that language version. This ensures that your application container is as small and efficient as possible. @@ -33,7 +35,7 @@ including Windows Subsystem for Linux. title=.nvmrc +++ -Create a `.nvmrc` file in [your app root](../../create-apps/app-reference.md#root-directory): +Create a `.nvmrc` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```yaml {location=".nvmrc"} v16.13.2 @@ -45,7 +47,7 @@ v16.13.2 title=.n-node-version/.node-version +++ -Create a `.n-node-version` or `.node-version` file in [your app root](../../create-apps/app-reference.md#root-directory): +Create a `.n-node-version` or `.node-version` file in [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```yaml {location=".n-node-version or .node-version"} 16.13.2 diff --git a/sites/friday/src/languages/php/_index.md b/sites/upsun/src/languages/php/_index.md similarity index 80% rename from sites/friday/src/languages/php/_index.md rename to sites/upsun/src/languages/php/_index.md index 115cb88eb8..c5fbc5cee4 100644 --- a/sites/friday/src/languages/php/_index.md +++ b/sites/upsun/src/languages/php/_index.md @@ -4,6 +4,14 @@ description: Deploy PHP apps on {{% vendor/name %}}. layout: single --- +{{% note theme="info" %}} + +You can now use the {{% vendor/name %}} composable image (BETA) to install runtimes and tools in your application container. +To find out more about this feature, see the [dedicated documentation page](/create-apps/app-reference/composable-image.md).
+Also, see how you can [modify your PHP runtime when using a composable image](#modify-your-php-runtime-when-using-a-composable-image). + +{{% /note %}} + ## Supported versions {{% major-minor-versions-note configMinor="true" %}} @@ -51,14 +59,14 @@ applications: ``` ### 2. Serve your app -To serve your app, define what (and how) content should be served by setting the [`locations` parameter](../../create-apps/app-reference.md#locations). +To serve your app, define what (and how) content should be served by setting the [`locations` parameter](/create-apps/app-reference/single-runtime-image.md#locations). Usually, it contains the two following (optional) keys: - `root` for the document root, the directory to which all requests for existing `.php` and static files (such as `.css`, `.jpg`) are sent. - `passthru` to [define a front controller](../../create-apps/web/php-basic.md#set-different-rules-for-specific-locations) to handle nonexistent files. - The value is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + The value is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< note >}} @@ -110,13 +118,13 @@ applications: ## Dependencies Up to PHP version 8.1, it's assumed that you're using [Composer](https://getcomposer.org/) 1.x to manage dependencies. -If you have a `composer.json` file in your code, the default [build flavor is run](../../create-apps/app-reference.md#build): +If you have a `composer.json` file in your code, the default [build flavor is run](/create-apps/app-reference/single-runtime-image.md#build): ```bash composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader ``` -To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configuration, add the following [dependency](../../create-apps/app-reference.md#dependencies): +To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configuration, add the following [dependency](/create-apps/app-reference/single-runtime-image.md#dependencies): ```yaml {configFile="app"} applications: @@ -128,7 +136,7 @@ applications: php: composer/composer: '^2' ``` -Adding a dependency to the [dependencies block](../../create-apps/app-reference.md#dependencies) makes it available globally. +Adding a dependency to the [dependencies block](/create-apps/app-reference/single-runtime-image.md#dependencies) makes it available globally. So you can then use included dependencies as commands within your app container. You can add multiple global dependencies to the dependencies block, such as [Node.js](../nodejs/_index.md#2-specify-any-global-dependencies). @@ -161,7 +169,7 @@ applications: That installs production dependencies with Composer but not development dependencies. The same can be achieved by using the default build flavor and [adding the `COMPOSER_NO_DEV` variable](../../development/variables/set-variables.md). -See more on [build flavors](../../create-apps/app-reference.md#build). +See more on [build flavors](/create-apps/app-reference/single-runtime-image.md#build). ### Alternative repositories @@ -303,7 +311,7 @@ markdownify=false ## PHP settings -You can configure your PHP-FPM runtime configuration by specifying the [runtime in your app configuration](../../create-apps/app-reference.md#runtime). +You can configure your PHP-FPM runtime configuration by specifying the [runtime in your app configuration](/create-apps/app-reference/single-runtime-image.md#runtime). In addition to changes in runtime, you can also change the PHP settings. Some commonly used settings are: @@ -390,7 +398,7 @@ For more information, see how to use [PHP-specific variables](../../development/ title=Using `php.ini` +++ -You can provide a custom `php.ini` file at the [app root](../../create-apps/app-reference.md#root-directory). +You can provide a custom `php.ini` file at the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). Using this method isn't recommended since it offers less flexibility and is more error-prone. Consider using variables instead. @@ -445,20 +453,20 @@ Common functions to disable include: PHP has two execution modes you can choose from: - The command line interface mode (PHP-CLI) is the mode used for command line scripts and standalone apps. - This is the mode used when you're logged into your container via SSH, for [crons](../../create-apps/app-reference.md#crons), + This is the mode used when you're logged into your container via SSH, for [crons](/create-apps/app-reference/single-runtime-image.md#crons), and usually also for [alternate start commands](#alternate-start-commands). To use PHP-CLI, run your script with `php {{}}`, - where {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + where {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). - The Common Gateway Interface mode (PHP-CGI) is the mode used for web apps and web requests. This is the default mode when the `start` command isn't explicitly set. To use PHP-CGI, run your script with a symlink: `/usr/bin/start-php-app {{}}`, - where {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + where {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). With PHP-CGI, PHP is run using the FastCGI Process Manager (PHP-FPM). ## Alternate start commands To specify an alternative process to run your code, set a `start` command. -For more information about the start command, see the [web commands reference](../../create-apps/app-reference.md#web-commands). +For more information about the start command, see the [web commands reference](/create-apps/app-reference/single-runtime-image.md#web-commands). By default, start commands use PHP-CLI. Find out how and when to use each [execution mode](#execution-mode). @@ -488,7 +496,7 @@ web: {{< /snippet >}} ``` - {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). <---> @@ -508,7 +516,7 @@ web: {{< /snippet >}} ``` - {{}} is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). + {{}} is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). 3. Configure the container to listen on a TCP socket: @@ -522,7 +530,7 @@ web: ``` When you listen on a TCP socket, the `$PORT` environment variable is automatically set. - See more options on how to [configure where requests are sent](../../create-apps/app-reference.md#upstream). + See more options on how to [configure where requests are sent](/create-apps/app-reference/single-runtime-image.md#upstream). You might have to configure your app to connect via the `$PORT` TCP socket, especially when using web servers such as [Swoole](swoole.md) or [Roadrunner](https://github.com/roadrunner-server/roadrunner). @@ -559,7 +567,7 @@ web: ``` {{}} is the bash script created in step 1. - Both {{}} and {{}} are file paths relative to the [app root](../../create-apps/app-reference.md#root-directory). + Both {{}} and {{}} are file paths relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). {{< /codetabs >}} @@ -620,5 +628,63 @@ applications: All major PHP web frameworks can be deployed on {{% vendor/name %}}. See dedicated guides for deploying and working with them: -- [Laravel](/get-started/stacks/laravel.md) +- [Laravel](/get-started/stacks/laravel) - [Symfony](/get-started/stacks/symfony/_index.md) + +## Modify your PHP runtime when using a composable image + +{{% note theme= "warning" %}} + +This section is only relevant when using the {{% vendor/name %}} [composable image (BETA)](/create-apps/app-reference/composable-image.md). + +{{% /note %}} + +The following table presents the possible modifications you can make to your PHP primary runtime using the `stack` key and composable image. +Each modification should be listed below the stack chosen (i.e. `extensions` are enabled under `.applications.frontend.stack[0]["php@8.3"].extensions` for PHP 8.3). +See the example below for more details. + +| Name | Type | Description | +|-----------------------------|------------------------------------------------------------|--------------------------------------------------------------------------------------------| +| `extensions` | List of `string`s OR [extensions definitions](/create-apps/app-reference/composable-image#php-extensions-and-python-packages) | [PHP extensions](/languages/php/extensions.md) to enable. | +| `disabled_extensions` | List of `string`s | [PHP extensions](/languages/php/extensions.md) to disable. | +| `request_terminate_timeout` | `integer` | The timeout for serving a single request after which the PHP-FPM worker process is killed. | +| `sizing_hints` | A [sizing hints definition](/create-apps/app-reference/composable-image#sizing-hints) | The assumptions for setting the number of workers in your PHP-FPM runtime. | +| `xdebug` | An Xdebug definition | The setting to turn on [Xdebug](/languages/php/xdebug.md). | + +Here is an example configuration: + +```yaml {configFile="app"} +applications: + + frontend: + + stack: + - "php@8.3": + extensions: + - apcu # A PHP extension made available to the PHP runtime + - sodium + - xsl + - pdo_sqlite + + xdebug: + idekey: YOUR_KEY + + disabled_extensions: + - gd + + request_terminate_timeout: 200 + + sizing_hints: + request_memory: 45 + reserved_memory: 70 + + - "php83Extensions.apcu" # A PHP extension made available to all runtimes. + - "python@3.12" + - "python312Packages.yq" +``` + +{{% note %}} + +You can also set your [app's runtime timezone](/create-apps/timezone.md). + +{{% /note %}} \ No newline at end of file diff --git a/sites/friday/src/languages/php/composer-auth.md b/sites/upsun/src/languages/php/composer-auth.md similarity index 97% rename from sites/friday/src/languages/php/composer-auth.md rename to sites/upsun/src/languages/php/composer-auth.md index e7fb3a6af7..bd26e6af01 100644 --- a/sites/friday/src/languages/php/composer-auth.md +++ b/sites/upsun/src/languages/php/composer-auth.md @@ -4,6 +4,8 @@ sidebarTitle: "Authenticated Composer" description: Allow Composer to authenticate against a private third-party Composer repository and download PHP packages from it. --- +{{% composable/disclaimer %}} + [Packagist](https://packagist.org/) is the primary Composer repository for public PHP packages. But you can also have Composer download PHP packages from a private, third-party Composer repository. To make sure Composer has the necessary credentials to do so, @@ -66,4 +68,4 @@ Access to private Git repositories is restricted through the use of SSH keys. But most private Composer tools mirror tagged releases of dependencies and serve them directly without hitting the Git repository. To avoid having to authenticate against a remote Git repository, -make sure your dependencies specify tagged releases. \ No newline at end of file +make sure your dependencies specify tagged releases. diff --git a/sites/friday/src/languages/php/extensions.md b/sites/upsun/src/languages/php/extensions.md similarity index 76% rename from sites/friday/src/languages/php/extensions.md rename to sites/upsun/src/languages/php/extensions.md index 747fa39c35..3bc49980b1 100644 --- a/sites/friday/src/languages/php/extensions.md +++ b/sites/upsun/src/languages/php/extensions.md @@ -4,10 +4,19 @@ weight: 1 description: See what PHP extensions are available with each PHP version on {{% vendor/name %}}. --- +{{% note theme="info" %}} + +You can now use the [{{% vendor/name %}} composable image (BETA)](/create-apps/app-reference/composable-image.md) to install runtimes and tools in your application container. +When using the composable image, see how you can: +- [Manage PHP extensions](/create-apps/app-reference/composable-image.md#php-extensions-and-python-packages) +- [Modify your PHP runtime](#modify-your-php-runtime-when-using-a-composable-image) + +{{% /note %}} + PHP has a number of [extensions](https://pecl.php.net/) developed by members of the community. Some of them are available for {{% vendor/name %}} containers. -{{< note version="1" theme="warning" >}} +{{< note version="1" theme="warning" title="Warning" >}} The information on this page applies to Grid and {{% names/dedicated-gen-3 %}} plans. See also [PHP extensions on {{% names/dedicated-gen-2 %}} plans](../../dedicated-gen-2/overview/grid.md#extensions). @@ -29,7 +38,7 @@ applications: disabled_extensions: - sqlite3 ``` -You can also [include configuration options](../../create-apps/app-reference.md#extensions) for specific extensions. +You can also [include configuration options](/create-apps/app-reference/single-runtime-image.md#extensions) for specific extensions. The following table shows all extensions that are available (Avail) and on by default (Def). You can turn on the available ones with the `extensions` key @@ -71,7 +80,7 @@ but it takes slightly more work: but committing large binary blobs to Git is generally not recommended. 2. Load the extension using an absolute path by [customizing the PHP settings](./_index.md#customize-php-settings) - For example, if the extension is named `spiffy.so` and is in your [app root](../../create-apps/app-reference.md#root-directory), + For example, if the extension is named `spiffy.so` and is in your [app root](/create-apps/app-reference/single-runtime-image.md#root-directory), your configuration looks like the following: ```yaml {configFile="app"} diff --git a/sites/friday/src/languages/php/fpm.md b/sites/upsun/src/languages/php/fpm.md similarity index 96% rename from sites/friday/src/languages/php/fpm.md rename to sites/upsun/src/languages/php/fpm.md index bf211be2f3..80b6bb6802 100644 --- a/sites/friday/src/languages/php/fpm.md +++ b/sites/upsun/src/languages/php/fpm.md @@ -4,6 +4,8 @@ description: "Learn how to adjust the maximum number of PHP-FPM workers for your weight: 5 --- +{{% composable/disclaimer %}} + PHP-FPM helps improve your app's performance by maintaining pools of workers that can process PHP requests. This is particularly useful when your app needs to handle a high number of simultaneous requests. @@ -89,7 +91,7 @@ These values allow most programs to run, but you can amend them to fit your needs. To do so, adjust your [app configuration](../../create-apps/_index.md). -Under `runtime` in the [`sizing_hints` setting](../../create-apps/app-reference.md#sizing-hints), +Under `runtime` in the [`sizing_hints` setting](/create-apps/app-reference/single-runtime-image.md#sizing-hints), set the values for `reserved_memory` and `request_memory`. For example, diff --git a/sites/friday/src/languages/php/redis.md b/sites/upsun/src/languages/php/redis.md similarity index 97% rename from sites/friday/src/languages/php/redis.md rename to sites/upsun/src/languages/php/redis.md index 684b12214b..4cddefa9fe 100644 --- a/sites/friday/src/languages/php/redis.md +++ b/sites/upsun/src/languages/php/redis.md @@ -4,6 +4,8 @@ sidebarTitle: Custom Redis weight: 7 --- +{{% composable/disclaimer %}} + [Redis](../../add-services/redis.md) is a popular structured key-value service, supported by {{% vendor/name %}}. It's frequently used for caching. @@ -77,7 +79,7 @@ That's only for pre-built extensions. 1. Download the Relay/PhpRedis source code. 2. Check out the version specified in the build hook. 3. Compile the extension. -4. Copy the resulting `relay.so`/`redis.so` file to [your app root](../../create-apps/app-reference.md#root-directory). +4. Copy the resulting `relay.so`/`redis.so` file to [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory). 5. Add a line to the `php.ini` file in your app root to enable the extension, creating the file if necessary. If the script doesn't find a `$PLATFORM_CACHE_DIR` directory defined, it exits silently. diff --git a/sites/friday/src/languages/php/swoole.md b/sites/upsun/src/languages/php/swoole.md similarity index 98% rename from sites/friday/src/languages/php/swoole.md rename to sites/upsun/src/languages/php/swoole.md index 6ca5c55b0e..849846b245 100644 --- a/sites/friday/src/languages/php/swoole.md +++ b/sites/upsun/src/languages/php/swoole.md @@ -4,6 +4,8 @@ weight: 8 sidebarTitle: "Swoole" --- +{{% composable/disclaimer %}} + Swoole is a PHP extension that extends PHP core with a coroutine based asynchronous network application framework designed for building large scale concurrent systems. Unlike PHP-FPM’s stateless operating, Swoole relies on establishing persistent connections with every user, sending and receiving data in real-time. diff --git a/sites/friday/src/languages/php/troubleshoot.md b/sites/upsun/src/languages/php/troubleshoot.md similarity index 99% rename from sites/friday/src/languages/php/troubleshoot.md rename to sites/upsun/src/languages/php/troubleshoot.md index c8f13a25c2..5b9ed54f2e 100644 --- a/sites/friday/src/languages/php/troubleshoot.md +++ b/sites/upsun/src/languages/php/troubleshoot.md @@ -4,6 +4,8 @@ sidebarTitle: Troubleshoot description: Learn how to troubleshoot common issues in PHP. --- +{{% composable/disclaimer %}} + {{% troubleshoot %}} ## Server reached `max_children` diff --git a/sites/friday/src/languages/php/tuning.md b/sites/upsun/src/languages/php/tuning.md similarity index 96% rename from sites/friday/src/languages/php/tuning.md rename to sites/upsun/src/languages/php/tuning.md index f9c30cb8c7..60930133df 100644 --- a/sites/friday/src/languages/php/tuning.md +++ b/sites/upsun/src/languages/php/tuning.md @@ -3,6 +3,8 @@ title: "Performance tuning" weight: 3 --- +{{% composable/disclaimer %}} + Once your app is up and running it still needs to be kept fast. {{% vendor/name %}} offers a wide degree of flexibility in how PHP behaves, but that does mean you may need to take a few steps to ensure your site is running optimally. @@ -16,7 +18,7 @@ To make a PHP-based site run faster, the first step is to upgrade the PHP versio Upgrading the PHP version might require changes to your app. For more details and recommendations, see the [PHP migration guides](https://www.php.net/manual/en/migration80.php). -To change your PHP version, change the [`type` in your app configuration](../../create-apps/app-reference.md#types). +To change your PHP version, change the [`type` in your app configuration](/create-apps/app-reference/single-runtime-image.md#types). Before merging to production, test the change on a branch and make sure that your app is working as expected. ## Optimize the FPM worker count @@ -58,7 +60,7 @@ applications: php: opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' ``` -`{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](../../create-apps/app-reference.md#root-directory). +`{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). It may be any PHP script that calls `opcache_compile_file()`. The following example uses a `preload.php` file as the preload script. @@ -93,7 +95,7 @@ To determine the maximum number of files to cache, follow these steps: 1. Connect to the container via SSH using the [CLI](../../development/ssh/_index.md) by running `{{% vendor/cli %}} ssh`. -2. Determine roughly how many `.php` files your app has by running this command from [your app root](../../create-apps/app-reference.md#root-directory): +2. Determine roughly how many `.php` files your app has by running this command from [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory): ```bash find . -type f -name '*.php' | wc -l diff --git a/sites/friday/src/languages/php/xdebug.md b/sites/upsun/src/languages/php/xdebug.md similarity index 97% rename from sites/friday/src/languages/php/xdebug.md rename to sites/upsun/src/languages/php/xdebug.md index 929be85bd5..d0425294d5 100644 --- a/sites/friday/src/languages/php/xdebug.md +++ b/sites/upsun/src/languages/php/xdebug.md @@ -4,6 +4,8 @@ weight: 6 sidebarTitle: "Xdebug" --- +{{% composable/disclaimer %}} + [Xdebug](https://xdebug.org/) is a real-time debugger extension for PHP. While usually used for local development, it can also be helpful for debugging aberrant behavior on the server. @@ -31,7 +33,7 @@ You also need: Xdebug runs as a second PHP-FPM process used only for debugging requests, leaving the normal process unaffected. -To enable Xdebug, add the following to your [app configuration](../../create-apps/app-reference.md): +To enable Xdebug, add the following to your [app configuration](/create-apps/app-reference/single-runtime-image.md): ```yaml {configFile="app"} applications: @@ -115,7 +117,7 @@ The common steps for setup usually include: The Port should always be `443` and the Debugger set to `Xdebug`. 4. Ensuring path mappings is enabled. This lets you define what remote paths on the server correspond to what path on your local machine. - In the majority of cases you can just define [your app root](../../create-apps/app-reference.md#root-directory) + In the majority of cases you can just define [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory) to map to `app`. 5. Listening for connections. 6. Starting debugging. While in listen mode, start the `{{% vendor/cli %}} xdebug` tunnel. diff --git a/sites/friday/src/languages/python/_index.md b/sites/upsun/src/languages/python/_index.md similarity index 98% rename from sites/friday/src/languages/python/_index.md rename to sites/upsun/src/languages/python/_index.md index 41ba9d84bf..aa157e51c3 100644 --- a/sites/friday/src/languages/python/_index.md +++ b/sites/upsun/src/languages/python/_index.md @@ -4,6 +4,8 @@ description: Get started creating Python apps on {{% vendor/name %}}. layout: single --- +{{% composable/disclaimer %}} + Python is a general purpose scripting language often used in web development. You can deploy Python apps on {{% vendor/name %}} using a server or a project such as [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/). @@ -170,7 +172,7 @@ For more about managing packages with pip, Pipenv, and Poetry, see how to [manage dependencies](./dependencies.md). To add global dependencies (packages available as commands), -add them to the `dependencies` in your [app configuration](../../create-apps/app-reference.md#dependencies): +add them to the `dependencies` in your [app configuration](/create-apps/app-reference/single-runtime-image.md#dependencies): ```yaml {configFile="app"} applications: diff --git a/sites/friday/src/languages/python/dependencies.md b/sites/upsun/src/languages/python/dependencies.md similarity index 99% rename from sites/friday/src/languages/python/dependencies.md rename to sites/upsun/src/languages/python/dependencies.md index 87232d3ff5..310c52fe20 100644 --- a/sites/friday/src/languages/python/dependencies.md +++ b/sites/upsun/src/languages/python/dependencies.md @@ -5,6 +5,8 @@ sidebarTitle: Manage dependencies description: See how to manage Python dependencies with different package managers. --- +{{% composable/disclaimer %}} + You can manage Python packages in different ways. Python images come with pip installed, but they're flexible enough so you can choose what package manager you want. diff --git a/sites/friday/src/languages/python/python-version.md b/sites/upsun/src/languages/python/python-version.md similarity index 99% rename from sites/friday/src/languages/python/python-version.md rename to sites/upsun/src/languages/python/python-version.md index bfe8a1db3d..5d50a9eec2 100644 --- a/sites/friday/src/languages/python/python-version.md +++ b/sites/upsun/src/languages/python/python-version.md @@ -5,6 +5,8 @@ weight: 0 description: See how to manage different Python versions in your {{% vendor/name %}} containers. --- +{{% composable/disclaimer %}} + You may need to use a specific version of Python that isn't available in an app container for a different language. For example, a container might have a long-term support version, while you want the latest version. diff --git a/sites/friday/src/languages/python/server.md b/sites/upsun/src/languages/python/server.md similarity index 99% rename from sites/friday/src/languages/python/server.md rename to sites/upsun/src/languages/python/server.md index da04363b6c..3436c80eed 100644 --- a/sites/friday/src/languages/python/server.md +++ b/sites/upsun/src/languages/python/server.md @@ -4,6 +4,8 @@ weight: -90 description: See how to start your apps as you wish with ASGI and WSGI servers. --- +{{% composable/disclaimer %}} + The Python ecosystem offers a number of web servers that can be used to deploy to {{% vendor/name %}}. The following examples deploy a Django project named `myapp`. They assume a `myapp/wsgi.py` or `myapp/asgi.py` file with a callable `application`. diff --git a/sites/friday/src/languages/ruby.md b/sites/upsun/src/languages/ruby.md similarity index 98% rename from sites/friday/src/languages/ruby.md rename to sites/upsun/src/languages/ruby.md index 32b2873bea..0cfde1a93e 100644 --- a/sites/friday/src/languages/ruby.md +++ b/sites/upsun/src/languages/ruby.md @@ -4,6 +4,8 @@ description: | {{% vendor/name %}} supports deploying any Ruby application. Your application can use any Ruby application server such as Unicorn or Puma and deploying a Rails or a Sinatra app is very straight forward. --- +{{% composable/disclaimer %}} + {{% description %}} ## Supported versions @@ -83,7 +85,7 @@ applications: 3. Build your application with the build hook. - Assuming you have your dependencies stored in the `Gemfile` at [your app root](../create-apps/app-reference.md#root-directory), + Assuming you have your dependencies stored in the `Gemfile` at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory), create a hook like the following: ```yaml {configFile="app"} @@ -235,6 +237,7 @@ routes: Here is a complete `{{< vendor/configfile "app" >}}` file: ```yaml {configFile="app"} +# The name of the app, which must be unique within a project. applications: app: type: 'ruby:{{% latest "ruby" %}}' @@ -244,7 +247,7 @@ applications: yarn: "*" relationships: - database: "database:mysql" + mysql: variables: env: @@ -351,7 +354,7 @@ routes: ... services: - database: + mysql: type: mysql:{{% latest "mariadb" %}} ``` ## Connecting to services @@ -363,14 +366,14 @@ applications: app: type: 'ruby:{{% latest "ruby" %}}' relationships: - database: "database:mysql" + mysql: ... routes: ... services: - database: + mysql: type: mysql:{{% latest "mariadb" %}} ``` By using the following Ruby function calls, you can obtain the database details. @@ -385,7 +388,7 @@ This should give you something like the following: ```json { - "database" : [ + "mysql" : [ { "path" : "main", "query" : { @@ -394,7 +397,7 @@ This should give you something like the following: "port" : 3306, "username" : "user", "password" : "", - "host" : "database.internal", + "host" : "mysql.internal", "ip" : "246.0.241.50", "scheme" : "mysql" } diff --git a/sites/friday/src/languages/rust.md b/sites/upsun/src/languages/rust.md similarity index 99% rename from sites/friday/src/languages/rust.md rename to sites/upsun/src/languages/rust.md index b7f736fb4c..ea4e279751 100644 --- a/sites/friday/src/languages/rust.md +++ b/sites/upsun/src/languages/rust.md @@ -7,6 +7,8 @@ banner: To share your feedback so we can improve it, add a comment to the [Rust feature card](https://next.platform.sh/c/221-rust). --- +{{% composable/disclaimer %}} + {{% vendor/name %}} supports building and deploying applications written in Rust. ## Supported versions diff --git a/sites/friday/src/learn/_index.md b/sites/upsun/src/learn/_index.md similarity index 100% rename from sites/friday/src/learn/_index.md rename to sites/upsun/src/learn/_index.md diff --git a/sites/friday/src/learn/bestpractices/_index.md b/sites/upsun/src/learn/bestpractices/_index.md similarity index 100% rename from sites/friday/src/learn/bestpractices/_index.md rename to sites/upsun/src/learn/bestpractices/_index.md diff --git a/sites/friday/src/learn/bestpractices/clean-repository.md b/sites/upsun/src/learn/bestpractices/clean-repository.md similarity index 100% rename from sites/friday/src/learn/bestpractices/clean-repository.md rename to sites/upsun/src/learn/bestpractices/clean-repository.md diff --git a/sites/friday/src/learn/bestpractices/http-caching.md b/sites/upsun/src/learn/bestpractices/http-caching.md similarity index 100% rename from sites/friday/src/learn/bestpractices/http-caching.md rename to sites/upsun/src/learn/bestpractices/http-caching.md diff --git a/sites/friday/src/learn/bestpractices/oneormany.md b/sites/upsun/src/learn/bestpractices/oneormany.md similarity index 98% rename from sites/friday/src/learn/bestpractices/oneormany.md rename to sites/upsun/src/learn/bestpractices/oneormany.md index 73897c918c..12bd881aad 100644 --- a/sites/friday/src/learn/bestpractices/oneormany.md +++ b/sites/upsun/src/learn/bestpractices/oneormany.md @@ -67,7 +67,7 @@ You can have services that are only exposed to another service as well as servic In a clustered application, you can have one of the following configurations: - Multiple [applications](/create-apps/multi-app/_index.md), often in different directories or with separate code bases that deploy separately -- A single app that spawns one or more [worker instances](/create-apps/app-reference.md#workers) that run background processes +- A single app that spawns one or more [worker instances](/create-apps/app-reference/single-runtime-image.md#workers) that run background processes With a clustered application, you often don't need multiple service instances. The [MySQL, MariaDB](/add-services/mysql/_index.md), diff --git a/sites/friday/src/learn/overview/_index.md b/sites/upsun/src/learn/overview/_index.md similarity index 100% rename from sites/friday/src/learn/overview/_index.md rename to sites/upsun/src/learn/overview/_index.md diff --git a/sites/friday/src/learn/overview/build-deploy.md b/sites/upsun/src/learn/overview/build-deploy.md similarity index 100% rename from sites/friday/src/learn/overview/build-deploy.md rename to sites/upsun/src/learn/overview/build-deploy.md diff --git a/sites/friday/src/learn/overview/get-support.md b/sites/upsun/src/learn/overview/get-support.md similarity index 100% rename from sites/friday/src/learn/overview/get-support.md rename to sites/upsun/src/learn/overview/get-support.md diff --git a/sites/friday/src/learn/overview/philosophy.md b/sites/upsun/src/learn/overview/philosophy.md similarity index 100% rename from sites/friday/src/learn/overview/philosophy.md rename to sites/upsun/src/learn/overview/philosophy.md diff --git a/sites/friday/src/learn/overview/structure.md b/sites/upsun/src/learn/overview/structure.md similarity index 100% rename from sites/friday/src/learn/overview/structure.md rename to sites/upsun/src/learn/overview/structure.md diff --git a/sites/friday/src/learn/overview/yaml/_index.md b/sites/upsun/src/learn/overview/yaml/_index.md similarity index 100% rename from sites/friday/src/learn/overview/yaml/_index.md rename to sites/upsun/src/learn/overview/yaml/_index.md diff --git a/sites/friday/src/learn/overview/yaml/platform-yaml-tags.md b/sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md similarity index 100% rename from sites/friday/src/learn/overview/yaml/platform-yaml-tags.md rename to sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md diff --git a/sites/friday/src/learn/overview/yaml/what-is-yaml.md b/sites/upsun/src/learn/overview/yaml/what-is-yaml.md similarity index 100% rename from sites/friday/src/learn/overview/yaml/what-is-yaml.md rename to sites/upsun/src/learn/overview/yaml/what-is-yaml.md diff --git a/sites/friday/src/learn/overview/yaml/yaml-structure.md b/sites/upsun/src/learn/overview/yaml/yaml-structure.md similarity index 79% rename from sites/friday/src/learn/overview/yaml/yaml-structure.md rename to sites/upsun/src/learn/overview/yaml/yaml-structure.md index 9c3723655e..df799abc9f 100644 --- a/sites/friday/src/learn/overview/yaml/yaml-structure.md +++ b/sites/upsun/src/learn/overview/yaml/yaml-structure.md @@ -9,8 +9,8 @@ In addition to the [basic functions you should be familiar with](./what-is-yaml. ## YAML file location -When you run the [`upsun project:init` command](/get-started/express/_index.md#configure-your-project), a default ``config.yaml`` file is generated in the `.upsun` folder. It contains the minimum default configuration based on your detected local stack. -This YAML file is located in your ``.upsun`` directory, at the root of your project source code, and is a good starting point before customization. +When you run the [`{{% vendor/cli %}} project:init` command](/get-started/here/configure/_index.md), a default ``config.yaml`` file is generated in the `.{{% vendor/cli %}}` folder. It contains the minimum default configuration based on your detected local stack. +This YAML file is located in your ``.{{% vendor/cli %}}`` directory, at the root of your project source code, and is a good starting point before customization. ```bash . @@ -20,13 +20,13 @@ This YAML file is located in your ``.upsun`` directory, at the root of your proj ``` ## Mandatory top-level keys In the ``config.yaml`` file, there are only three mandatory top-level YAML keys: -- ``applications``: this section of the file contains all of your [app definitions](/create-apps/app-reference.html) +- ``applications``: this section of the file contains all of your [app definitions](/create-apps/app-reference/single-runtime-image) - ``routes``: this section of the file contains all of your [route definitions](/define-routes.md) (for each of your apps) - ``services``: this section of the file contains all of your [service definitions](/add-services.md) (for each of your apps) This looks like: ```yaml {location="{{< vendor/configfile "apps" >}}"} -{{< code-link destination="/create-apps/app-reference.md" text="applications" title="Complete list of all available properties" >}}: +{{< code-link destination="/create-apps/app-reference/single-runtime-image.html" text="applications" title="Complete list of all available properties" >}}: app: ... @@ -34,7 +34,7 @@ This looks like: mariadb: type: mariadb:10.6 # All available versions are: 10.6, 10.5, 10.4, 10.3 -{{< code-link destination="/define-routes.md" text="routes" title="The routes of the project. Each route describes how an incoming URL is going to be processed by Upsun (Staging). Click for more information." >}}: +{{< code-link destination="/define-routes.md" text="routes" title="The routes of the project. Each route describes how an incoming URL is going to be processed by {{% vendor/name %}} (Staging). Click for more information." >}}: "https://{default}/": type: upstream upstream: "app:http" @@ -50,8 +50,8 @@ Any YAML files located at the first level of your ``.upsun`` folder, at the root The following rules apply to YAML files contained in the ``.upsun`` folder: - All the existing YAML files located at the first level of the ``.upsun`` folder are taken into account. -- All the existing YAML files located at the first level of the ``.upsun`` folder must feature the [mandatory top-level keys](#mandatory-top-level-keys), and must contain a [valid YAML configuration](/create-apps/app-reference.md). -- All the YAML files in subdirectories of the ``.upsun`` folder need to be [manually imported](/learn/overview/yaml/platform-yaml-tags.md#include) and contain a [valid YAML configuration](/create-apps/app-reference.md). +- All the existing YAML files located at the first level of the ``.upsun`` folder must feature the [mandatory top-level keys](#mandatory-top-level-keys), and must contain a [valid YAML configuration](/create-apps/app-reference/single-runtime-image.md). +- All the YAML files in subdirectories of the ``.upsun`` folder need to be [manually imported](/learn/overview/yaml/platform-yaml-tags.md#include) and contain a [valid YAML configuration](/create-apps/app-reference/single-runtime-image.md). {{% note title="Warning" theme="warning"%}} When {{% vendor/name %}} combines all the YAML files located at the first level of the ``.upsun`` folder, only the top-level keys (`applications`, `services`, and `routes`) are merged. So if you define an app named ``app`` in two different YAML files, {{% vendor/name %}} only takes the second one into account. diff --git a/sites/friday/src/learn/tutorials/_index.md b/sites/upsun/src/learn/tutorials/_index.md similarity index 100% rename from sites/friday/src/learn/tutorials/_index.md rename to sites/upsun/src/learn/tutorials/_index.md diff --git a/sites/friday/src/learn/tutorials/dependency-updates.md b/sites/upsun/src/learn/tutorials/dependency-updates.md similarity index 100% rename from sites/friday/src/learn/tutorials/dependency-updates.md rename to sites/upsun/src/learn/tutorials/dependency-updates.md diff --git a/sites/friday/src/learn/tutorials/exporting.md b/sites/upsun/src/learn/tutorials/exporting.md similarity index 99% rename from sites/friday/src/learn/tutorials/exporting.md rename to sites/upsun/src/learn/tutorials/exporting.md index 9f6181887b..c9e65463be 100644 --- a/sites/friday/src/learn/tutorials/exporting.md +++ b/sites/upsun/src/learn/tutorials/exporting.md @@ -59,7 +59,7 @@ title=Using Git ## 2. Download your files Some files might not be stored in Git, -such as data your app writes [in mounts](/create-apps/app-reference.md#mounts). +such as data your app writes [in mounts](/create-apps/app-reference/single-runtime-image.md#mounts). You can download your files [using the CLI](/development/file-transfer.md#transfer-files-using-the-cli) or [using SSH](/development/file-transfer.md#transfer-files-using-an-ssh-client). diff --git a/sites/friday/src/learn/tutorials/migrating/_index.md b/sites/upsun/src/learn/tutorials/migrating/_index.md similarity index 100% rename from sites/friday/src/learn/tutorials/migrating/_index.md rename to sites/upsun/src/learn/tutorials/migrating/_index.md diff --git a/sites/friday/src/learn/tutorials/migrating/from-psh.md b/sites/upsun/src/learn/tutorials/migrating/from-psh.md similarity index 98% rename from sites/friday/src/learn/tutorials/migrating/from-psh.md rename to sites/upsun/src/learn/tutorials/migrating/from-psh.md index 8870ed130b..42d6303fd4 100644 --- a/sites/friday/src/learn/tutorials/migrating/from-psh.md +++ b/sites/upsun/src/learn/tutorials/migrating/from-psh.md @@ -31,7 +31,7 @@ and for some apps, such as Drupal, configuration that you need to export from th title=Using the CLI +++ -If you do not already have an organization created on {{% vendor/name %}}, create one: +If you do not already have an organization created on {{% vendor/name %}}, create one: ```bash {{% vendor/cli %}} org:create @@ -180,7 +180,7 @@ For any potential more details, see the [specific service](/add-services/_index. ## 7. Import files Your app may include content files, meaning files that aren't intended to be part of your codebase so aren't in Git. -You can upload such files to [mounts you created](/create-apps/app-reference.md#mounts). +You can upload such files to [mounts you created](/create-apps/app-reference/single-runtime-image.md#mounts). Upload to each mount separately. Suppose you have the following mounts defined: @@ -197,11 +197,11 @@ mounts: {{< note >}} {{< vendor/name >}} doesn't currently support the same `local` mounts as {{< vendor/psh_ref >}}. -It only supports `tmp`, `storage`, and `service` [mounts](/create-apps/app-reference.md#mounts). +It only supports `tmp`, `storage`, and `service` [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). Before transferring your files, change the `source` of your existing `local` mounts to a supported mount type. {{< /note >}} -For instance: +For instance: ```yaml {configFile="app"} applications: diff --git a/sites/friday/src/learn/tutorials/restrict-service-access.md b/sites/upsun/src/learn/tutorials/restrict-service-access.md similarity index 87% rename from sites/friday/src/learn/tutorials/restrict-service-access.md rename to sites/upsun/src/learn/tutorials/restrict-service-access.md index 5f915fbffe..feb20edbbb 100644 --- a/sites/friday/src/learn/tutorials/restrict-service-access.md +++ b/sites/upsun/src/learn/tutorials/restrict-service-access.md @@ -47,9 +47,14 @@ Edit your app configuration and add new relationships to your new endpoints: ```yaml {configFile="app"} applications: myapp: + [...] relationships: - database: maindb:website - reports: maindb:reporting + database: + service: maindb + endpoint: website + reports: + service: maindb + endpoint: reporting ``` ## 3. Create a worker with access to the read-only endpoint @@ -70,7 +75,9 @@ applications: start: | sleep infinity relationships: - reports: maindb:reporting + reports: + service: maindb + endpoint: reporting access: ssh: viewer ``` diff --git a/sites/friday/src/manage-resources/_index.md b/sites/upsun/src/manage-resources/_index.md similarity index 100% rename from sites/friday/src/manage-resources/_index.md rename to sites/upsun/src/manage-resources/_index.md diff --git a/sites/friday/src/manage-resources/adjust-resources.md b/sites/upsun/src/manage-resources/adjust-resources.md similarity index 98% rename from sites/friday/src/manage-resources/adjust-resources.md rename to sites/upsun/src/manage-resources/adjust-resources.md index 2fd107b118..756c811955 100644 --- a/sites/friday/src/manage-resources/adjust-resources.md +++ b/sites/upsun/src/manage-resources/adjust-resources.md @@ -1,7 +1,7 @@ --- title: Resource configuration description: Configure CPU, RAM, and disk storage on a per-environment basis so your apps and services can run smoothly. -weight: -100 +weight: -200 keywords: - "resources" - "flexible resources" @@ -32,7 +32,8 @@ You can even scale horizontally if your apps are struggling with high load, or i by adding more instances for your apps and workers. For information on costs related to resource usage, see the [{{% vendor/name %}} pricing page](https://upsun.com/pricing/). -To keep an eye on those costs in the Console, see [Resource Billing](/manage-resources/resource-billing.md). + +Note that you can [monitor these costs](/administration/billing/monitor-billing.md) in the Console. ## Vertical scaling diff --git a/sites/upsun/src/manage-resources/build-resources.md b/sites/upsun/src/manage-resources/build-resources.md new file mode 100644 index 0000000000..c559712d24 --- /dev/null +++ b/sites/upsun/src/manage-resources/build-resources.md @@ -0,0 +1,34 @@ +--- +title: Build resources +description: Find out how build resources work on {{% vendor/name %}}. +weight: -50 +--- + +When you push changes to your app through Git, your app is built then deployed. + +During the build phase, {{% vendor/name %}} collects your entire app configuration and creates a build image into a dedicated build container. +The duration of the build phase is directly linked to the amount of resources (CPU and RAM) allocated to that build container. + +As a user, you get the following fixed amount of resources **per project for free**: + +- 2.5 CPU hours +- 5 RAM hours + +If you consume more CPU or RAM, you get charged for them by the hour. +For more information on the costs incurred, see the [{{% vendor/name %}} pricing page](https://upsun.com/pricing/). + +You can adjust build resources through the {{% vendor/name %}} API to mitigate potential overuse, +or influence the duration of your builds. +To do so, run a command similar to the following: + +```bash {location="Terminal"} +{{% vendor/cli %}} project:curl settings -X PATCH -d '{"build_resources": {"cpu": 4.0, "memory": 2048}}' +``` + +{{% note %}} + +Before adding more CPU and RAM to shorten the duration of your builds, +check that your build process supports using such extra resources. +Otherwise, the duration of your builds will remain the same despite adding more resources. + +{{% /note %}} \ No newline at end of file diff --git a/sites/friday/src/manage-resources/resource-billing.md b/sites/upsun/src/manage-resources/resource-billing.md similarity index 99% rename from sites/friday/src/manage-resources/resource-billing.md rename to sites/upsun/src/manage-resources/resource-billing.md index 68276dd2ee..639fc28477 100644 --- a/sites/friday/src/manage-resources/resource-billing.md +++ b/sites/upsun/src/manage-resources/resource-billing.md @@ -1,7 +1,7 @@ --- title: Resource billing description: Keep an eye on costs related to resource usage. -weight: -50 +weight: -100 keywords: - "resources" - "flexible resources" diff --git a/sites/friday/src/manage-resources/resource-init.md b/sites/upsun/src/manage-resources/resource-init.md similarity index 92% rename from sites/friday/src/manage-resources/resource-init.md rename to sites/upsun/src/manage-resources/resource-init.md index e3950e2237..3b2da8da19 100644 --- a/sites/friday/src/manage-resources/resource-init.md +++ b/sites/upsun/src/manage-resources/resource-init.md @@ -1,7 +1,7 @@ --- title: Resource initialization description: Learn how resources are allocated by default upon first deployment, and how you can define a resource initialization strategy that better fits your needs. -weight: -200 +weight: -300 keywords: - "resources" - "flexible resources" @@ -37,7 +37,7 @@ You can also [adjust resources](/manage-resources/adjust-resources.md) after you {{% note %}} For information on costs related to resource usage, see the [{{% vendor/name %}} pricing page](https://upsun.com/pricing/). -Note that you can [keep an eye on those costs](/manage-resources/resource-billing.md) in the Console. +Note that you can [monitor these costs](/administration/billing/monitor-billing.md) in the Console. {{% /note %}} @@ -56,7 +56,7 @@ Note that you can [keep an eye on those costs](/manage-resources/resource-billin {{% note theme="info" title="More information on..."%}}
- Upsun minimum resources + {{% vendor/name %}} minimum resources The following table shows the resources {{% vendor/name %}} allocates to your containers when you opt for the `minimum` [resource initialization strategy](#specify-a-resource-initialization-strategy). @@ -130,13 +130,13 @@ you can use a [Git push option](/environments/_index.md#push-options) to specify To do so, run the following command: ```bash {location="Terminal"} -upsun push --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} push --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `minimum` strategy for your deployment, run the following command: ```bash {location="Terminal"} -upsun push --resources-init=minimum +{{% vendor/cli %}} push --resources-init=minimum ``` {{< note >}} @@ -144,7 +144,7 @@ upsun push --resources-init=minimum Alternatively, you can use the official Git syntax for [push options](/environments/_index.md#push-options): ```bash {location="Terminal"} -git push upsun -o resources.init=minimum +git push {{% vendor/cli %}} -o resources.init=minimum ``` {{< /note >}} @@ -185,13 +185,13 @@ To specify a resource initialization strategy for an existing source integration run the following command: ```bash {location="Terminal"} -upsun integration:update --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} integration:update --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `minimum` strategy for your deployment, run the the following command: ```bash {location="Terminal"} -upsun integration:update --resources-init=minimum +{{% vendor/cli %}} integration:update --resources-init=minimum ``` {{< /codetabs >}} @@ -227,13 +227,13 @@ title=Using the CLI Run the following command: ```bash {location="Terminal"} -upsun environment:branch --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} environment:branch --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `minimum` resource initialization strategy, run the following command: ```bash {location="Terminal"} -upsun environment:branch --resources-init=minimum +{{% vendor/cli %}} environment:branch --resources-init=minimum ``` <---> @@ -280,13 +280,13 @@ title=Using the CLI Run the following command: ```bash {location="Terminal"} -upsun environment:merge --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} environment:merge --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `manual` resource initialization strategy, run the following command: ```bash {location="Terminal"} -upsun environment:merge --resources-init=manual +{{% vendor/cli %}} environment:merge --resources-init=manual ``` <---> @@ -321,13 +321,13 @@ You can also specify a different resource initialization strategy using the CLI. To do so, run the following command: ```bash {location="Terminal"} -upsun environment:activate --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} environment:activate --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `minimum` resource initialization strategy, run the following command: ```bash {location="Terminal"} -upsun environment:activate --resources-init=minimum +{{% vendor/cli %}} environment:activate --resources-init=minimum ``` {{% note %}} @@ -373,13 +373,13 @@ you can specify a different resource initialization strategy for all of them. Run the following command: ```bash {location="Terminal"} -upsun backup:restore --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} +{{% vendor/cli %}} backup:restore --resources-init={{< variable "INITIALIZATION_STRATEGY" >}} ``` For example, to use the `minimum` resource initialization strategy, run the following command: ```bash {location="Terminal"} -upsun backup:restore --resources-init=minimum +{{% vendor/cli %}} backup:restore --resources-init=minimum ``` <---> @@ -433,25 +433,25 @@ Run the following commands depending on your needs: - Sync only resources: ```bash {location="Terminal"} - upsun sync resources + {{% vendor/cli %}} sync resources ``` - Sync only code: ```bash {location="Terminal"} - upsun sync code + {{% vendor/cli %}} sync code ``` - Sync only data: ```bash {location="Terminal"} - upsun sync data + {{% vendor/cli %}} sync data ``` - Sync everything: ```bash {location="Terminal"} - upsun sync code data resources + {{% vendor/cli %}} sync code data resources ``` You can adjust the command depending on the exact combination of elements you want to sync. diff --git a/sites/friday/src/projects/_index.md b/sites/upsun/src/projects/_index.md similarity index 100% rename from sites/friday/src/projects/_index.md rename to sites/upsun/src/projects/_index.md diff --git a/sites/friday/src/projects/change-project-timezone.md b/sites/upsun/src/projects/change-project-timezone.md similarity index 68% rename from sites/friday/src/projects/change-project-timezone.md rename to sites/upsun/src/projects/change-project-timezone.md index 5c7038c9d6..0a05a4316b 100644 --- a/sites/friday/src/projects/change-project-timezone.md +++ b/sites/upsun/src/projects/change-project-timezone.md @@ -7,9 +7,9 @@ The project timezone affects [automated backups](../environments/backup.md). The project timezone doesn't affect: -- [App runtime](../create-apps/timezone.md). -- [Cron jobs](../create-apps/app-reference.md#crons). -- [System logs](../increase-observability/logs/_index.md). UTC is the default timezone for all logs. +- [App runtime](/create-apps/timezone.md). +- [Cron jobs](/create-apps/app-reference/single-runtime-image.md#crons). +- [System logs](/increase-observability/logs/_index.md). UTC is the default timezone for all logs. To change the timezone for a project, follow these steps: diff --git a/sites/friday/src/projects/delete-project.md b/sites/upsun/src/projects/delete-project.md similarity index 100% rename from sites/friday/src/projects/delete-project.md rename to sites/upsun/src/projects/delete-project.md diff --git a/sites/friday/src/projects/region-migration.md b/sites/upsun/src/projects/region-migration.md similarity index 100% rename from sites/friday/src/projects/region-migration.md rename to sites/upsun/src/projects/region-migration.md diff --git a/sites/friday/src/registry/_index.md b/sites/upsun/src/registry/_index.md similarity index 100% rename from sites/friday/src/registry/_index.md rename to sites/upsun/src/registry/_index.md diff --git a/sites/friday/src/registry/images/.gitignore b/sites/upsun/src/registry/images/.gitignore similarity index 100% rename from sites/friday/src/registry/images/.gitignore rename to sites/upsun/src/registry/images/.gitignore diff --git a/sites/friday/src/search.md b/sites/upsun/src/search.md similarity index 100% rename from sites/friday/src/search.md rename to sites/upsun/src/search.md diff --git a/sites/friday/src/security/_index.md b/sites/upsun/src/security/_index.md similarity index 100% rename from sites/friday/src/security/_index.md rename to sites/upsun/src/security/_index.md diff --git a/sites/friday/src/security/data-retention.md b/sites/upsun/src/security/data-retention.md similarity index 81% rename from sites/friday/src/security/data-retention.md rename to sites/upsun/src/security/data-retention.md index 7726e61a43..2346a28a0a 100644 --- a/sites/friday/src/security/data-retention.md +++ b/sites/upsun/src/security/data-retention.md @@ -26,15 +26,9 @@ See how to [access logs](../increase-observability/logs/access-logs.md). When an environment is deleted, its application logs are deleted as well. - ## Backups -[Automated backups](../environments/backup.md#use-automated-backups) are retained for 2 days -(meaning, 2 days worth of backups are retained at any given point). - -[Manual backups](../environments/backup.md#create-a-manual-backup) are retained until you delete them or replace them with another backup.
-As {{< vendor/name >}} provides a maximum of [2 manual backups per environment type](/security/backups.md), -the third manual backup automatically replaces the oldest backup. +The backups retention depends on the [automated backup policy](../environments/backup.md#automated-backups). ## Tombstone backups @@ -51,4 +45,4 @@ We have configured our Google Analytics account to store data for 14 months from ## Trials User data - which includes pushed code and data contained within services - is retained for a shorter period during trials. -See [Trial details](/glossary#trial). \ No newline at end of file +See [Trial details](/glossary#trial). \ No newline at end of file diff --git a/sites/friday/src/security/project-isolation.md b/sites/upsun/src/security/project-isolation.md similarity index 100% rename from sites/friday/src/security/project-isolation.md rename to sites/upsun/src/security/project-isolation.md diff --git a/sites/friday/src/security/waf.md b/sites/upsun/src/security/waf.md similarity index 94% rename from sites/friday/src/security/waf.md rename to sites/upsun/src/security/waf.md index 324a821df1..d50c62722d 100644 --- a/sites/friday/src/security/waf.md +++ b/sites/upsun/src/security/waf.md @@ -84,8 +84,8 @@ enforcing the valid format in transit. The WAF enforces a file upload limit. By default, this limit is set at 250 MB. -You can customize the file upload limit by amending your [app configuration](../../create-apps/_index.md). -In the [`web.locations` dictionary](../../create-apps/app-reference.md#locations), +You can customize the file upload limit by amending your [app configuration](/create-apps/_index.md). +In the [`web.locations` dictionary](/create-apps/app-reference/single-runtime-image.md#locations), add your desired value for the `max_request_size` property. ### File extension restriction @@ -93,8 +93,8 @@ add your desired value for the `max_request_size` property. The WAF enforces any file extension restriction you may have defined in your [app configuration](../../create-apps/_index.md). To set up a file extension restriction, -adjust the [`web.locations` dictionary](../../create-apps/app-reference.md#locations). -Set up [rules](../../create-apps/app-reference.md#rules) to allow only certain file extensions on a given path. +adjust the [`web.locations` dictionary](/create-apps/app-reference/single-runtime-image.md#locations). +Set up [rules](/create-apps/app-reference/single-runtime-image.md#rules) to allow only certain file extensions on a given path. ### Disallowed requests and headers diff --git a/sites/friday/static/files/fetch/.gitignore b/sites/upsun/static/files/fetch/.gitignore similarity index 100% rename from sites/friday/static/files/fetch/.gitignore rename to sites/upsun/static/files/fetch/.gitignore diff --git a/sites/friday/static/files/fetch/examples/golang/memcached b/sites/upsun/static/files/fetch/examples/golang/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/memcached rename to sites/upsun/static/files/fetch/examples/golang/memcached diff --git a/sites/friday/static/files/fetch/examples/golang/mongodb b/sites/upsun/static/files/fetch/examples/golang/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/mongodb rename to sites/upsun/static/files/fetch/examples/golang/mongodb diff --git a/sites/friday/static/files/fetch/examples/golang/mysql b/sites/upsun/static/files/fetch/examples/golang/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/mysql rename to sites/upsun/static/files/fetch/examples/golang/mysql diff --git a/sites/friday/static/files/fetch/examples/golang/postgresql b/sites/upsun/static/files/fetch/examples/golang/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/postgresql rename to sites/upsun/static/files/fetch/examples/golang/postgresql diff --git a/sites/friday/static/files/fetch/examples/golang/rabbitmq b/sites/upsun/static/files/fetch/examples/golang/rabbitmq similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/rabbitmq rename to sites/upsun/static/files/fetch/examples/golang/rabbitmq diff --git a/sites/friday/static/files/fetch/examples/golang/solr b/sites/upsun/static/files/fetch/examples/golang/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/golang/solr rename to sites/upsun/static/files/fetch/examples/golang/solr diff --git a/sites/friday/static/files/fetch/examples/java/elasticsearch b/sites/upsun/static/files/fetch/examples/java/elasticsearch similarity index 100% rename from sites/friday/static/files/fetch/examples/java/elasticsearch rename to sites/upsun/static/files/fetch/examples/java/elasticsearch diff --git a/sites/friday/static/files/fetch/examples/java/kafka b/sites/upsun/static/files/fetch/examples/java/kafka similarity index 100% rename from sites/friday/static/files/fetch/examples/java/kafka rename to sites/upsun/static/files/fetch/examples/java/kafka diff --git a/sites/friday/static/files/fetch/examples/java/memcached b/sites/upsun/static/files/fetch/examples/java/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/java/memcached rename to sites/upsun/static/files/fetch/examples/java/memcached diff --git a/sites/friday/static/files/fetch/examples/java/mongodb b/sites/upsun/static/files/fetch/examples/java/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/java/mongodb rename to sites/upsun/static/files/fetch/examples/java/mongodb diff --git a/sites/friday/static/files/fetch/examples/java/mysql b/sites/upsun/static/files/fetch/examples/java/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/java/mysql rename to sites/upsun/static/files/fetch/examples/java/mysql diff --git a/sites/friday/static/files/fetch/examples/java/postgresql b/sites/upsun/static/files/fetch/examples/java/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/java/postgresql rename to sites/upsun/static/files/fetch/examples/java/postgresql diff --git a/sites/friday/static/files/fetch/examples/java/rabbitmq b/sites/upsun/static/files/fetch/examples/java/rabbitmq similarity index 100% rename from sites/friday/static/files/fetch/examples/java/rabbitmq rename to sites/upsun/static/files/fetch/examples/java/rabbitmq diff --git a/sites/friday/static/files/fetch/examples/java/redis b/sites/upsun/static/files/fetch/examples/java/redis similarity index 100% rename from sites/friday/static/files/fetch/examples/java/redis rename to sites/upsun/static/files/fetch/examples/java/redis diff --git a/sites/friday/static/files/fetch/examples/java/solr b/sites/upsun/static/files/fetch/examples/java/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/java/solr rename to sites/upsun/static/files/fetch/examples/java/solr diff --git a/sites/friday/static/files/fetch/examples/nodejs/elasticsearch b/sites/upsun/static/files/fetch/examples/nodejs/elasticsearch similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/elasticsearch rename to sites/upsun/static/files/fetch/examples/nodejs/elasticsearch diff --git a/sites/friday/static/files/fetch/examples/nodejs/memcached b/sites/upsun/static/files/fetch/examples/nodejs/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/memcached rename to sites/upsun/static/files/fetch/examples/nodejs/memcached diff --git a/sites/friday/static/files/fetch/examples/nodejs/mongodb b/sites/upsun/static/files/fetch/examples/nodejs/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/mongodb rename to sites/upsun/static/files/fetch/examples/nodejs/mongodb diff --git a/sites/friday/static/files/fetch/examples/nodejs/mysql b/sites/upsun/static/files/fetch/examples/nodejs/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/mysql rename to sites/upsun/static/files/fetch/examples/nodejs/mysql diff --git a/sites/friday/static/files/fetch/examples/nodejs/postgresql b/sites/upsun/static/files/fetch/examples/nodejs/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/postgresql rename to sites/upsun/static/files/fetch/examples/nodejs/postgresql diff --git a/sites/friday/static/files/fetch/examples/nodejs/redis b/sites/upsun/static/files/fetch/examples/nodejs/redis similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/redis rename to sites/upsun/static/files/fetch/examples/nodejs/redis diff --git a/sites/friday/static/files/fetch/examples/nodejs/solr b/sites/upsun/static/files/fetch/examples/nodejs/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/nodejs/solr rename to sites/upsun/static/files/fetch/examples/nodejs/solr diff --git a/sites/friday/static/files/fetch/examples/php/elasticsearch b/sites/upsun/static/files/fetch/examples/php/elasticsearch similarity index 100% rename from sites/friday/static/files/fetch/examples/php/elasticsearch rename to sites/upsun/static/files/fetch/examples/php/elasticsearch diff --git a/sites/friday/static/files/fetch/examples/php/influxdb b/sites/upsun/static/files/fetch/examples/php/influxdb similarity index 100% rename from sites/friday/static/files/fetch/examples/php/influxdb rename to sites/upsun/static/files/fetch/examples/php/influxdb diff --git a/sites/friday/static/files/fetch/examples/php/memcached b/sites/upsun/static/files/fetch/examples/php/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/php/memcached rename to sites/upsun/static/files/fetch/examples/php/memcached diff --git a/sites/friday/static/files/fetch/examples/php/mongodb b/sites/upsun/static/files/fetch/examples/php/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/php/mongodb rename to sites/upsun/static/files/fetch/examples/php/mongodb diff --git a/sites/friday/static/files/fetch/examples/php/mysql b/sites/upsun/static/files/fetch/examples/php/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/php/mysql rename to sites/upsun/static/files/fetch/examples/php/mysql diff --git a/sites/friday/static/files/fetch/examples/php/postgresql b/sites/upsun/static/files/fetch/examples/php/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/php/postgresql rename to sites/upsun/static/files/fetch/examples/php/postgresql diff --git a/sites/friday/static/files/fetch/examples/php/rabbitmq b/sites/upsun/static/files/fetch/examples/php/rabbitmq similarity index 100% rename from sites/friday/static/files/fetch/examples/php/rabbitmq rename to sites/upsun/static/files/fetch/examples/php/rabbitmq diff --git a/sites/friday/static/files/fetch/examples/php/redis b/sites/upsun/static/files/fetch/examples/php/redis similarity index 100% rename from sites/friday/static/files/fetch/examples/php/redis rename to sites/upsun/static/files/fetch/examples/php/redis diff --git a/sites/friday/static/files/fetch/examples/php/solr b/sites/upsun/static/files/fetch/examples/php/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/php/solr rename to sites/upsun/static/files/fetch/examples/php/solr diff --git a/sites/friday/static/files/fetch/examples/python/elasticsearch b/sites/upsun/static/files/fetch/examples/python/elasticsearch similarity index 100% rename from sites/friday/static/files/fetch/examples/python/elasticsearch rename to sites/upsun/static/files/fetch/examples/python/elasticsearch diff --git a/sites/friday/static/files/fetch/examples/python/kafka b/sites/upsun/static/files/fetch/examples/python/kafka similarity index 100% rename from sites/friday/static/files/fetch/examples/python/kafka rename to sites/upsun/static/files/fetch/examples/python/kafka diff --git a/sites/friday/static/files/fetch/examples/python/memcached b/sites/upsun/static/files/fetch/examples/python/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/python/memcached rename to sites/upsun/static/files/fetch/examples/python/memcached diff --git a/sites/friday/static/files/fetch/examples/python/mongodb b/sites/upsun/static/files/fetch/examples/python/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/python/mongodb rename to sites/upsun/static/files/fetch/examples/python/mongodb diff --git a/sites/friday/static/files/fetch/examples/python/mysql b/sites/upsun/static/files/fetch/examples/python/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/python/mysql rename to sites/upsun/static/files/fetch/examples/python/mysql diff --git a/sites/friday/static/files/fetch/examples/python/postgresql b/sites/upsun/static/files/fetch/examples/python/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/python/postgresql rename to sites/upsun/static/files/fetch/examples/python/postgresql diff --git a/sites/friday/static/files/fetch/examples/python/rabbitmq b/sites/upsun/static/files/fetch/examples/python/rabbitmq similarity index 100% rename from sites/friday/static/files/fetch/examples/python/rabbitmq rename to sites/upsun/static/files/fetch/examples/python/rabbitmq diff --git a/sites/friday/static/files/fetch/examples/python/redis b/sites/upsun/static/files/fetch/examples/python/redis similarity index 100% rename from sites/friday/static/files/fetch/examples/python/redis rename to sites/upsun/static/files/fetch/examples/python/redis diff --git a/sites/friday/static/files/fetch/examples/python/solr b/sites/upsun/static/files/fetch/examples/python/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/python/solr rename to sites/upsun/static/files/fetch/examples/python/solr diff --git a/sites/friday/static/files/fetch/examples/relationships/elasticsearch b/sites/upsun/static/files/fetch/examples/relationships/elasticsearch similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/elasticsearch rename to sites/upsun/static/files/fetch/examples/relationships/elasticsearch diff --git a/sites/friday/static/files/fetch/examples/relationships/headlesschrome b/sites/upsun/static/files/fetch/examples/relationships/headlesschrome similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/headlesschrome rename to sites/upsun/static/files/fetch/examples/relationships/headlesschrome diff --git a/sites/friday/static/files/fetch/examples/relationships/influxdb b/sites/upsun/static/files/fetch/examples/relationships/influxdb similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/influxdb rename to sites/upsun/static/files/fetch/examples/relationships/influxdb diff --git a/sites/friday/static/files/fetch/examples/relationships/kafka b/sites/upsun/static/files/fetch/examples/relationships/kafka similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/kafka rename to sites/upsun/static/files/fetch/examples/relationships/kafka diff --git a/sites/friday/static/files/fetch/examples/relationships/memcached b/sites/upsun/static/files/fetch/examples/relationships/memcached similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/memcached rename to sites/upsun/static/files/fetch/examples/relationships/memcached diff --git a/sites/friday/static/files/fetch/examples/relationships/mongodb b/sites/upsun/static/files/fetch/examples/relationships/mongodb similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/mongodb rename to sites/upsun/static/files/fetch/examples/relationships/mongodb diff --git a/sites/friday/static/files/fetch/examples/relationships/mysql b/sites/upsun/static/files/fetch/examples/relationships/mysql similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/mysql rename to sites/upsun/static/files/fetch/examples/relationships/mysql diff --git a/sites/friday/static/files/fetch/examples/relationships/opensearch b/sites/upsun/static/files/fetch/examples/relationships/opensearch similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/opensearch rename to sites/upsun/static/files/fetch/examples/relationships/opensearch diff --git a/sites/friday/static/files/fetch/examples/relationships/oraclemysql b/sites/upsun/static/files/fetch/examples/relationships/oraclemysql similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/oraclemysql rename to sites/upsun/static/files/fetch/examples/relationships/oraclemysql diff --git a/sites/friday/static/files/fetch/examples/relationships/postgresql b/sites/upsun/static/files/fetch/examples/relationships/postgresql similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/postgresql rename to sites/upsun/static/files/fetch/examples/relationships/postgresql diff --git a/sites/friday/static/files/fetch/examples/relationships/rabbitmq b/sites/upsun/static/files/fetch/examples/relationships/rabbitmq similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/rabbitmq rename to sites/upsun/static/files/fetch/examples/relationships/rabbitmq diff --git a/sites/friday/static/files/fetch/examples/relationships/redis b/sites/upsun/static/files/fetch/examples/relationships/redis similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/redis rename to sites/upsun/static/files/fetch/examples/relationships/redis diff --git a/sites/friday/static/files/fetch/examples/relationships/solr b/sites/upsun/static/files/fetch/examples/relationships/solr similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/solr rename to sites/upsun/static/files/fetch/examples/relationships/solr diff --git a/sites/friday/static/files/fetch/examples/relationships/vault-kms b/sites/upsun/static/files/fetch/examples/relationships/vault-kms similarity index 100% rename from sites/friday/static/files/fetch/examples/relationships/vault-kms rename to sites/upsun/static/files/fetch/examples/relationships/vault-kms diff --git a/sites/upsun/static/images/billing/billing-alert-button.png b/sites/upsun/static/images/billing/billing-alert-button.png new file mode 100644 index 0000000000..a4abd6b4c5 Binary files /dev/null and b/sites/upsun/static/images/billing/billing-alert-button.png differ diff --git a/sites/upsun/static/images/billing/invoices-tab.png b/sites/upsun/static/images/billing/invoices-tab.png new file mode 100644 index 0000000000..a848daa13a Binary files /dev/null and b/sites/upsun/static/images/billing/invoices-tab.png differ diff --git a/sites/upsun/static/images/billing/organization-billing.png b/sites/upsun/static/images/billing/organization-billing.png new file mode 100644 index 0000000000..735a00e8f1 Binary files /dev/null and b/sites/upsun/static/images/billing/organization-billing.png differ diff --git a/sites/upsun/static/images/billing/project-billing.png b/sites/upsun/static/images/billing/project-billing.png new file mode 100644 index 0000000000..79ed50686c Binary files /dev/null and b/sites/upsun/static/images/billing/project-billing.png differ diff --git a/sites/friday/static/images/console/create-project.png b/sites/upsun/static/images/console/create-project.png similarity index 100% rename from sites/friday/static/images/console/create-project.png rename to sites/upsun/static/images/console/create-project.png diff --git a/sites/friday/static/images/console/first-fail.png b/sites/upsun/static/images/console/first-fail.png similarity index 100% rename from sites/friday/static/images/console/first-fail.png rename to sites/upsun/static/images/console/first-fail.png diff --git a/sites/friday/static/images/console/settings-access-users.png b/sites/upsun/static/images/console/settings-access-users.png similarity index 100% rename from sites/friday/static/images/console/settings-access-users.png rename to sites/upsun/static/images/console/settings-access-users.png diff --git a/sites/friday/static/images/console/settings-general.png b/sites/upsun/static/images/console/settings-general.png similarity index 100% rename from sites/friday/static/images/console/settings-general.png rename to sites/upsun/static/images/console/settings-general.png diff --git a/sites/friday/static/images/console/upsun-console-main-view.png b/sites/upsun/static/images/console/upsun-console-main-view.png similarity index 100% rename from sites/friday/static/images/console/upsun-console-main-view.png rename to sites/upsun/static/images/console/upsun-console-main-view.png diff --git a/sites/friday/static/images/favicon.ico b/sites/upsun/static/images/favicon.ico similarity index 100% rename from sites/friday/static/images/favicon.ico rename to sites/upsun/static/images/favicon.ico diff --git a/sites/friday/static/images/flexible-resources/apps-services-tree.png b/sites/upsun/static/images/flexible-resources/apps-services-tree.png similarity index 100% rename from sites/friday/static/images/flexible-resources/apps-services-tree.png rename to sites/upsun/static/images/flexible-resources/apps-services-tree.png diff --git a/sites/friday/static/images/flexible-resources/check-container-profile.png b/sites/upsun/static/images/flexible-resources/check-container-profile.png similarity index 100% rename from sites/friday/static/images/flexible-resources/check-container-profile.png rename to sites/upsun/static/images/flexible-resources/check-container-profile.png diff --git a/sites/friday/static/images/flexible-resources/configure-button-project-card.png b/sites/upsun/static/images/flexible-resources/configure-button-project-card.png similarity index 100% rename from sites/friday/static/images/flexible-resources/configure-button-project-card.png rename to sites/upsun/static/images/flexible-resources/configure-button-project-card.png diff --git a/sites/friday/static/images/flexible-resources/configure-flexible-resources.png b/sites/upsun/static/images/flexible-resources/configure-flexible-resources.png similarity index 100% rename from sites/friday/static/images/flexible-resources/configure-flexible-resources.png rename to sites/upsun/static/images/flexible-resources/configure-flexible-resources.png diff --git a/sites/friday/static/images/guides/laravel-ify.png b/sites/upsun/static/images/guides/laravel-ify.png similarity index 100% rename from sites/friday/static/images/guides/laravel-ify.png rename to sites/upsun/static/images/guides/laravel-ify.png diff --git a/sites/upsun/static/images/guides/laravel/horizon-dashboard.png b/sites/upsun/static/images/guides/laravel/horizon-dashboard.png new file mode 100644 index 0000000000..7a42861533 Binary files /dev/null and b/sites/upsun/static/images/guides/laravel/horizon-dashboard.png differ diff --git a/sites/upsun/static/images/guides/laravel/horizon-resources.png b/sites/upsun/static/images/guides/laravel/horizon-resources.png new file mode 100644 index 0000000000..7ba06b38be Binary files /dev/null and b/sites/upsun/static/images/guides/laravel/horizon-resources.png differ diff --git a/sites/upsun/static/images/guides/laravel/telescope-dashboard.png b/sites/upsun/static/images/guides/laravel/telescope-dashboard.png new file mode 100644 index 0000000000..a2e303236d Binary files /dev/null and b/sites/upsun/static/images/guides/laravel/telescope-dashboard.png differ diff --git a/sites/friday/static/images/guides/resources-cli-picker.gif b/sites/upsun/static/images/guides/resources-cli-picker.gif similarity index 100% rename from sites/friday/static/images/guides/resources-cli-picker.gif rename to sites/upsun/static/images/guides/resources-cli-picker.gif diff --git a/sites/friday/static/images/logo.svg b/sites/upsun/static/images/logo.svg similarity index 100% rename from sites/friday/static/images/logo.svg rename to sites/upsun/static/images/logo.svg diff --git a/sites/friday/static/images/logo_vertical.svg b/sites/upsun/static/images/logo_vertical.svg similarity index 100% rename from sites/friday/static/images/logo_vertical.svg rename to sites/upsun/static/images/logo_vertical.svg diff --git a/sites/friday/static/images/observability/cont-prof-color-code.png b/sites/upsun/static/images/observability/cont-prof-color-code.png similarity index 100% rename from sites/friday/static/images/observability/cont-prof-color-code.png rename to sites/upsun/static/images/observability/cont-prof-color-code.png diff --git a/sites/friday/static/images/observability/filtering-upsun.png b/sites/upsun/static/images/observability/filtering-upsun.png similarity index 100% rename from sites/friday/static/images/observability/filtering-upsun.png rename to sites/upsun/static/images/observability/filtering-upsun.png diff --git a/sites/friday/static/images/observability/flame-graph-clicked.png b/sites/upsun/static/images/observability/flame-graph-clicked.png similarity index 100% rename from sites/friday/static/images/observability/flame-graph-clicked.png rename to sites/upsun/static/images/observability/flame-graph-clicked.png diff --git a/sites/friday/static/images/observability/flame-graph-hover.png b/sites/upsun/static/images/observability/flame-graph-hover.png similarity index 100% rename from sites/friday/static/images/observability/flame-graph-hover.png rename to sites/upsun/static/images/observability/flame-graph-hover.png diff --git a/sites/friday/static/images/observability/flame-graph.png b/sites/upsun/static/images/observability/flame-graph.png similarity index 100% rename from sites/friday/static/images/observability/flame-graph.png rename to sites/upsun/static/images/observability/flame-graph.png diff --git a/sites/friday/static/images/observability/metrics/mysql-container.png b/sites/upsun/static/images/observability/metrics/mysql-container.png similarity index 100% rename from sites/friday/static/images/observability/metrics/mysql-container.png rename to sites/upsun/static/images/observability/metrics/mysql-container.png diff --git a/sites/friday/static/images/observability/metrics/redis-container.png b/sites/upsun/static/images/observability/metrics/redis-container.png similarity index 100% rename from sites/friday/static/images/observability/metrics/redis-container.png rename to sites/upsun/static/images/observability/metrics/redis-container.png diff --git a/sites/friday/static/images/observability/metrics/service-container-minimized.png b/sites/upsun/static/images/observability/metrics/service-container-minimized.png similarity index 100% rename from sites/friday/static/images/observability/metrics/service-container-minimized.png rename to sites/upsun/static/images/observability/metrics/service-container-minimized.png diff --git a/sites/friday/static/images/observability/sandwich-view.png b/sites/upsun/static/images/observability/sandwich-view.png similarity index 100% rename from sites/friday/static/images/observability/sandwich-view.png rename to sites/upsun/static/images/observability/sandwich-view.png diff --git a/sites/friday/static/images/observability/table-view.png b/sites/upsun/static/images/observability/table-view.png similarity index 100% rename from sites/friday/static/images/observability/table-view.png rename to sites/upsun/static/images/observability/table-view.png diff --git a/sites/friday/static/scripts/xss/.babelrc b/sites/upsun/static/scripts/xss/.babelrc similarity index 100% rename from sites/friday/static/scripts/xss/.babelrc rename to sites/upsun/static/scripts/xss/.babelrc diff --git a/sites/friday/static/scripts/xss/.eslintrc.json b/sites/upsun/static/scripts/xss/.eslintrc.json similarity index 100% rename from sites/friday/static/scripts/xss/.eslintrc.json rename to sites/upsun/static/scripts/xss/.eslintrc.json diff --git a/sites/friday/static/scripts/xss/.gitignore b/sites/upsun/static/scripts/xss/.gitignore similarity index 100% rename from sites/friday/static/scripts/xss/.gitignore rename to sites/upsun/static/scripts/xss/.gitignore diff --git a/sites/friday/static/scripts/xss/.gitkeep b/sites/upsun/static/scripts/xss/.gitkeep similarity index 100% rename from sites/friday/static/scripts/xss/.gitkeep rename to sites/upsun/static/scripts/xss/.gitkeep diff --git a/sites/friday/static/scripts/xss/README.md b/sites/upsun/static/scripts/xss/README.md similarity index 100% rename from sites/friday/static/scripts/xss/README.md rename to sites/upsun/static/scripts/xss/README.md diff --git a/sites/friday/static/scripts/xss/dist/.gitkeep b/sites/upsun/static/scripts/xss/dist/.gitkeep similarity index 100% rename from sites/friday/static/scripts/xss/dist/.gitkeep rename to sites/upsun/static/scripts/xss/dist/.gitkeep diff --git a/sites/friday/static/scripts/xss/dist/config/.gitkeep b/sites/upsun/static/scripts/xss/dist/config/.gitkeep similarity index 100% rename from sites/friday/static/scripts/xss/dist/config/.gitkeep rename to sites/upsun/static/scripts/xss/dist/config/.gitkeep diff --git a/sites/friday/static/scripts/xss/package.json b/sites/upsun/static/scripts/xss/package.json similarity index 100% rename from sites/friday/static/scripts/xss/package.json rename to sites/upsun/static/scripts/xss/package.json diff --git a/sites/friday/static/scripts/xss/src/App.js b/sites/upsun/static/scripts/xss/src/App.js similarity index 100% rename from sites/friday/static/scripts/xss/src/App.js rename to sites/upsun/static/scripts/xss/src/App.js diff --git a/sites/friday/static/scripts/xss/src/components/Suggestions.js b/sites/upsun/static/scripts/xss/src/components/Suggestions.js similarity index 100% rename from sites/friday/static/scripts/xss/src/components/Suggestions.js rename to sites/upsun/static/scripts/xss/src/components/Suggestions.js diff --git a/sites/friday/static/scripts/xss/src/components/SuggestionsPrimary.js b/sites/upsun/static/scripts/xss/src/components/SuggestionsPrimary.js similarity index 100% rename from sites/friday/static/scripts/xss/src/components/SuggestionsPrimary.js rename to sites/upsun/static/scripts/xss/src/components/SuggestionsPrimary.js diff --git a/sites/friday/static/scripts/xss/src/containers/Search.js b/sites/upsun/static/scripts/xss/src/containers/Search.js similarity index 100% rename from sites/friday/static/scripts/xss/src/containers/Search.js rename to sites/upsun/static/scripts/xss/src/containers/Search.js diff --git a/sites/friday/static/scripts/xss/src/index.js b/sites/upsun/static/scripts/xss/src/index.js similarity index 100% rename from sites/friday/static/scripts/xss/src/index.js rename to sites/upsun/static/scripts/xss/src/index.js diff --git a/sites/friday/static/scripts/xss/webpack.common.js b/sites/upsun/static/scripts/xss/webpack.common.js similarity index 100% rename from sites/friday/static/scripts/xss/webpack.common.js rename to sites/upsun/static/scripts/xss/webpack.common.js diff --git a/sites/friday/static/scripts/xss/webpack.dev.js b/sites/upsun/static/scripts/xss/webpack.dev.js similarity index 100% rename from sites/friday/static/scripts/xss/webpack.dev.js rename to sites/upsun/static/scripts/xss/webpack.dev.js diff --git a/sites/friday/static/scripts/xss/webpack.prod.js b/sites/upsun/static/scripts/xss/webpack.prod.js similarity index 100% rename from sites/friday/static/scripts/xss/webpack.prod.js rename to sites/upsun/static/scripts/xss/webpack.prod.js diff --git a/sites/friday/utils/common.mjs b/sites/upsun/utils/common.mjs similarity index 100% rename from sites/friday/utils/common.mjs rename to sites/upsun/utils/common.mjs diff --git a/sites/friday/utils/fetch-examples.mjs b/sites/upsun/utils/fetch-examples.mjs similarity index 100% rename from sites/friday/utils/fetch-examples.mjs rename to sites/upsun/utils/fetch-examples.mjs diff --git a/sites/friday/utils/fetchTemplates.mjs b/sites/upsun/utils/fetchTemplates.mjs similarity index 100% rename from sites/friday/utils/fetchTemplates.mjs rename to sites/upsun/utils/fetchTemplates.mjs diff --git a/sites/friday/utils/updateExampleConfigFiles.js b/sites/upsun/utils/updateExampleConfigFiles.js similarity index 100% rename from sites/friday/utils/updateExampleConfigFiles.js rename to sites/upsun/utils/updateExampleConfigFiles.js diff --git a/themes/psh-docs/layouts/partials/beta-features/badge.html b/themes/psh-docs/layouts/partials/beta-features/badge.html new file mode 100644 index 0000000000..9d9c4cfa00 --- /dev/null +++ b/themes/psh-docs/layouts/partials/beta-features/badge.html @@ -0,0 +1 @@ +Beta \ No newline at end of file diff --git a/themes/psh-docs/layouts/partials/beta-features/banner.html b/themes/psh-docs/layouts/partials/beta-features/banner.html new file mode 100644 index 0000000000..881439b315 --- /dev/null +++ b/themes/psh-docs/layouts/partials/beta-features/banner.html @@ -0,0 +1,7 @@ +
+ +

{{ .title }}

+ +

{{ .content | .context.Page.RenderString }}

+ +
\ No newline at end of file diff --git a/themes/psh-docs/layouts/partials/examples/relationship.html b/themes/psh-docs/layouts/partials/examples/relationship.html index 6f26e7785b..3bf890a41b 100644 --- a/themes/psh-docs/layouts/partials/examples/relationship.html +++ b/themes/psh-docs/layouts/partials/examples/relationship.html @@ -2,26 +2,35 @@ Note: This will only replace the endpoint and service type for demonstration purposes. To use this partial, pass the image data as the context (Ex: partial "examples/relationship" $data) --> -{{- $apiIndent := " " -}} -{{- $versionPrefix := "" -}} -{{- $relationshipName := "" -}} -{{- if ( .relName ) -}} - {{- $relationshipName = .relName -}} -{{- end -}} -{{- $serviceName := "" -}} -{{- if ( .servName ) -}} - {{- $serviceName = .servName -}} -{{- end -}} -{{ $relationshipComment := "# Relationships enable access from this app to a given service." }} - -{{- $l1 := printf "\n%s\nrelationships:" $relationshipComment}} - -{{- $endpoint := index .data "endpoint" -}} - -{{- if eq (index .data "type") "vault-kms" -}} - {{- $endpoint = "" -}} -{{- end -}} - -{{- $l2 := printf "%s%s: \"%s:%s\"" $apiIndent $relationshipName $serviceName $endpoint -}} - -{{- printf "%s\n%s" $l1 $l2 | safeHTML -}} + {{- $apiIndent := " " -}} + {{- $versionPrefix := "" -}} + {{- $relationshipName := "" -}} + {{- if ( .relName ) -}} + {{- $relationshipName = .relName -}} + {{- end -}} + {{- $serviceName := "" -}} + {{- if ( .servName ) -}} + {{- $serviceName = .servName -}} + {{- end -}} + {{ $relationshipComment := "# Relationships enable access from this app to a given service." }} + {{ $relationshipComment = printf "%s\n# The example below shows simplified configuration leveraging a default service" $relationshipComment}} + {{ $relationshipComment = printf "%s\n# (identified from the relationship name) and a default endpoint." $relationshipComment}} + {{ $relationshipComment = printf "%s\n# See the Application reference for all options for defining relationships and endpoints." $relationshipComment}} + + {{- $l1 := printf "%s\nrelationships:" $relationshipComment}} + + {{- $endpoint := index .data "endpoint" -}} + + {{- if eq (index .data "type") "vault-kms" -}} + {{- $endpoint = "" -}} + {{- end -}} + + {{- $l2 := printf "%s%s:\n service: %s\n endpoint: %s" $apiIndent $relationshipName $serviceName $endpoint -}} + {{- $l2_updated := printf "%s%s: " $apiIndent $serviceName -}} + + {{- if eq (index .data "type") "vault-kms" -}} + {{- printf "%s\n%s" $l1 $l2 | safeHTML -}} + {{- else -}} + {{- printf "%s\n%s" $l1 $l2_updated | safeHTML | chomp -}} + {{- end -}} + \ No newline at end of file diff --git a/themes/psh-docs/layouts/partials/examples/servicedefn.html b/themes/psh-docs/layouts/partials/examples/servicedefn.html index b7df39e9e5..bd430bc116 100644 --- a/themes/psh-docs/layouts/partials/examples/servicedefn.html +++ b/themes/psh-docs/layouts/partials/examples/servicedefn.html @@ -19,7 +19,12 @@ {{- $relName = .relName -}} {{- end -}} -{{- $l2 := printf "%s type: %s:%s" $apiIndent (index .data "type") $serviceVersion -}} +{{- $useType := index .data "type" -}} +{{- if ne .type (index .data "type") -}} + {{- $useType = .type -}} +{{- end -}} + +{{- $l2 := printf "%s type: %s:%s" $apiIndent $useType $serviceVersion -}} {{- $l3 := "" -}} {{- if (index .data "disk") -}} {{- if eq $docVersion 1 -}} @@ -44,4 +49,4 @@ {{- end -}} -{{ printf "%s\n%s%s%s%s" $l1 $l2 $l3 $l4 $l5 | safeHTML }} +{{ printf "%s%s%s%s%s" $l1 $l2 $l3 $l4 $l5 | safeHTML }} diff --git a/themes/psh-docs/layouts/partials/note.html b/themes/psh-docs/layouts/partials/note.html index b4bb889c65..aec750b9eb 100644 --- a/themes/psh-docs/layouts/partials/note.html +++ b/themes/psh-docs/layouts/partials/note.html @@ -9,9 +9,11 @@ {{ $bg = "pink-light" }} {{ else if eq . "info" }} {{ $bg = "skye-light" }} + {{ else if eq . "info-sticky" }} + {{ $bg = "skye-light" }} {{ end }} {{ end }} -