Skip to content

Commit 701c466

Browse files
authored
README: add instructions for deploying on Modal (#142)
Signed-off-by: Peyton Walters <[email protected]>
1 parent 854eae0 commit 701c466

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

+50
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,56 @@ destination="/home/nonroot"
121121

122122
</details>
123123

124+
<details>
125+
<summary>Deploy on Modal</summary>
126+
127+
See the [Modal docs](https://modal.com/docs/guide/managing-deployments) for full instructions on long-lived deployments.
128+
129+
Create a `golinks.py` file:
130+
131+
```python
132+
import subprocess
133+
134+
import modal
135+
136+
app = modal.App(name="golinks")
137+
138+
vol = modal.Volume.from_name("golinks-data", create_if_missing=True)
139+
140+
image = modal.Image.from_registry(
141+
"golang:1.23.0-bookworm",
142+
add_python="3.10",
143+
).run_commands(["go install -v github.com/tailscale/golink/cmd/golink@latest"])
144+
145+
@app.cls(
146+
image=image,
147+
secrets=[modal.Secret.from_name("golinks")],
148+
volumes={"/root/.config": vol},
149+
keep_warm=1,
150+
concurrency_limit=1,
151+
)
152+
class Golinks:
153+
@modal.enter()
154+
def start_golinks(self):
155+
subprocess.Popen(
156+
[
157+
"golink",
158+
"-verbose",
159+
"--sqlitedb",
160+
"/root/.config/golink.db",
161+
]
162+
)
163+
```
164+
165+
Then create your secret and deploy with the [Modal CLI](https://github.com/modal-labs/modal-client):
166+
167+
```sh
168+
$ modal secret create golinks TS_AUTHKEY=<key>
169+
$ modal deploy golinks.py
170+
```
171+
172+
</details>
173+
124174
## Permissions
125175

126176
By default, users own the links they create and only they can update or delete those links.

0 commit comments

Comments
 (0)