Skip to content

Commit

Permalink
v1.10.0 (dagu-org#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta authored Mar 15, 2023
1 parent dc0b7e3 commit 1df62b1
Show file tree
Hide file tree
Showing 104 changed files with 1,670 additions and 2,046 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,36 @@ build-dir:
mkdir -p ./bin

.PHONY: build
build: build-admin build-dir
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu ./cmd/
build: build-admin build-dir build-bin

.PHONY: build-admin
build-admin:
cd admin; \
yarn && yarn build
cp admin/dist/bundle.js ./internal/admin/handlers/web/assets/js/

.PHONY: build-bin
build-bin:
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu .

.PHONY: server
server: build-dir
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu ./cmd/
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu .
./bin/dagu server

.PHONY: scheduler
scheduler: build-dir
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu ./cmd/
go build -ldflags="$(LDFLAGS)" -o ./bin/dagu .
./bin/dagu scheduler

.PHONY: test
test: build
go test ./...
go test -v ./...

.PHONY: test-clean
test-clean:
go clean -testcache
go test ./...
go test -v ./...

.PHONY: lint
lint:
Expand Down
114 changes: 61 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Dagu is a tool for scheduling and running tasks based on a directed acyclic grap
- [Executors](#executors)
- [Running Docker Containers](#running-docker-containers)
- [Making HTTP Requests](#making-http-requests)
- [Sending E-mail](#sending-e-mail)
- [Executing jq Command](#executing-jq-command)
- [Command Execution over SSH](#command-execution-over-ssh)
- [Admin Configuration](#admin-configuration)
- [Environment Variable](#environment-variable)
- [Configuration Options](#configuration-options)
- [Sending email notifications](#sending-email-notifications)
- [Base Configuration for all DAGs](#base-configuration-for-all-dags)
- [Scheduler](#scheduler)
Expand All @@ -88,8 +88,6 @@ Dagu is a tool for scheduling and running tasks based on a directed acyclic grap
- [Local Development Setup](#local-development-setup)
- [FAQ](#faq)
- [How to contribute?](#how-to-contribute)
- [Where is the history data stored?](#where-is-the-history-data-stored)
- [Where are the log files stored?](#where-are-the-log-files-stored)
- [How long will the history data be stored?](#how-long-will-the-history-data-be-stored)
- [How to use specific `host` and `port` for `dagu server`?](#how-to-use-specific-host-and-port-for-dagu-server)
- [How to specify the DAGs directory for `dagu server` and `dagu scheduler`?](#how-to-specify-the-dags-directory-for-dagu-server-and-dagu-scheduler)
Expand Down Expand Up @@ -491,19 +489,49 @@ The `http` executor allows us to make an arbitrary HTTP request.
```yaml
steps:
- name: send POST request
executor: http
command: POST https://foo.bar.com
script: |
{
"timeout": 10,
"headers": {
"Authorization": "Bearer $TOKEN"
},
"query": {
"key": "value"
},
"body": "post body"
}
executor:
type: http
config:
timeout: 10,
headers:
Authorization: "Bearer $TOKEN"
silent: true # If silent is true, it outputs response body only.
query:
key: "value"
body: "post body"
```

### Sending E-mail

The `mail` executor can be used to send e-mail.

Example:

```yaml
smtp:
host: "smtp.foo.bar"
port: "587"
username: "<username>"
password: "<password>"
steps:
- name: step1
executor:
type: mail
config:
to: <to address>
from: <from address>
subject: "Urgent Request: Help Me Find My Sanity"
message: |
I'm in a bit of a pickle.
I seem to have lost my sanity somewhere between my third cup of coffee
and my fourth Zoom meeting of the day.
If you see it lying around, please let me know.
Thanks for your help!
Best,
```

### Executing jq Command
Expand Down Expand Up @@ -567,38 +595,26 @@ steps:
command: /usr/sbin/ifconfig
```

## Admin Configuration

To configure dagu, please create the config file (default path: `~/.dagu/admin.yaml`). All fields are optional.

```yaml
# Web Server Host and Port
host: <hostname for web UI address> # default: 127.0.0.1
port: <port number for web UI address> # default: 8080
# path to the DAGs directory
dags: <the location of DAG configuration files> # default: ${DAGU_HOME}/dags
# Web UI Color & Title
navbarColor: <admin-web header color> # header color for web UI (e.g. "#ff0000")
navbarTitle: <admin-web title text> # header title for web UI (e.g. "PROD")
# Basic Auth
isBasicAuth: <true|false> # enables basic auth
basicAuthUsername: <username for basic auth of web UI> # basic auth user
basicAuthPassword: <password for basic auth of web UI> # basic auth password
## Configuration Options

# Base Config
baseConfig: <base DAG config path> . # default: ${DAGU_HOME}/config.yaml
# Others
logDir: <internal logdirectory> # default: ${DAGU_HOME}/logs/admin
command: <Absolute path to the dagu binary> # default: dagu
```
The following environment variables can be used to configure the Dagu. Default values are provided in the parentheses:

## Environment Variable
- `DAGU_HOST` (`127.0.0.1`): The host to bind the server to.
- `DAGU_PORT` (`8080`): The port to bind the server to.
- `DAGU_DAGS` (`$DAGU_HOME/dags`): The directory containing the DAGs.
- `DAGU_COMMAND` (`dagu`): The command used to start the application.
- `DAGU_IS_BASIC_AUTH` (`0`): Set to 1 to enable basic authentication.
- `DAGU_BASIC_AUTH_USERNAME` (`""`): The username to use for basic authentication.
- `DAGU_BASIC_AUTH_PASSWORD` (`""`): The password to use for basic authentication.
- `DAGU_LOG_DIR` (`$DAGU_HOME/logs`): The directory where logs will be stored.
- `DAGU_DATA_DIR` (`$DAGU_HOME/data`): The directory where application data will be stored.
- `DAGU_SUSPEND_FLAGS_DIR` (`$DAGU_HOME/suspend`): The directory containing DAG suspend flags.
- `DAGU_ADMIN_LOG_DIR` (`$DAGU_HOME/logs/admin`): The directory where admin logs will be stored.
- `DAGU_BASE_CONFIG` (`$DAGU_HOME/config.yaml`): The path to the base configuration file.
- `DAGU_NAVBAR_COLOR` (`""`): The color to use for the navigation bar. E.g., `red` or `#ff0000`.
- `DAGU_NAVBAR_TITLE` (`Dagu`): The title to display in the navigation bar. E.g., `Dagu - PROD` or `Dagu - DEV`

You can configure the dagu's internal work directory by defining `DAGU_HOME` environment variables. The default path is `~/.dagu/`.
Note: All of the above environment variables are optional. If not set, the default values shown above will be used. If DAGU_HOME environment variable is not set, the default value is `$HOME/.dagu`.

## Sending email notifications

Expand Down Expand Up @@ -858,14 +874,6 @@ make build

Feel free to contribute in any way you want. Share ideas, questions, submit issues, and create pull requests. Thanks!

### Where is the history data stored?

It will store execution history data in the `DAGU__DATA` environment variable path. The default location is `$HOME/.dagu/data`.

### Where are the log files stored?

It will store log files in the `DAGU__LOGS` environment variable path. The default location is `$HOME/.dagu/logs`. You can override the setting by the `logDir` field in a YAML file.

### How long will the history data be stored?

The default retention period for execution history is 30 days. However, you can override the setting by the `histRetentionDays` field in a YAML file.
Expand Down
72 changes: 72 additions & 0 deletions admin/src/components/molecules/ConfirmModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Box, Button, Modal, Stack, Typography } from '@mui/material';
import React from 'react';

type Props = {
title: string;
buttonText: string;
children: React.ReactNode;
visible: boolean;
dismissModal: () => void;
onSubmit: () => void;
};

const style = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
bgcolor: 'background.paper',
border: '2px solid #000',
boxShadow: 24,
p: 4,
};

function ConfirmModal({
children,
title,
buttonText,
visible,
dismissModal,
onSubmit,
}: Props) {
React.useEffect(() => {
const callback = (event: KeyboardEvent) => {
const e = event || window.event;
if (e.key == 'Escape' || e.key == 'Esc') {
dismissModal();
}
};
document.addEventListener('keydown', callback);
return () => {
document.removeEventListener('keydown', callback);
};
}, [dismissModal]);

return (
<Modal open={visible} onClose={dismissModal}>
<Box sx={style}>
<Stack direction="row" alignContent="center" justifyContent="center">
<Typography variant="h6">{title}</Typography>
</Stack>
<Stack
direction="column"
alignContent="center"
justifyContent="center"
spacing={2}
mt={2}
>
<Box>{children}</Box>
<Button variant="contained" onClick={() => onSubmit()}>
{buttonText}
</Button>
<Button variant="contained" color="error" onClick={dismissModal}>
Cancel
</Button>
</Stack>
</Box>
</Modal>
);
}

export default ConfirmModal;
Loading

0 comments on commit 1df62b1

Please sign in to comment.