zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.4k stars 1.93k forks source link

Boilerplate to host Trilium on AWS #2964

Open cednore opened 2 years ago

cednore commented 2 years ago

TLDR: https://github.com/cednore/trilium

I have created a simple terraform boilerplate to self-host trilium by fully automated deployment on AWS. Everybody is welcome to check out the repo and file an issue if any found.

I will add a guide on this repo for self-starters and trilium fans, explaining how to host trilium on their AWS accounts at ease.

Tech stacks :hammer_and_wrench:

  1. Terraform
  2. AWS
  3. Ansible
  4. Docker

Infrastructure summary 🏗️

  1. Single VPC with 3 public/private subnets
  2. An EC2 instance (t3.micro as default), publicly accessible via SSH
  3. Dockerized app container (default zadam/trilium:0.55.1)
  4. HTTPS proxy powered by nginx (inside a docker container)
  5. CloudWatch log group to keep app logs and proxy logs
  6. S3 bucket to keep the app data backups
  7. Security groups for the app instance
  8. Route53 records for domain name registration (subdomain level as default)
  9. A SSL certificate issued by Let's Encrypt for the app domain name
  10. Ansible playbooks to install and configure trilium on the EC2 instance
  11. Everything is written in Terraform, highly modularized, wrapped by Terragrunt
thfrei commented 2 years ago

Just out of curiosity, how much does this hosting option cost?

cednore commented 2 years ago

@thfrei Roughly 27 bucks per month :stuck_out_tongue_winking_eye:

thfrei commented 2 years ago

Thank you. It looks like drilling a hole with a laser gun :-) But I guess the AWS template can also be used for other things. So it is a useful exercise, it's just not the most economical option, i'd say. :-p

cednore commented 2 years ago

Updated the hosting to consume ~8 bucks per month

antenore commented 2 years ago

Using AWS Lightsail I've deployed Trilium, including a fixed IP address, an SSL certificate from Let's Encrypt, and a DNS alias for $3.5 a month (first 3 months for free).

I've used the manual setup on an Ubuntu VM as it's cheaper than the Docker option.

I'm looking for cheaper solutions on AWS without using directly EC2 instances, but it won't be an easy task :-p

But anyway, with spot instances, Cold HDD, no snapshots and other tunings, or maybe some saving plans, it could be possible to go down to 1.00 USD per month.

image

image

image