11# preprocessing-base
22
3- Enduro preprocessing child workflow base repository. This project is a basic
4- example and a template to be used to create new preprocessing child workflows
5- to be executed as part of the processing workflow in Enduro.
3+ Enduro child workflow base repository. This project is a basic example and a
4+ template for new Enduro child workflow projects.
5+
6+ Despite the ` preprocessing-base ` name, this repository is also a useful starting
7+ point for projects that implement other workflow types, or projects that run
8+ multiple workflows and Temporal workers from the same binary.
69
710- [ Existing repositories] ( #existing-repositories )
811- [ Create a new repository] ( #create-a-new-repository )
@@ -13,12 +16,14 @@ to be executed as part of the processing workflow in Enduro.
1316
1417## Existing repositories
1518
19+ Projects based on this template include:
20+
1621- [ preprocessing-sfa] ( https://github.com/artefactual-sdps/preprocessing-sfa )
17- - [ preprocessing-moma ] ( https://github.com/artefactual-sdps/preprocessing-moma )
22+ - [ cva-enduro-workflows ] ( https://github.com/artefactual-sdps/cva-enduro-workflows )
1823
1924## Create a new repository
2025
21- To create a new preprocessing child workflow project:
26+ To create a new Enduro child workflow project:
2227
2328- Use this repository as a template:
2429 - With the link in the top right corner of this page
@@ -29,42 +34,51 @@ To create a new preprocessing child workflow project:
2934 - The Makefile project name and the location of the installed tools
3035 - The ` appName ` in the worker command
3136 - The gci "prefix" section in the ` .golangci.yml ` config file
37+ - The ` CHILD_WORKFLOW_PATHS ` in the local environment setup below.
3238- Update this readme file:
3339 - Change the heading and initial description
3440 - Remove the first three sections from the list above and the content
3541 - Update the configuration based on the workflow implementation
42+ - Update the Enduro ` childWorkflows ` configuration examples
3643
3744## Repository requirements
3845
39- This project is configured by default to be able to run the child workflow
40- worker inside the Enduro cluster. For that to work as expected, the projects
41- based on this repository must contain a ` Tiltfile.enduro ` file to load only
42- the required resources into the cluster. One of those resources must be a
43- persistent volume claim called ` preprocessing-pvc ` that will be mounted in
44- Enduro's a3m or Archivematica worker to be able to share the filesystem with
45- the preprocessing worker. This solution will only work in single node
46- Kubernetes clusters.
46+ Projects based on this repository are expected to run as child workflow workers
47+ inside the Enduro development environment. Enduro owns the local development
48+ cluster and core services, including Temporal, MySQL and shared infrastructure.
49+ This repository contributes only the child workflow resources needed by its
50+ worker.
51+
52+ The default template includes a persistent volume claim called
53+ ` preprocessing-pvc ` , mounted at ` /home/preprocessing/shared ` in the child
54+ workflow worker. Enduro can mount the same volume in its a3m or Archivematica
55+ worker so both workers can share files. This shared-volume development setup is
56+ intended for single-node Kubernetes clusters.
57+
58+ Projects that do not need a shared filesystem, or that implement
59+ non-preprocessing workflow types, should replace these manifests with the
60+ resources required by their own workflow workers.
4761
48- Check the [ Enduro documentation ] to enable and configure the execution of
49- child workflows in that environment .
62+ Check the [ Enduro development manual ] for the current development environment
63+ setup .
5064
5165## Configuration
5266
53- The preprocessing workers need to share the filesystem with Enduro's a3m or
54- Archivematica workers. They must be connected to the same Temporal server
55- and related to each other with the namespace, task queue and workflow name.
67+ The default preprocessing worker needs to share the filesystem with Enduro's
68+ a3m or Archivematica workers. It must connect to the same Temporal server and be
69+ related to Enduro with the correct namespace, task queue and workflow name.
5670
57- ### Preprocessing
71+ ### Worker configuration
5872
59- The required configuration for the preprocessing worker:
73+ The required configuration for the default preprocessing worker:
6074
6175``` toml
6276debug = false
6377verbosity = 0
64- sharedPath = " /home/enduro/ preprocessing"
78+ sharedPath = " /home/preprocessing/shared "
6579
6680[temporal ]
67- address = " temporal.enduro-sdps:7233"
81+ address = " temporal-frontend .enduro-sdps:7233"
6882namespace = " default"
6983taskQueue = " preprocessing"
7084workflowName = " preprocessing"
@@ -73,7 +87,7 @@ workflowName = "preprocessing"
7387maxConcurrentSessions = 1
7488```
7589
76- Optional BagIt bag configuration (default values shown) :
90+ Optional BagIt bag configuration:
7791
7892``` toml
7993[bagit ]
@@ -82,167 +96,48 @@ checksumAlgorithm = "sha512"
8296
8397### Enduro
8498
85- The preprocessing section for Enduro's configuration:
99+ The child workflow section for Enduro's configuration:
86100
87101``` toml
88- [preprocessing ]
89- enabled = true
90- extract = false
91- sharedPath = " /home/enduro/preprocessing"
92-
93- [preprocessing .temporal ]
102+ [[childWorkflows ]]
103+ type = " preprocessing"
94104namespace = " default"
95105taskQueue = " preprocessing"
96106workflowName = " preprocessing"
107+ extract = false
108+ sharedPath = " /home/preprocessing/shared"
97109```
98110
99111## Local environment
100112
101- ### Requirements
102-
103- This project uses Tilt to set up a local environment building the Docker images
104- in a Kubernetes cluster. It has been tested with k3d, Minikube and Kind.
113+ The supported development workflow is to run ` tilt up ` from the Enduro
114+ repository and load this repository through Enduro's ` CHILD_WORKFLOW_PATHS `
115+ mechanism.
105116
106- - [ Docker] (v18.09+)
107- - [ kubectl]
108- - [ Tilt] (v0.22.2+)
117+ Bring up the Enduro environment by following the [ Enduro development manual] .
109118
110- A local Kubernetes cluster:
119+ ### Set up
111120
112- - [ k3d] _ (recommended, used in CI)_
113- - [ Minikube] _ (tested)_
114- - [ Kind] _ (tested)_
121+ The specific requirements for this template are:
115122
116- It can run with other solutions like Microk8s or Docker for Desktop/Mac and
117- even against remote clusters, check Tilt's [ Choosing a Local Dev Cluster] and
118- [ Install] documentation for more information to install these requirements.
123+ - clone this repository as a sibling of the Enduro repository
124+ - configure ` CHILD_WORKFLOW_PATHS=../preprocessing-base `
125+ - configure ` MOUNT_PREPROCESSING_VOLUME=true `
126+ - run ` tilt up ` from the Enduro repository
119127
120- Additionally, follow the [ Manage Docker as a non-root user ] post-install guide
121- so that you don’t have to run Tilt with ` sudo ` . _ Note that managing Docker as a
122- non-root user is ** different ** from running the docker daemon as a non-root user
123- (rootless). _
128+ All other development workflow details, including ` .tilt.env ` , live updates,
129+ starting, stopping and clearing the environment, are documented in Enduro. This
130+ repository can also provide local overrides through its own ` .tilt.env ` file,
131+ including settings such as ` TRIGGER_MODE_AUTO ` .
124132
125133### Requirements for development
126134
127- While we run the services inside a Kubernetes cluster we recommend installing
128- Go and other tools locally to ease the development process.
135+ While we run the services inside a Kubernetes cluster we recommend installing Go
136+ and other tools locally to ease the development process.
129137
130- - [ Go] (1.22 +)
138+ - [ Go] (1.24 +)
131139- GNU [ Make] and [ GCC]
132140
133- ### Set up
134-
135- Start a local Kubernetes cluster with a local registry. For example, with k3d:
136-
137- ``` bash
138- k3d cluster create preprocessing --registry-create sdps-registry
139- ```
140-
141- Or using an existing registry:
142-
143- ``` bash
144- k3d cluster create preprocessing --registry-use sdps-registry
145- ```
146-
147- Make sure kubectl is available and configured to use that cluster:
148-
149- ``` bash
150- kubectl config view
151- ```
152-
153- Clone this repository and move into its folder if you have not done that
154- previously:
155-
156- ``` bash
157- git clone git@github.com:artefactual-sdps/preprocessing-base.git
158- cd preprocessing-base
159- ```
160-
161- Bring up the environment:
162-
163- ``` bash
164- tilt up
165- ```
166-
167- While the Docker images are built/downloaded and the Kubernetes resources are
168- created, hit ` space ` to open the Tilt UI in your browser. Check the [ Tilt UI]
169- documentation to learn more about it.
170-
171- ### Live updates
172-
173- Tilt, by default, will watch for file changes in the project folder and it will
174- sync those changes, rebuild the Docker images and recreate the resources when
175- necessary. However, we have _ disabled_ auto-load within the Tiltfile to reduce
176- the use of hardware resources. There are refresh buttons on each resource in the
177- Tilt UI that allow triggering manual updates and re-executing jobs and local
178- resources. You can also set the ` trigger_mode ` env string to ` TRIGGER_MODE_AUTO `
179- within your local ` .tilt.env ` file to override this change and enable auto mode.
180-
181- ### Stop/start the environment
182-
183- Run ` ctrl-c ` on the terminal where ` tilt up ` is running and stop the cluster
184- with:
185-
186- ``` bash
187- k3d cluster stop preprocessing
188- ```
189-
190- To start the environment again:
191-
192- ``` bash
193- k3d cluster start preprocessing
194- tilt up
195- ```
196-
197- ### Clear the cluster
198-
199- > Check the Tilt UI helpers below to just flush the existing data.
200-
201- To remove the resources created by Tilt in the cluster, execute:
202-
203- ``` bash
204- tilt down
205- ```
206-
207- Note that it will take some time to delete the persistent volumes when you
208- run ` tilt down ` and flushing the existing data does not delete the cluster.
209- To delete the volumes immediately, you can delete the cluster.
210-
211- ### Delete the cluster
212-
213- Deleting the cluster will remove all the resources immediately, deleting
214- cluster container from the host. With k3d, run:
215-
216- ``` bash
217- k3d cluster delete preprocessing
218- ```
219-
220- ### Tilt environment configuration
221-
222- A few configuration options can be changed by having a ` .tilt.env ` file
223- located in the root of the project. Example:
224-
225- ``` text
226- TRIGGER_MODE_AUTO=true
227- ```
228-
229- #### TRIGGER_MODE_AUTO
230-
231- Enables live updates on code changes for the preprocessing worker.
232-
233- ### Tilt UI helpers
234-
235- #### Submit
236-
237- In the Tilt UI header there is a cloud icon/button that can trigger the
238- preprocessing workflow. Click the caret to set the path to a file/directory in
239- the host, then click the cloud icon to trigger the workflow.
240-
241- #### Flush
242-
243- Also in the Tilt UI header, click the trash button to flush the existing data.
244- This will recreate the MySQL databases and restart the required resources.
245-
246141## Makefile
247142
248143The Makefile provides developer utility scripts via command line ` make ` tasks.
@@ -263,17 +158,7 @@ GOARCH='amd64'
263158...
264159```
265160
266- [ enduro documentation ] : https://github.com/artefactual-sdps/enduro/blob/main/docs/src/dev-manual/preprocessing.md
267- [ docker ] : https://docs.docker.com/get-docker/
268- [ kubectl ] : https://kubernetes.io/docs/tasks/tools/#kubectl
269- [ tilt ] : https://docs.tilt.dev/tutorial/1-prerequisites.html#install-tilt
270- [ k3d ] : https://k3d.io/v5.4.3/#installation
271- [ minikube ] : https://minikube.sigs.k8s.io/docs/start/
272- [ kind ] : https://kind.sigs.k8s.io/docs/user/quick-start#installation
273- [ choosing a local dev cluster ] : https://docs.tilt.dev/choosing_clusters.html
274- [ install ] : https://docs.tilt.dev/install.html
275- [ manage docker as a non-root user ] : https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
276- [ tilt ui ] : https://docs.tilt.dev/tutorial/3-tilt-ui.html
161+ [ Enduro development manual ] : https://enduro.readthedocs.io/dev-manual/devel/
277162[ go ] : https://go.dev/doc/install
278163[ make ] : https://www.gnu.org/software/make/
279164[ gcc ] : https://gcc.gnu.org/
0 commit comments