Skip to content

Commit

Permalink
README: add instructions for deploying on Modal
Browse files Browse the repository at this point in the history
Signed-off-by: Peyton Walters <peyton@modal.com>
  • Loading branch information
pawalt committed Aug 29, 2024
1 parent 08da6ba commit b09767c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,56 @@ destination="/home/nonroot"

</details>

<details>
<summary>Deploy on Modal</summary>

See the [Modal docs](https://modal.com/docs/guide/managing-deployments) for full instructions on long-lived deployments.

Create a `golinks.py` file:

```python
import subprocess
import modal
app = modal.App(name="golinks")
vol = modal.Volume.from_name("golinks-data", create_if_missing=True)
image = modal.Image.from_registry(
"golang:1.23.0-bookworm",
add_python="3.10",
).run_commands(["go install -v github.com/tailscale/golink/cmd/golink@latest"])
@app.cls(
image=image,
secrets=[modal.Secret.from_name("golinks")],
volumes={"/root/.config": vol},
keep_warm=1,
concurrency_limit=1,
)
class Golinks:
@modal.enter()
def start_golinks(self):
subprocess.Popen(
[
"golink",
"-verbose",
"--sqlitedb",
"/root/.config/golink.db",
]
)
```

Then create your secret and deploy with the [Modal CLI](https://github.com/modal-labs/modal-client):

```sh
$ modal secret create golinks TS_AUTHKEY=<key>
$ modal deploy golinks.py
```

</details>

## Permissions

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

0 comments on commit b09767c

Please sign in to comment.