This is a quick way to find a random free port on a system using PHP:
$port = find_free_port();
Benchmarked locally, where finding a port always took around 0.15ms.
- pipeline: "Build and deploy to [environment]" | |
trigger_mode: "MANUAL" | |
ref_name: "master" | |
actions: | |
- action: "Execute: gulp build" | |
type: "BUILD" | |
docker_image_name: "library/node" | |
docker_image_tag: "6" | |
execute_commands: | |
- "npm install" |
if [ -d "releases/${execution.to_revision.revision}" ] && [ "${execution.refresh}" = "true" ]; then echo "Removing: releases/${execution.to_revision.revision}" && rm -rf releases/${execution.to_revision.revision}; fi
if [ ! -d "releases/${execution.to_revision.revision}" ]; then echo "Creating: releases/${execution.to_revision.revision}" && cp -dR deploy-cache releases/${execution.to_revision.revision}; fi
echo "Creating: persistence directories"
mkdir -p storage/craft
mkdir -p storage/cpresources
mkdir -p storage/uploads
CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control
and E-Tag
headers, etc.), minification, etc.