Skip to content

Commit 4fbd808

Browse files
committed
Makefile changes for running separate containers
1 parent 7ce41e6 commit 4fbd808

File tree

2 files changed

+53
-5
lines changed

2 files changed

+53
-5
lines changed

.devcontainer/Makefile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,40 @@ run:
8282
$(FULLTAG) bash
8383

8484

85-
# Expose the web server and the happy-server:
86-
PORTS= -p 8081:8081 -p 3005:3005
85+
# Port definitions for different modes
86+
PORTS_ALL= -p 8081:8081 -p 3005:3005
87+
PORTS_WEB= -p 8081:8081
88+
PORTS_SERVER= -p 3005:3005
89+
90+
# No ports forwarded by default (use root-all-ports, web, or server for specific needs)
8791
root:
8892
$(CONTAINER) run -it --rm -u root --hostname $(CONTAINER_HOSTNAME) \
8993
-v `pwd`/home:/root \
9094
-v `pwd`/..:$(WORKDIR) \
91-
$(PORTS) $(FULLTAG) bash
95+
$(FULLTAG) bash
96+
97+
# All ports forwarded (legacy behavior)
98+
root-all-ports:
99+
$(CONTAINER) run -it --rm -u root --hostname $(CONTAINER_HOSTNAME) \
100+
-v `pwd`/home:/root \
101+
-v `pwd`/..:$(WORKDIR) \
102+
$(PORTS_ALL) $(FULLTAG) bash
103+
104+
# Web client only (port 8081) - starts the webapp directly
105+
web:
106+
$(CONTAINER) run -it --rm -u root --hostname $(CONTAINER_HOSTNAME) \
107+
-v `pwd`/home:/root \
108+
-v `pwd`/..:$(WORKDIR) \
109+
$(PORTS_WEB) $(FULLTAG) \
110+
bash -c "cd $(WORKDIR)/happy && yarn web"
111+
112+
# Happy server only (port 3005) - starts the server directly
113+
server:
114+
$(CONTAINER) run -it --rm -u root --hostname $(CONTAINER_HOSTNAME) \
115+
-v `pwd`/home:/root \
116+
-v `pwd`/..:$(WORKDIR) \
117+
$(PORTS_SERVER) $(FULLTAG) \
118+
bash -c "cd $(WORKDIR) && ./happy-demo.sh start && tail -f /dev/null"
92119

93120
AGENT_LAYERS = Dockerfile.claude Dockerfile.copilot
94121
# Dockerfile.gemini
@@ -215,5 +242,5 @@ info:
215242
@echo CONTAINER_HOSTNAME=$(CONTAINER_HOSTNAME)
216243

217244

218-
.PHONY: claude-beads claude-github setup-claude happy run build root pull-main \
219-
inside-setup outside-setup install-pat install-ssh-deploy-key gh-auth
245+
.PHONY: claude-beads claude-github setup-claude happy run build root root-all-ports \
246+
web server pull-main inside-setup outside-setup install-pat install-ssh-deploy-key gh-auth

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
This repository contains a working self-hosted setup of Happy (server + CLI) with automated e2e testing.
44

5+
## QUICKSTART: Self Hosting
6+
7+
Run your own Happy instance with two containers - one for the webapp and one for the server:
8+
9+
```bash
10+
cd .devcontainer
11+
make build # Build the container image (first time only)
12+
13+
# In terminal 1 - start the server (port 3005):
14+
make server
15+
16+
# In terminal 2 - start the webapp (port 8081):
17+
make web
18+
```
19+
20+
Then open http://localhost:8081 in your browser.
21+
22+
**Other container options:**
23+
- `make root` - Interactive shell with no ports forwarded
24+
- `make root-all-ports` - Interactive shell with both ports (8081 + 3005) forwarded
25+
526
## Getting Started
627

728
### Build and Run Container

0 commit comments

Comments
 (0)