{"id":13697381,"url":"https://github.com/platformsh/snippets","last_synced_at":"2026-01-20T16:50:17.182Z","repository":{"id":39889356,"uuid":"468368171","full_name":"platformsh/snippets","owner":"platformsh","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-10T17:50:43.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-11-13T01:34:07.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/platformsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-10T14:05:22.000Z","updated_at":"2024-07-10T17:50:44.000Z","dependencies_parsed_at":"2024-07-10T20:47:27.026Z","dependency_job_id":"42cf30c4-3380-47de-b10f-0fb28ef9527d","html_url":"https://github.com/platformsh/snippets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platformsh%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platformsh%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platformsh%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platformsh%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/platformsh","download_url":"https://codeload.github.com/platformsh/snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252252479,"owners_count":21718748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:00:57.237Z","updated_at":"2026-01-20T16:50:17.153Z","avatar_url":"https://github.com/platformsh.png","language":"Shell","funding_links":[],"categories":["Code Snippets"],"sub_categories":[],"readme":"\n\u003cbr /\u003e\n\u003cp align=\"left\"\u003e\n    \u003ca href=\"https://platform.sh\"\u003e\n        \u003cimg src=\"https://platform.sh/logos/redesign/Platformsh_logo_black.svg\" width=\"150px\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://docs.platform.sh\"\u003e\n        \u003cimg src=\"https://platform.sh/images/deploy/console.svg\" alt=\"Logo\" height=\"200\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\n\u003ch1 align=\"center\"\u003ePlatform.sh Template Snippets\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cstrong\u003eContribute to the Platform.sh knowledge base, or check out our resources\u003c/strong\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://community.platform.sh\"\u003e\u003cstrong\u003eJoin our community\u003c/strong\u003e\u003c/a\u003e\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\n    \u003ca href=\"https://platform.sh/blog\"\u003e\u003cstrong\u003eBlog\u003c/strong\u003e\u003c/a\u003e\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\n    \u003ca href=\"https://docs.platform.sh\"\u003e\u003cstrong\u003eDocumentation\u003c/strong\u003e\u003c/a\u003e\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\u0026nbsp\n    \u003cbr /\u003e\u003cbr /\u003e\n\u003c/p\u003e\n\nPlatform.sh maintains a list of scripts that may be used within the template to ease its fine-tuning.\n\n## Contents:\n* [`raw.githubusercontent.com rate limit`](#rawgithubusercontentcom-rate-limit)\n* [`Install a specific version of Node on non-Node JS container`](#Install-a-specific-version-of-Node-on-non-Node-JS-container)\n* [`Platformify script`](#platformify-script)\n* [`Install Swoole`](#install-swoole)\n\n### raw.githubusercontent.com rate limit\n\nOn rare occasion, the rate limit on `raw.githubusercontent.com` my be hit. It can\nthen be recommended to use a [Personal Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to benefit\nfrom a much higher rate limit.\n\n```\ncurl -H \"Authorization: Bearer PERSONAL_TOKEN\" -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/script.sh | { bash /dev/fd/3 PARAMETERS; } 3\u003c\u00260\n```\n\n### Install a specific version of Node on non-Node JS container\n\nThe [documentation](https://docs.platform.sh/languages/nodejs.html) describes how\nto specify the Node version to use and/or how to add Yarn to the NodeJS container.\n\nFor other containers, such as the PHP one, it may be needed to rely on a specific\nversion of NodeJS, and use Yarn as well.\n\n#### Install the LTS version of node\n```\nexport N_PREFIX=$HOME/.n\nexport PATH=$N_PREFIX/bin:$PATH\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install_node.sh | { bash /dev/fd/3 -v lts; } 3\u003c\u00260\n```\n\n#### Install the 17.5 version of node with Yarn\n```\nexport N_PREFIX=$HOME/.n\nexport PATH=$N_PREFIX/bin:$PATH\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install_node.sh | { bash /dev/fd/3 -v 17.5 -y; } 3\u003c\u00260\n```\n\n#### Use\n\nAn example build hook is listed below. If using this snippet, do not add `corepack` as a [build dependency as outlined in the Platform.sh documentation](https://docs.platform.sh/languages/nodejs.html#use-yarn-as-a-package-manager), as it is already done for you. With the `-y` flag, the hook below will install Node.js 14.19.0 along with Yarn, afterwhich yarn commands can be run through corepack.\n\n```yaml\nname: app\ntype: php:8.0\ndependencies:\n    php:\n        composer/composer: '^2'\nvariables:\n    env:\n        NODE_VERSION: v14.19.0\nbuild:\n    flavor: none\nhooks:\n    build: |\n        set -e \n        composer install\n        \n        export N_PREFIX=$HOME/.n\n        export PATH=$N_PREFIX/bin:$PATH\n        curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install_node.sh | { bash /dev/fd/3 -v $NODE_VERSION -y; } 3\u003c\u00260\n        \n        PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 corepack yarn install\n        PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 corepack yarn packages:build\n        corepack yarn run less\n        corepack yarn run webpack\n```\n\n\u003e **Note:**\n\u003e\n\u003e By default, `n` will try and install to `/usr/local/n`, which is not allowed on Platform.sh. You can instead specify the install location using the [variable `N_PREFIX` and then adding to `PATH`](https://github.com/tj/n#optional-environment-variables). If you will also need `n` outside of the build hook, add the two `export` lines to `.environment` as well. \n\n### Platformify script\n\nThe `platformify` script will download the `.platform.app.yaml` file and all the\nfiles needed to run a specific project on Platform.sh.\n\nTo platformify a Laravel project:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/platformify.sh | { bash /dev/fd/3 -t laravel ; } 3\u003c\u00260\n```\n\nTo platformify a Laravel project and a speficic folder:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/platformify.sh | { bash /dev/fd/3 -t laravel -p path/to/dir ; } 3\u003c\u00260\n```\n\nWhen ran on an empty folder, the script will clone the full template.\n\n### Install Swoole\n\nThe `install_swoole` script will install and enable the Swoole or Open Swoole extension in a PHP container.\n\nTo install Open Swoole v4.11.0:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install_swoole.sh | { bash /dev/fd/3 openswoole 4.11.0 ; } 3\u003c\u00260\n```\n\nTo install Swoole v4.8.10:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install_swoole.sh | { bash /dev/fd/3 swoole 4.8.10 ; } 3\u003c\u00260\n```\n\n### Install Relay (Redis)\n\nThe `install-relay` script will install and enable the [Relay](https://relay.so) extension in a PHP container.\n\nTo install Relay v0.6.0:\nNote the version should be prefixed with `v` (**v**0.6.0)\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 v0.6.0 ; } 3\u003c\u00260\n```\n\nTo install Relay @dev:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 dev ; } 3\u003c\u00260\n```\n\n### Install PhpRedis (Redis)\n\nThe `install-phpredis` script will install and enable the [PhpRedis](https://github.com/phpredis/phpredis) extension in a PHP container.\n\nTo install PhpRedis v5.1.1:\n```\ncurl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-phpredis.sh | { bash /dev/fd/3 5.1.1 ; } 3\u003c\u00260\n```\n\n### Region audit\n\nThe `region-audit` script with list projects within a Platform.sh or Upsun organization that are deployed to some subset of regions.\n\nTo run the script for Platform.sh\n\n```bash\nhttps://raw.githubusercontent.com/platformsh/snippets/main/src/region-audit.sh | bash -s -- [ORG_NAME] [REGIONS] [platform|upsun]\n```\n\nFor example\n\n```bash\nhttps://raw.githubusercontent.com/platformsh/snippets/main/src/region-audit.sh | bash -s -- my-org ch-1,uk-1,de-2,us-4 platform\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatformsh%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplatformsh%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatformsh%2Fsnippets/lists"}