Search by

tresbientech / drupack

theodoreb

This package is abandoned and no longer maintained. The author suggests using the drupal/drupack package instead.

Installs drupack, which serves a Drupal project with its own PHP and web server, into the project root.

Package info

github.com/tresbientech/drupack

Language:Go

Type:composer-plugin

pkg:composer/tresbientech/drupack

Statistics

Installs: 68

Dependents: 0

Suggesters: 0

Stars: 5


README

Drupack runs Drupal from a single executable that contains PHP, FrankenPHP and Caddy. It does two things:

  • drupack serves a Drupal project that you already have, with the project's own settings, database and Drush.
  • A build packs your Composer project into an executable of its own, which installs and serves the site with nothing else on the machine. Build your own site covers it.

From 1.0.0, the commands, options and settings of drupack stay the same in every 1.x release. Stability lists them. Packaged sites are experimental: a minor release may change the build, drupack.yml and Site data.

Serve a Drupal project you already have

Install drupack in the project's root on Linux or macOS with Apple silicon, then start it there:

cd path/to/your/project
curl -fsSL https://drupack.tresbien.tech/install.sh | sh
./drupack

On Windows, in PowerShell:

cd path\to\your\project
irm https://drupack.tresbien.tech/install.ps1 | iex
.\drupack.exe

The script installs the build for your system into the current directory and checks the SHA-256 of what it downloads. A file that already matches stays. Each project has its own drupack, so each one stays on the version that it installed.

A Composer project can pin drupack instead:

composer require 'drupal/drupack:^1.0@RC'
./drupack

The package is a Composer plugin, which Composer prompts you to trust once. A y writes allow-plugins.drupal/drupack into composer.json. From then on, composer install and composer update install this system's build of the package's version, on a server too. A build that already matches stays. Commit that entry first when a deploy has no terminal. A project that runs drupack-install from its own scripts removes them.

drupack serves the project in the working directory on http://127.0.0.1:3787 and prints a login link that works one time. It continues to serve in the background, and drupack stop stops it. The project's settings.php has the settings for the database and the paths of the files. Drupack writes nothing into the project, apart from the composer install that a start runs after a yes or with --yes.

  • drupack composer install installs a fresh clone with the Composer that drupack contains. On a terminal, a start of a fresh clone prompts you to run it first, and drupack --yes runs it without a prompt.
  • drupack composer create-project drupal/cms my-site creates a Drupal project, with no PHP on the machine. From inside it, ../drupack serves it.
  • drupack drush COMMAND runs the project's own Drush on the bundled PHP.
  • drupack php SCRIPT runs the bundled PHP.
  • drupack self-update installs the newest release.

The engine executable lists every command and option.

Linux

A Linux release publishes two builds per processor, one for each C library. The install script takes the glibc build on a host with glibc 2.28 or later, and the musl build on any other host, Alpine included. DRUPACK_LIBC set to glibc or musl overrides the pick:

curl -fsSL https://drupack.tresbien.tech/install.sh | DRUPACK_LIBC=musl sh

composer install and composer update make the same pick, so a project on a chosen build sets DRUPACK_LIBC for them too.

Downloading by hand

The releases page lists every build as drupack-VERSION-TARGET. A Linux target without a suffix is the glibc build. A target with the -musl suffix is the musl build. A browser marks what it downloads, and the install scripts avoid both marks below.

  • macOS Gatekeeper blocks a marked executable that has no Apple signature. xattr -d com.apple.quarantine drupack clears the mark.
  • Windows SmartScreen displays "Windows protected your PC" the first time. Choose "More info", then "Run anyway".

Build your own site

A site repository contains a Composer project and a drupack.yml. A build turns it into one executable per platform, for Linux, macOS on Apple silicon and Windows. The build runs on GitHub, Gitea, GitLab or any CI that runs a container. A first start of that executable installs the site, and its data stays in one directory beside it.

Build your own site has the setup. The Drupacked Demo is a complete site built this way.

Read more

Run the engine as a service covers a server. It describes a systemd unit, an OpenRC service for Alpine, Drupal's cron and a proxy for HTTPS.

The reference for the command line covers:

Verify a download

The install scripts check each download's SHA-256. For a file downloaded by hand, each release publishes checksums.txt:

sha256sum --ignore-missing -c checksums.txt

On Windows, compare the file's hash against its entry in checksums.txt:

(Get-FileHash drupack-VERSION-windows-amd64.exe -Algorithm SHA256).Hash.ToLower()

GitHub records where each file was built, and the GitHub CLI checks that record:

gh attestation verify drupack-VERSION-linux-amd64 --repo tresbientech/drupack

A release also has release.json, which contains the SHA-256 and size of every executable. It also has a CycloneDX inventory of the contents of the executable.

Contributing

CONTRIBUTING.md covers the build, the test suites and the release.