Skip to content

Instantly share code, notes, and snippets.

View devicezero's full-sized avatar

jonas devicezero

View GitHub Profile
@devicezero
devicezero / ecosystem.config.js
Last active June 7, 2024 11:14
pm2 nuxt js example
// production usage at your own risk
const fs = require("fs");
let numberOfProcesses = 1;
let maxMemory = 128;
let maxMemoryPerInstance = 128;
if (fs.existsSync("/run/config.json")) {
const pshConfig = require("/run/config.json");
// on grid environments, we don't want to round up to not run too many processes

With Platform.sh you can decide how you organize branches; the branches do not have to be strictly hierarchical. E.g.:

production
- develop
-- feature/xxx
- staging
-- feature/xxx

Let's say that production and stage are dedicated, the others are on-demand environments that can be temporary. This means you can also deploy from develop to production or add an emergency hotfix branch like so:

## Test on:https://trunk-hy2b2li-rk425yy73kk4w.us-4.platformsh.site/
Scores:
**dom-size:** 1
**preload-lcp-image:** 1
**uses-passive-event-listeners:** 1
**mainthread-work-breakdown:** 1
**interactive:** 1
**efficient-animated-content:** 1
@devicezero
devicezero / platform-list.txt
Created January 27, 2022 07:15
platform list
Platform.sh CLI 3.73.2
Global options:
--help -h Display this help message
--quiet -q Do not output any message
--verbose -v|vv|vvv Increase the verbosity of messages
--version -V Display this application version
--yes -y Answer "yes" to any yes/no questions; disable interaction
--no -n Answer "no" to any yes/no questions; disable interaction
@devicezero
devicezero / ecosystem.config.js
Last active January 27, 2022 15:32
ecosystem.config.js example for psh number of cpus
const fs = require("fs");
let numberOfProcesses = 1;
let maxMemory = 64;
// use number of cpus from config.json on grid
if (fs.existsSync("/run/config.json")) {
const pshConfig = require("/run/config.json");
numberOfProcesses = Math.ceil(pshConfig.info.limits.cpu);
maxMemory = pshConfig.info.limits.memory;
}
variables:
env:
# Update these for your desired NVM and Node versions.
NVM_VERSION: v0.38.0
NODE_VERSION: v12.22.1
hooks:
build: |
unset NPM_CONFIG_PREFIX
#!/bin/bash
# usage: e.g. delete-user.sh 'foobar@example.com'
# get project list
projects_list=$(platform project:list --pipe)
# transform into an array, so we can loop over projects
projects=($projects_list)
# first command line option of this script is the email adress of the user we want to remove
email=$1
@devicezero
devicezero / 0001-add-platorm.sh-config.patch
Last active September 16, 2020 10:36
0001-add-platorm.sh-config.patch
diff --git a/.platform.app.yaml b/.platform.app.yaml
new file mode 100644
index 0000000..66322f9
--- /dev/null
+++ b/.platform.app.yaml
@@ -0,0 +1,166 @@
+# This file describes an application. You can have multiple applications
+# in the same project.
+
+# The name of this app. Must be unique within a project.
@devicezero
devicezero / gist:4a25364a9a53c7e524bdedc9de6b6005
Last active September 16, 2020 10:37
update shopware6 production template with platform.sh config
curl https://gist.githubusercontent.com/devicezero/998ed475a41a236347334b27812ced47/raw > 0001-add-platorm.sh-config.patch
git clone git@github.com:shopware/production.git
cd production
git apply ../0001-add-platorm.sh-config.patch
rm -rf .git
rm composer.lock
composer install
rsync -av --progress --exclude 'vendor' . TARGET_FOLDER