Skip to content

Commit b2fe2ad

Browse files
committed
refactor(ship): change name to ship, as the starting point for all shipping and deploying utilities
1 parent eb76ad7 commit b2fe2ad

11 files changed

Lines changed: 63 additions & 73 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"prefer-stable": true,
134134
"autoload": {
135135
"psr-4": {
136-
"Tempest\\Aloft\\": "packages/aloft/src",
136+
"Tempest\\Ship\\": "packages/ship/src",
137137
"Tempest\\Auth\\": "packages/auth/src",
138138
"Tempest\\Cache\\": "packages/cache/src",
139139
"Tempest\\Clock\\": "packages/clock/src",
@@ -205,7 +205,7 @@
205205
},
206206
"autoload-dev": {
207207
"psr-4": {
208-
"Tempest\\Aloft\\Tests\\": "packages/aloft/tests",
208+
"Tempest\\Ship\\Tests\\": "packages/ship/tests",
209209
"Tempest\\Auth\\Tests\\": "packages/auth/tests",
210210
"Tempest\\Cache\\Tests\\": "packages/cache/tests",
211211
"Tempest\\Clock\\Tests\\": "packages/clock/tests",

docs/0-getting-started/03-docker.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ description: Tempest can both be developed or deployed in Production, with our o
55

66
## Overview
77

8-
We are pleased to offer TempestPHP/Aloft, our own set of Docker images for developing with and serving your Tempest applications, for you to use as and customise as you see fit.
8+
We are pleased to offer our own set of Docker images for developing with and serving your Tempest applications, for you to use as and customise as you see fit.
99

1010
In order to start from the strongest security posture and enable you to run secure and performant Tempest-based applications, we've initially selected FrankenPHP as our server of choice. Further, we've adopted a 'rootless' approach by default, and also offer a 'distroless' production image to further mitigate potential security issues stemming from unnecessary software often found in Docker images.
1111

12-
## Aloft image architecture, variants and release strategy
12+
## Image architecture, variants and release strategy
1313

14-
Our CI/CD will automatically generate and publish images to our public repository at https://PLACE.HOLD.ER/tempestphp/aloft following the releases of PHP and FrankenPHP, and also any time we find an issue in the underlying Docker image. Alternatively, you can also customise these images for your own use, see section below. (TODO: link)
14+
Our CI/CD will automatically generate and publish images to our public repository at https://PLACE.HOLD.ER/tempestphp/ship following the releases of PHP and FrankenPHP, and also any time we find an issue in the underlying Docker image. Alternatively, you can also customise these images for your own use, see section below. (TODO: link)
1515

1616
### Architectures
1717

@@ -25,13 +25,13 @@ We maintain two variants; 'latest' which is rootless and distroless, and is aime
2525

2626
```bash
2727
# These periodically updated variant tags will always point at the latest version-pinned images
28-
tempestphp/aloft >> tempestphp/aloft:1.11.3-8.5.3 #at time of writing
29-
tempestphp/aloft:latest >> tempestphp/aloft:1.11.3-8.5.3 #at time of writing
30-
tempestphp/aloft:debug >> tempestphp/aloft:1.11.3-8.5.3-debug #at time of writing
28+
tempestphp/ship >> tempestphp/ship:1.11.3-8.5.3 #at time of writing
29+
tempestphp/ship:latest >> tempestphp/ship:1.11.3-8.5.3 #at time of writing
30+
tempestphp/ship:debug >> tempestphp/ship:1.11.3-8.5.3-debug #at time of writing
3131

3232
# We'll also continually publish pinned-versions
33-
tempestphp/aloft:1.11.3-8.5.3
34-
tempestphp/aloft:1.11.3-8.5.3-debug
33+
tempestphp/ship:1.11.3-8.5.3
34+
tempestphp/ship:1.11.3-8.5.3-debug
3535
# these will accumulate over time
3636
```
3737
We utilise the [GoogleContainerTools Distroless](https://github.com/GoogleContainerTools/distroless/) [`cc`](https://github.com/GoogleContainerTools/distroless/blob/main/cc/README.md) image, pulling their latest 'nonroot' image as our base, at time of build.
@@ -52,83 +52,83 @@ We won't automatically retire 'patch' version releases i.e. PHP8.5.3 > PHP8.5.4,
5252

5353
## Developing your application with Docker
5454

55-
During development, we'd suggest using the debug image. We've included a convenience command in the `tempest/aloft` package which will run a development server on your device.
55+
During development, we'd suggest using the debug image. We've included a convenience command in the `tempest/ship` package which will run a development server on your device.
5656
```bash
57-
./tempest aloft:serve # by default, this will get debug from the repository and serve it
57+
./tempest ship:serve # by default, this will get debug from the repository and serve it
5858
```
5959
You may specify the `latest` image if you prefer.
6060
```bash
61-
./tempest aloft:serve latest # latest floating version
61+
./tempest ship:serve latest # latest floating version
6262
```
6363
You may instead specify the release, if you require a pinned-version.
6464
```bash
65-
./tempest aloft:serve 1.11.3-8.5.3 # pinned-version, distroless
66-
./tempest aloft:serve 1.11.3-8.5.3-debug # pinned-version, debug
65+
./tempest ship:serve 1.11.3-8.5.3 # pinned-version, distroless
66+
./tempest ship:serve 1.11.3-8.5.3-debug # pinned-version, debug
6767
```
6868

6969
:::info
70-
By default, the `aloft:serve` command will try to pull from the registry. But if you have published the stub for customising the image, this command will attempt to use the local image. You can force this behaviour by adding the optional command `--repository=local` or `--repository=remote`.
70+
By default, the `ship:serve` command will try to pull from the registry. But if you have published the stub for customising the image, this command will attempt to use the local image. You can force this behaviour by adding the optional command `--repository=local` or `--repository=remote`.
7171
:::
7272

7373
## Testing and production applications with Docker
7474

7575
For testing and QA, we'd suggest using the distroless image, as it is most representative of your final infrastructure, and should highlight any issues for your attention.
7676
```bash
77-
./tempest aloft:serve latest
77+
./tempest ship:serve latest
7878
```
7979
As per the section above, you can omit `latest` to default to the `debug` release, or specify a version.
8080

8181
## Customising the Docker image for your use
8282

83-
As the `latest` and `debug` images are inherently distroless, albeit with busybox in the `debug` image, you cannot use this as an intermediate stage in a multi-stage Dockerfile build. Instead, you can use the `aloft:publish` Tempest command to publish a copy of the stubs, so you can build and tweak as you need.
83+
As the `latest` and `debug` images are inherently distroless, albeit with busybox in the `debug` image, you cannot use this as an intermediate stage in a multi-stage Dockerfile build. Instead, you can use the `ship:publish` Tempest command to publish a copy of the stubs, so you can build and tweak as you need.
8484
```bash
85-
./tempest aloft:publish # by default, this will publish the debug dockerfile
86-
./tempest aloft:publish:latest # select the distroless image, instead
85+
./tempest ship:publish # by default, this will publish the debug dockerfile
86+
./tempest ship:publish:latest # select the distroless image, instead
8787
```
8888
This will publish `.dockerignore`, `Caddyfile`, and `Dockerfile` into your project root `docker/` folder, creating it as necessary. If you already have files in here, it shouldn't overwrite by default.
8989

9090
You can also retrieve the files manually, from the vendor folder.
9191
```bash
92-
vendor/tempest/framework/packages/aloft/stubs/
92+
vendor/tempest/framework/packages/ship/stubs/
9393
```
9494
### Building the image
9595

96-
We've provided a simple `aloft:build` command to build these local images. It won't handle all use cases, and is really only aimed at someone directly running the images. If you are ready to change the Dockerfile to suit your needs, you probably won't want to use this anyway. That said, here's how to use it.
96+
We've provided a simple `ship:build` command to build these local images. It won't handle all use cases, and is really only aimed at someone directly running the images. If you are ready to change the Dockerfile to suit your needs, you probably won't want to use this anyway. That said, here's how to use it.
9797

9898
If you HAVE NOT published the stubs to your project:
9999
```bash
100-
./tempest aloft:build # will attempt to build debug directly from the package stubs folder
101-
./tempest aloft:build debug # will attempt to build debug directly from the package stubs folder
102-
./tempest aloft:build latest # will attempt to build distroless directly from the package stubs folder
100+
./tempest ship:build # will attempt to build debug directly from the package stubs folder
101+
./tempest ship:build debug # will attempt to build debug directly from the package stubs folder
102+
./tempest ship:build latest # will attempt to build distroless directly from the package stubs folder
103103
```
104104
If you HAVE published the stubs to your project:
105105
```bash
106-
./tempest aloft:build # will attempt to build debug from `{root_path}/docker/`
107-
./tempest aloft:build debug # will attempt to build debug from `{root_path}/docker/`
108-
./tempest aloft:build latest # will attempt to build distroless from `{root_path}/docker/`
106+
./tempest ship:build # will attempt to build debug from `{root_path}/docker/`
107+
./tempest ship:build debug # will attempt to build debug from `{root_path}/docker/`
108+
./tempest ship:build latest # will attempt to build distroless from `{root_path}/docker/`
109109
```
110110
:::info
111-
If you've published both stubs, or renamed the Dockerfile, this won't work. You've moved past the use-case this command was designed for, and will need to build yourself. Or copy the AloftBuildCommand into your project and customise it to suit you!
111+
If you've published both stubs, or renamed the Dockerfile, this won't work. You've moved past the use-case this command was designed for, and will need to build yourself. Or copy the ShipBuildCommand into your project and customise it to suit you!
112112
:::
113113

114114
### Default versions of FrankenPHP and PHP
115115

116116
We will update the stubs from time-to-time, but you may find that your PHP and/or FrankenPHP versions are out of step, because you have customised your file and don't wish to republish the stubs losing the changes.
117117

118-
You can use the `aloft:build` command to pass the arguments:
118+
You can use the `ship:build` command to pass the arguments:
119119
```bash
120-
./tempest aloft:build {''|debug|latest} --with-frankenphp="1.11.3" --with-php="8.5.3"
120+
./tempest ship:build {''|debug|latest} --with-frankenphp="1.11.3" --with-php="8.5.3"
121121
```
122122
:::info
123-
Note that this will tag the image with tempestphp/aloft:debug or :latest, and remains compatible with `aloft:serve`.
123+
Note that this will tag the image with 'tempestphp/ship:debug' or 'tempestphp/ship:latest', and remains compatible with `ship:serve`.
124124
:::
125125

126126
Or, you pass these via build arguments run from the `{root_path}/docker/` folder:
127127
```bash
128-
docker build . -t tempestphp/aloft:1.11.3-8.5.3 --build-arg FRANKENPHP_VERSION="1.11.3" --build-arg PHP_VERSION="8.5.3"
128+
docker build . -t tempestphp/ship:1.11.3-8.5.3 --build-arg FRANKENPHP_VERSION="1.11.3" --build-arg PHP_VERSION="8.5.3"
129129
```
130130
:::info
131-
To retain compatibility with `aloft:serve` ensure that the image retains `tempestphp/aloft:` and then pass `1.11.3-8.5.3` as the image variant i.e. `./tempest aloft:serve 1.11.3-8.5.3`.
131+
To retain compatibility with `ship:serve` ensure that the image retains 'tempestphp/ship:' in the filename and then pass `1.11.3-8.5.3` as the image variant i.e. `./tempest ship:serve 1.11.3-8.5.3`.
132132
:::
133133

134134
Or you can edit the Dockerfile directly:
@@ -137,15 +137,15 @@ ARG FRANKENPHP_VERSION=1.11.3
137137
ARG PHP_VERSION=8.5.3
138138
```
139139
:::info
140-
This method also retains compatibility with `aloft:serve` and `aloft:build`, as long as you keep the filename unchanged.
140+
This method also retains compatibility with `ship:serve` and `ship:build`, as long as you keep the filename unchanged.
141141
:::
142142

143143
## Adding additional PHP Extensions
144144

145145
We include PHP Extensions from [Marc Henderkes'](https://pkgs.henderkes.com/) Static PHP Repository. These are static builds, of PHP-ZTS, which is required by FrankenPHP.
146146

147147
:::info
148-
Note that apt-get packages are kebab-case and should be prefixed `php-zts`. So if you wanted the extension `pdo_mysql`, you'd specify `php-zts-pdo-mysql`.
148+
Note that apt-get packages are kebab-case and should be prefixed `php-zts`. So if you wanted the extension `pdo_mysql`, you'd specify `php-zts-pdo-mysql`. The command won't convert the syntax automatically.
149149
:::
150150

151151
### Adding extensions at build time via build arguments
@@ -154,11 +154,11 @@ This method is useful if you need to make a specific build one-off, containing a
154154

155155
Pass the build argument directly if using a published stub Dockerfile:
156156
```bash
157-
docker build . -t aloft:with-yaml --build-arg PHP_EXTRA_EXTENSIONS="php-zts-yaml"
157+
docker build . -t ship:with-yaml --build-arg PHP_EXTRA_EXTENSIONS="php-zts-yaml"
158158
```
159-
Or, you can use the Tempest aloft:build command and pass the optional argument:
159+
Or, you can use the Tempest `ship:build` command and pass the optional argument:
160160
```bash
161-
./tempest aloft:build --with-php-extensions="php-zts-yaml"
161+
./tempest ship:build --with-php-extensions="php-zts-yaml"
162162
```
163163
:::info
164164
This will work with both the `debug` and `latest` images.
@@ -195,7 +195,7 @@ We suggest one of the following options instead.
195195

196196
You can use the following command to run composer interactively:
197197
```bash
198-
docker run --rm -i --tty --volume $PWD:/app --user 1002:1002 composer:latest # We suggest running with 1002:1002 to match the file permissions within our rootless image
198+
docker run --rm -i --tty --volume $PWD:/app --user 1002:1002 composer:latest # We suggest running with 1002:1002 to match the file permissions within our rootless images
199199
```
200200
You could also create an alias script:
201201
```bash
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "tempest/aloft",
3-
"description": "Development and Production webserver Dockerfiles and utilities for TempestPHP.",
2+
"name": "tempest/ship",
3+
"description": "Development and Production webserver Dockerfiles and utilities for shipping/deploying TempestPHP applications.",
44
"require": {
55
"php": "^8.5",
66
"tempest/core": "3.x-dev",
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Tempest\Aloft;
5+
namespace Tempest\Ship;
66

77
use Tempest\Console\Console;
88
use Tempest\Console\ConsoleArgument;
@@ -12,7 +12,7 @@
1212
use function Tempest\root_path;
1313
use function Tempest\Support\Filesystem\exists;
1414

15-
final readonly class AloftBuildCommand
15+
final readonly class ShipBuildCommand
1616
{
1717
use HasConsole;
1818

@@ -34,7 +34,7 @@ public function __construct()
3434
}
3535

3636
#[ConsoleCommand(
37-
name: 'aloft:build',
37+
name: 'ship:build',
3838
description: 'Build the Aloft Docker image locally, and publish the stub files if not already present.',
3939
)]
4040
public function build(
@@ -67,9 +67,9 @@ public function build(
6767
]));
6868

6969
$buildPath = ($this->stubsPublished ? root_path('docker') : dirname(__DIR__) . DIRECTORY_SEPARATOR . 'stubs') . DIRECTORY_SEPARATOR;
70-
$buildFile = "{$buildPath}Dockerfile.{$variant} -t tempestphp/aloft:{$variant}";
70+
$buildFile = "{$buildPath}Dockerfile.{$variant} -t tempestphp/ship:{$variant}";
7171

72-
if ($this->confirm("Do you want to build tempestphp/aloft:{$variant}?", default: false)) {
72+
if ($this->confirm("Do you want to build tempestphp/ship:{$variant}?", default: false)) {
7373
$this->console->info('Okay, attempting build');
7474
passthru("docker build -f {$buildFile}{$buildArgs} {$buildPath}");
7575
}

packages/aloft/src/AloftPublishCommand.php renamed to packages/ship/src/ShipPublishCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Tempest\Aloft;
5+
namespace Tempest\Ship;
66

77
use Tempest\Console\Console;
88
use Tempest\Console\ConsoleArgument;
@@ -19,14 +19,14 @@
1919
use function Tempest\Support\Filesystem\exists;
2020
use function Tempest\Support\str;
2121

22-
final readonly class AloftPublishCommand
22+
final readonly class ShipPublishCommand
2323
{
2424
use HasConsole;
2525

2626
#[ConsoleCommand(
27-
name: 'aloft:publish',
27+
name: 'ship:publish',
2828
description: 'Publish the Aloft Docker stubs, for the debug image.',
29-
aliases: ['aloft:publish:debug', 'aloft:publish:dev'],
29+
aliases: ['ship:publish:debug', 'ship:publish:dev'],
3030
)]
3131
public function publish(string $variant = 'debug'): void
3232
{
@@ -53,9 +53,9 @@ function (string $dstFile, string $srcFile) use ($srcPath, $dstPath) {
5353
}
5454

5555
#[ConsoleCommand(
56-
name: 'aloft:publish:latest',
56+
name: 'ship:publish:latest',
5757
description: 'Publish the Aloft Docker stubs, for the distroless image.',
58-
aliases: ['aloft:publish:distroless', 'aloft:publish:prod'],
58+
aliases: ['ship:publish:distroless', 'ship:publish:prod'],
5959
)]
6060
public function publishLatest(): void
6161
{
Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Tempest\Aloft;
5+
namespace Tempest\Ship;
66

77
use Tempest\Console\Console;
88
use Tempest\Console\ConsoleArgument;
@@ -12,7 +12,7 @@
1212
use function Tempest\root_path;
1313
use function Tempest\Support\Filesystem\exists;
1414

15-
final readonly class AloftServeCommand
15+
final readonly class ServeCommand
1616
{
1717
use HasConsole;
1818

@@ -38,17 +38,17 @@ public function __construct()
3838
}
3939

4040
#[ConsoleCommand(
41-
name: 'aloft:build',
42-
description: 'Build the Aloft Docker image locally, and publish the stub files if not already present.',
41+
name: 'ship:serve',
42+
description: 'Run a development or production docker container to serve your application.',
4343
)]
44-
public function build(
44+
public function serve(
4545
#[ConsoleArgument(
46-
description: 'The build variant to use.',
46+
description: 'The docker container variant to use.',
4747
)]
4848
string $requestedVariant = '',
4949
#[ConsoleArgument(
5050
name: 'repository',
51-
description: 'Space-separated list of extra extensions to include in the build.',
51+
description: 'The repository path to retrieve the docker container from.',
5252
)]
5353
?string $repository = null,
5454
): void {
@@ -57,25 +57,15 @@ public function build(
5757

5858
// TODO: Catch local development paths from composer.json and insert them as volumes
5959

60-
$runImage = "{$repo}tempestphp/aloft:{$variant}";
60+
$runImage = "{$repo}tempestphp/ship:{$variant}";
6161

6262
if ($this->confirm("Do you want to start dev server from {$runImage}?", default: true)) {
6363
$this->console->info('Okay, starting, use ctrl-c to exit when finished');
6464
if ($this->stubsPublished === true && ! ($repository ?? null === 'remote')) {
65-
$this->console->info('Stubs are published, and you are using the local repository, therefore ensure that you run aloft:build before using aloft:serve');
65+
$this->console->info('Stubs are published, and you are using the local repository, therefore ensure that you run ship:build before using ship:serve');
6666
}
6767
passthru(
68-
"docker run --rm -it -p 80:8000 -p 443:8443 -p 443:8443/udp \
69-
-v "
70-
. root_path()
71-
. ":/app \
72-
-v "
73-
. root_path('.frankenpest/data')
74-
. ":/data \
75-
-v "
76-
. root_path('.frankenpest/config')
77-
. ":/config \
78-
{$runImage}",
68+
'docker run --rm -it -p 80:8000 -p 443:8443 -p 443:8443/udp -v ' . root_path() . ":/app {$runImage}",
7969
);
8070
}
8171
}

0 commit comments

Comments
 (0)