Add the must-have pages for the Europa release
The goal is to capture the shape of the new docs. It is not meant to be
final, but it should be as close as possible. We only want the bare
minimum for new users that on-board with Dagger Europa. As soon as the
new europaSidebar replaces replaces the existing one, the previous docs
will still remain available - doc IDs are unique and permanent. We will
do this by simply changing the default `slug: /` to point to the Europa
Docs entrypoint, which is doc 1200.
Helpful Docusaurus link re multiple sidebars:
https://docusaurus.io/docs/sidebar/multiple-sidebars
The new pages are numbered from `1200` onwards. This is meant to reflect
the `0.2.0` Dagger version. This numbering felt more meaningful than
just continuing to increment existing numbers.
I didn't want to be "wasteful" with the digits and start at `2000`, but
that was my first instinct.
I am keen on getting this live on https://docs.dagger.io/1200/local-ci.
Anything that is not in production, is inventory. Inventory is bad.
The goal is to allow anyone that has a link to get a feel for the new
docs as soon as possible, so that we can all see how they improve in
real-time, and steer them continuously towards the desired state. We
should be aware of the timeline, and not muck about, but instead
evaluate constantly how close are we to "flipping the switch".
Remember, the best releases are those where switches are flipped (e.g.
`--europa)`. The feature will have been out there for weeks (maybe even
months), improved by talking to users and then one day realising that we
are done, and just enabling it by default. It's the same principle
behind these docs.
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-02-07 23:16:01 +01:00
---
slug: /1211/go-docker-swarm
2022-03-03 16:05:07 +01:00
displayed_sidebar: europa
Add the must-have pages for the Europa release
The goal is to capture the shape of the new docs. It is not meant to be
final, but it should be as close as possible. We only want the bare
minimum for new users that on-board with Dagger Europa. As soon as the
new europaSidebar replaces replaces the existing one, the previous docs
will still remain available - doc IDs are unique and permanent. We will
do this by simply changing the default `slug: /` to point to the Europa
Docs entrypoint, which is doc 1200.
Helpful Docusaurus link re multiple sidebars:
https://docusaurus.io/docs/sidebar/multiple-sidebars
The new pages are numbered from `1200` onwards. This is meant to reflect
the `0.2.0` Dagger version. This numbering felt more meaningful than
just continuing to increment existing numbers.
I didn't want to be "wasteful" with the digits and start at `2000`, but
that was my first instinct.
I am keen on getting this live on https://docs.dagger.io/1200/local-ci.
Anything that is not in production, is inventory. Inventory is bad.
The goal is to allow anyone that has a link to get a feel for the new
docs as soon as possible, so that we can all see how they improve in
real-time, and steer them continuously towards the desired state. We
should be aware of the timeline, and not muck about, but instead
evaluate constantly how close are we to "flipping the switch".
Remember, the best releases are those where switches are flipped (e.g.
`--europa)`. The feature will have been out there for weeks (maybe even
months), improved by talking to users and then one day realising that we
are done, and just enabling it by default. It's the same principle
behind these docs.
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-02-07 23:16:01 +01:00
---
# Go on Docker Swarm
2022-02-12 19:16:34 +01:00
![particubes.com ](/img/use-cases/particubes.com.png )
2022-02-11 16:31:15 +01:00
2022-02-12 19:16:34 +01:00
[Particubes ](https://particubes.com ) is a platform dedicated to voxel games, which are games made out of little cubes, like Minecraft.
2022-02-11 16:31:15 +01:00
The team consists of 10 developers that like to keep things simple.
2022-02-12 19:16:34 +01:00
They write primarily Go & Lua, push to GitHub and use GitHub Actions for automation.
The production setup is a multi-node Docker Swarm cluster running on AWS.
2022-02-11 16:31:15 +01:00
2022-02-12 19:16:34 +01:00
The Particubes team chose Dagger for continuous deployment because it was the easiest way of integrating GitHub with Docker Swarm.
2022-03-30 15:03:43 +02:00
Every commit to the main branch goes straight to [docs.particubes.com ](https://docs.particubes.com ) via a Dagger pipeline that runs in GitHub Actions. Let us see how the Particubes Dagger plan fits together.
2022-02-11 16:31:15 +01:00
2022-03-31 19:55:03 +02:00
## Actions API
2022-02-12 19:37:03 +01:00
2022-03-30 15:03:43 +02:00
This is a high level overview of all actions in the Particubes docs Dagger plan:
![particubes flat plan ](/img/use-cases/particubes-actions.png )
We can see all available actions in a Plan by running the following command:
2022-03-31 15:56:34 +02:00
```console
2022-03-30 15:03:43 +02:00
$ dagger do
Execute a dagger action.
Available Actions:
build Create a container image
clean Remove a container image
test Locally test a container image
deploy Deploy a container image
```
2022-03-31 19:55:03 +02:00
## Client API
2022-02-11 16:31:15 +01:00
2022-03-30 15:03:43 +02:00
Dagger actions usually need to interact with the host environment where the Dagger client runs. The Particubes' plan uses environment variables and the filesystem.
This is an overview of all client interactions for this plan:
![Client API ](/img/use-cases/client-api.png )
This is what the above looks like in the Dagger plan config:
```cue file=../tests/use-cases/go-docker-swarm/client-api.cue.fragment
2022-03-31 19:55:03 +02:00
2022-02-11 16:31:15 +01:00
```
2022-03-31 19:55:03 +02:00
## The `build` Action
2022-03-30 15:03:43 +02:00
2022-03-31 19:55:03 +02:00
This is a more in-depth overview of the _build_ action and how it interacts with the client in the Particubes docs Dagger plan:
2022-03-30 15:03:43 +02:00
![build action ](/img/use-cases/build-action.png )
This is what the above looks like in the Dagger plan config:
```cue file=../tests/use-cases/go-docker-swarm/build-action.cue.fragment
2022-03-31 19:55:03 +02:00
2022-03-30 15:03:43 +02:00
```
2022-03-31 19:55:03 +02:00
## Github Action integration
2022-03-30 15:03:43 +02:00
This is the GitHub Actions workflow config that invokes `dagger` , which in turn runs the full plan:
2022-02-11 16:31:15 +01:00
```yaml
name: Dagger/docs.particubes.com
2022-02-12 19:16:34 +01:00
2022-02-11 16:31:15 +01:00
on:
push:
2022-03-30 15:03:43 +02:00
branches: [master]
2022-02-11 16:31:15 +01:00
jobs:
deploy:
runs-on: ubuntu-latest
2022-03-30 15:03:43 +02:00
env:
GITHUB_SHA: ${{ github.sha }}
SSH_PRIVATE_KEY_DOCKER_SWARM: ${{ secrets.SSH_PRIVATE_KEY_DOCKER_SWARM }}
2022-02-11 16:31:15 +01:00
steps:
- name: Checkout code
2022-03-30 15:03:43 +02:00
uses: actions/checkout@v3
- name: Install Dagger
uses: dagger/dagger-action@v2
2022-02-11 16:31:15 +01:00
with:
2022-03-30 15:03:43 +02:00
install-only: true
- name: Dagger poject update
run: dagger project update
- name: Dagger do test
run: dagger do test --log-format plain
- name: Dagger do deploy
run: dagger do deploy --log-format plain
2022-02-11 16:31:15 +01:00
```
2022-02-12 19:16:34 +01:00
Since this is a Dagger pipeline, anyone on the team can run it locally with a single command:
2022-02-11 16:31:15 +01:00
2022-02-12 19:16:34 +01:00
```console
2022-03-30 15:03:43 +02:00
dagger do
2022-02-12 19:16:34 +01:00
```
This is the first step that enabled the Particubes team to have the same CI/CD experience everywhere.
2022-03-31 19:55:03 +02:00
## Full Particubes docs Dagger plan
2022-03-30 15:03:43 +02:00
This is the entire plan running on Particubes' CI:
```cue file=../tests/use-cases/go-docker-swarm/full/particubes.docs.cue
2022-03-31 19:55:03 +02:00
2022-03-30 15:03:43 +02:00
```
2022-03-31 19:55:03 +02:00
## What comes next ?
2022-02-12 19:37:03 +01:00
2022-03-31 19:55:03 +02:00
Particubes' team suggested that we create a `dev` action with _hot reload_ , that way Dagger would even asbtract away the ramp-up experience when developing the doc
2022-02-12 19:16:34 +01:00
:::tip
2022-03-30 15:03:43 +02:00
The latest version of this pipeline can be found at [github.com/voxowl/particubes/pull/144 ](https://github.com/voxowl/particubes/blob/2af173596729929cfb7a7a1f78f1ec0d8b685e5e/lua-docs/docs.cue )
2022-02-12 19:16:34 +01:00
:::