Skip to content

Commit f52f968

Browse files
committed
huginn changes only
1 parent 4b9cf29 commit f52f968

File tree

2 files changed

+79
-16
lines changed

2 files changed

+79
-16
lines changed

samples/huginn/README.md

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,77 @@
22

33
[![1-click-deploy](https://defang.io/deploy-with-defang.png)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-huginn-template%26template_owner%3DDefangSamples)
44

5+
This sample shows how to deploy Huginn with Defang.
6+
57
Huginn is a system for building agents that perform automated tasks for you online. Huginn's Agents can monitor the web, respond to events, and act on your behalf. They propagate events along a directed graph. It's like a customizable IFTTT or Zapier on your own server, ensuring data privacy.
68

79
## Prerequisites
810

911
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
10-
2. Have a managed database service configured and have the connection details ready. Neon postgres is a good free option.
11-
3. (optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc), make sure you have properly [authenticated your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).
12+
2. Have a managed database service configured and ready, such as [Neon PostgreSQL](https://neon.tech/)
13+
3. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
14+
4. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
15+
16+
## Development
17+
18+
To run the application locally, you can use the following command:
19+
20+
```bash
21+
docker compose -f ./compose.yaml -f ./compose.dev.yaml up
22+
```
23+
This will start the Postgres container and the Huginn container. Huginn will be available at `http://localhost:3000` with the username `admin` and password `password`.
24+
25+
## Configuration
26+
27+
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration):
28+
29+
> Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
30+
31+
### `DATABASE_NAME`
32+
The name of the database.
33+
```bash
34+
defang config set DATABASE_NAME
35+
```
36+
37+
### `DATABASE_USERNAME`
38+
The username used with the database.
39+
```bash
40+
defang config set DATABASE_USERNAME
41+
```
42+
43+
### `DATABASE_PASSWORD`
44+
The password used with the database.
45+
```bash
46+
defang config set DATABASE_PASSWORD
47+
```
48+
49+
### `DATABASE_HOST`
50+
The host of the database.
51+
```bash
52+
defang config set DATABASE_HOST
53+
```
54+
55+
## Deployment
56+
57+
> [!NOTE]
58+
> Download [Defang CLI](https://github.com/DefangLabs/defang)
1259
13-
## Local
60+
### Defang Playground
1461

15-
For development, we use a Postgres container. The Postgres container is defined in the `compose.dev.yaml` file. The Huginn container is defined in the `compose.yaml` file, with some overrides in the `compose.dev.yaml` file so it can correctly connect to the local database container.
62+
Deploy your application to the Defang Playground by opening up your terminal and typing:
63+
```bash
64+
defang compose up
65+
```
1666

17-
To start the local environment, run `docker compose -f ./compose.yaml -f ./compose.dev.yaml up`. This will start the Postgres container and the Huginn container. Huginn will be available at `http://localhost:3000` with the username `admin` and password `password`.
67+
### BYOC (AWS)
1868

19-
## Deploying
69+
If you want to deploy to your own cloud account, you can use Defang BYOC:
2070

21-
1. Open the terminal and type `defang login`
22-
2. Add your database connection details using `defang config` by typing `defang config set <CONFIG_VAL>` where `<CONFIG_VAL>` is the each of the following `DATABASE_NAME`, `DATABASE_USERNAME`, `DATABASE_PASSWORD`, `DATABASE_HOST`. For example `defang config set DATABASE_NAME` and pasting your database name.
23-
3. Type `defang compose up` in the CLI.
24-
4. Your app will be running within a few minutes.
71+
1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
72+
2. Run in a terminal that has access to your AWS environment variables:
73+
```bash
74+
defang --provider=aws compose up
75+
```
2576

2677
---
2778

samples/huginn/compose.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
2-
huginn:
2+
huginn-app:
33
image: ghcr.io/huginn/huginn
44
restart: unless-stopped
55
ports:
@@ -10,15 +10,27 @@ services:
1010
resources:
1111
reservations:
1212
cpus: '1.0'
13-
memory: '2G'
13+
memory: 1G
1414
healthcheck:
1515
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
1616
interval: 1m30s
1717
timeout: 30s
1818
retries: 10
1919
environment:
2020
- DATABASE_ADAPTER=postgresql
21-
- DATABASE_NAME
22-
- DATABASE_USERNAME
23-
- DATABASE_PASSWORD
24-
- DATABASE_HOST
21+
- DATABASE_NAME=huginn
22+
- DATABASE_USERNAME=huginn
23+
- DATABASE_PASSWORD=${POSTGRES_PASSWORD}
24+
- DATABASE_HOST=postgresx
25+
postgresx:
26+
image: postgres:14
27+
environment:
28+
- POSTGRES_USER=huginn
29+
- POSTGRES_PASSWORD
30+
- POSTGRES_DB=huginn
31+
ports:
32+
- mode: host
33+
target: 5432
34+
published: 5432
35+
networks:
36+
- public

0 commit comments

Comments
 (0)