Skip to content

Instantly share code, notes, and snippets.

@skeptrunedev
Created July 19, 2024 18:25
Show Gist options
  • Save skeptrunedev/84fa799c0de362405f41ceec3ae9bbeb to your computer and use it in GitHub Desktop.
Save skeptrunedev/84fa799c0de362405f41ceec3ae9bbeb to your computer and use it in GitHub Desktop.
Deploy Guide

Trieve Deploy Guide

1. Create a VPS

We typicaly do this through Hetzner, but EC2 or Compute Instances on GCP would also be ok. However, Hetzner is preferred unless you have a strong preference against it.

The preferred region is US-West.

For operating system, pick Ubuntu.

The smallest size in terms of vCPU and RAM is ideal.

2. Set DNS rules for the IP address of the server you just created

Set enough subdomains such that each service which will be hosted can have it's own domain.

Typically pick the name of the service you are hosting as the subdomain.

Make sure to change TTL to 3600.

3. Start a tmux session on the new server

Creating a tmux session is fairly important such that your session is persistent if someone else takes over after you sign off or otherwise needs to provide help.

4. Clone the git repo with the services that you will want to host

Sometimes you will need to install the github CLI for private repos. It's a more convenient way to deal with GH auth securely for private repos.

Make a folder called git_projects for the repo you are clonining. This is convenient hygeine if you go to clone more repos on the same box later or want to share files from the the HOME directory with less risk.

5. Install runtime deps

For Node, nvm is the recommended choice.

For python, attempt to use a venv and requirements.txt file when possible for max multi-tenancy of multiple demos.

6. Install Caddy as the reverse proxy

  1. sudo apt install caddy
  2. sudo vim /etc/caddy/Caddyfile

Within the Caddyfile, set up the domains from step 2 to reverse proxy properly to the server.

Roughly, it should be a repeat of the following for each domain and local service you are trying to proxy:

docs.trieve.ai {
    reverse_proxy localhost:3000
}

Save the caddy file!

Finally, start the caddy reverse proxy service:

system ctl start caddy

7. Setup UFW for security reasons

The ufw allow ssh is especially important, because if that is forgotten, you will not be able to get into the server ever again and need to do a full factory reset.

ufw allow ssh
ufw allow http
ufw allow https
ufw enable
@mariusfaber98
Copy link

If you choose Hetzner make sure you get your free $20 Hetzner Coupon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment