Skip to content

Commit e9231e1

Browse files
committed
feat: local setup
1 parent a9b23f9 commit e9231e1

4 files changed

Lines changed: 329 additions & 8 deletions

File tree

.gitignore

Lines changed: 159 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,164 @@
11
# Python
2-
.venv
3-
*.pyc
2+
# Byte-compiled / optimized / DLL files
43
__pycache__/
5-
*.pyo
6-
*.pyd
7-
*.pyw
8-
*.pyz
9-
*.pywz
10-
*.ipynb_checkpoints/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# poetry
99+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103+
#poetry.lock
104+
105+
# pdm
106+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107+
#pdm.lock
108+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109+
# in version control.
110+
# https://pdm.fming.dev/#use-with-ide
111+
.pdm.toml
112+
113+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114+
__pypackages__/
115+
116+
# Celery stuff
117+
celerybeat-schedule
118+
celerybeat.pid
119+
120+
# SageMath parsed files
121+
*.sage.py
122+
123+
# Environments
124+
.env
125+
.venv
126+
env/
127+
venv/
128+
ENV/
129+
env.bak/
130+
venv.bak/
131+
132+
# Spyder project settings
133+
.spyderproject
134+
.spyproject
135+
136+
# Rope project settings
137+
.ropeproject
138+
139+
# mkdocs documentation
140+
/site
141+
142+
# mypy
143+
.mypy_cache/
144+
.dmypy.json
145+
dmypy.json
146+
147+
# Pyre type checker
148+
.pyre/
149+
150+
# pytype static type analyzer
151+
.pytype/
152+
153+
# Cython debug symbols
154+
cython_debug/
155+
156+
# PyCharm
157+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159+
# and can be added to the global gitignore or merged into this file. For a more nuclear
160+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161+
#.idea/
11162

12163
# TypeScript React
13164
node_modules/

Caddyfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
http://localhost:8080 {
2+
handle /api/* {
3+
reverse_proxy hatchet-api:8080
4+
}
5+
6+
handle /* {
7+
reverse_proxy hatchet-frontend:80
8+
}
9+
}

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Hatchet Python Quickstart
2+
3+
The following is a template repo to get started with the Hatchet Python SDK. It includes instructions for getting started with Hatchet cloud along with a locally running instance of Hatchet.
4+
5+
### Cloud Version
6+
7+
Navigate to your settings tab in the Hatchet dashboard. You should see a section called "API Keys". Click "Create API Key", input a name for the key and copy the key. Then set the following environment variables:
8+
9+
```
10+
HATCHET_CLIENT_TOKEN="<token>"
11+
```
12+
13+
Then start a worker via:
14+
15+
```
16+
poetry run python worker.py
17+
```
18+
19+
**Next steps:** see [Running Workflows](#running-workflows) to trigger your first Hatchet workflow.
20+
21+
### Local Version
22+
23+
Run the following command to start the Hatchet instance:
24+
25+
```
26+
docker compose up
27+
```
28+
29+
This will start a Hatchet instance on port `8080`. You should be able to navigate to [localhost:8080](localhost:8080) and use the following credentials to log in:
30+
31+
```
32+
Email: admin@example.com
33+
Password: Admin123!!
34+
```
35+
36+
Next, navigate to your settings tab in the Hatchet dashboard. You should see a section called "API Keys". Click "Create API Key", input a name for the key and copy the key. Then set the following environment variables:
37+
38+
```
39+
HATCHET_CLIENT_TOKEN="<token>"
40+
```
41+
42+
**Next steps:** see [Running Workflows](#running-workflows) to trigger your first Hatchet workflow.
43+
44+
## Running Workflows
45+
46+
## Using the Playground

docker-compose.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
version: "3.8"
2+
services:
3+
postgres:
4+
image: postgres:latest
5+
command: postgres -c 'max_connections=200'
6+
restart: always
7+
hostname: "postgres"
8+
environment:
9+
- POSTGRES_USER=hatchet
10+
- POSTGRES_PASSWORD=hatchet
11+
- POSTGRES_DB=hatchet
12+
ports:
13+
- "5435:5432"
14+
volumes:
15+
- hatchet_postgres_data:/var/lib/postgresql/data
16+
healthcheck:
17+
test: ["CMD-SHELL", "pg_isready", "-d", "hatchet"]
18+
interval: 10s
19+
timeout: 10s
20+
retries: 5
21+
start_period: 10s
22+
rabbitmq:
23+
image: "rabbitmq:3-management"
24+
hostname: "rabbitmq"
25+
ports:
26+
- "5673:5672" # RabbitMQ
27+
- "15673:15672" # Management UI
28+
environment:
29+
RABBITMQ_DEFAULT_USER: "user"
30+
RABBITMQ_DEFAULT_PASS: "password"
31+
volumes:
32+
- "hatchet_rabbitmq_data:/var/lib/rabbitmq"
33+
- "hatchet_rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf" # Configuration file mount
34+
healthcheck:
35+
test: ["CMD", "rabbitmqctl", "status"]
36+
interval: 10s
37+
timeout: 10s
38+
retries: 5
39+
migration:
40+
image: ghcr.io/hatchet-dev/hatchet/hatchet-migrate:latest
41+
environment:
42+
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet"
43+
depends_on:
44+
postgres:
45+
condition: service_healthy
46+
setup-config:
47+
image: ghcr.io/hatchet-dev/hatchet/hatchet-admin:latest
48+
command: /hatchet/hatchet-admin quickstart --skip certs --generated-config-dir /hatchet/config --overwrite=false
49+
environment:
50+
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet"
51+
DATABASE_POSTGRES_PORT: "5432"
52+
DATABASE_POSTGRES_HOST: "postgres"
53+
SERVER_TASKQUEUE_RABBITMQ_URL: amqp://user:password@rabbitmq:5672/
54+
SERVER_AUTH_COOKIE_DOMAIN: localhost:8080
55+
SERVER_AUTH_COOKIE_INSECURE: "t"
56+
SERVER_GRPC_BIND_ADDRESS: "0.0.0.0"
57+
SERVER_GRPC_INSECURE: "t"
58+
SERVER_GRPC_BROADCAST_ADDRESS: localhost:7077
59+
volumes:
60+
- hatchet_certs:/hatchet/certs
61+
- hatchet_config:/hatchet/config
62+
depends_on:
63+
migration:
64+
condition: service_completed_successfully
65+
rabbitmq:
66+
condition: service_healthy
67+
postgres:
68+
condition: service_healthy
69+
hatchet-engine:
70+
image: ghcr.io/hatchet-dev/hatchet/hatchet-engine:latest
71+
command: /hatchet/hatchet-engine --config /hatchet/config
72+
restart: on-failure
73+
depends_on:
74+
setup-config:
75+
condition: service_completed_successfully
76+
migration:
77+
condition: service_completed_successfully
78+
ports:
79+
- "7077:7070"
80+
environment:
81+
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet"
82+
SERVER_GRPC_BIND_ADDRESS: "0.0.0.0"
83+
SERVER_GRPC_INSECURE: "t"
84+
volumes:
85+
- hatchet_certs:/hatchet/certs
86+
- hatchet_config:/hatchet/config
87+
hatchet-api:
88+
image: ghcr.io/hatchet-dev/hatchet/hatchet-api:latest
89+
command: /hatchet/hatchet-api --config /hatchet/config
90+
restart: on-failure
91+
depends_on:
92+
setup-config:
93+
condition: service_completed_successfully
94+
migration:
95+
condition: service_completed_successfully
96+
environment:
97+
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet"
98+
volumes:
99+
- hatchet_certs:/hatchet/certs
100+
- hatchet_config:/hatchet/config
101+
hatchet-frontend:
102+
image: ghcr.io/hatchet-dev/hatchet/hatchet-frontend:latest
103+
caddy:
104+
image: caddy:2.7.6-alpine
105+
ports:
106+
- 8080:8080
107+
volumes:
108+
- ./Caddyfile:/etc/caddy/Caddyfile
109+
110+
volumes:
111+
hatchet_postgres_data:
112+
hatchet_rabbitmq_data:
113+
hatchet_rabbitmq.conf:
114+
hatchet_config:
115+
hatchet_certs:

0 commit comments

Comments
 (0)