Skip to content

AlexanderRichey/linksaver

Repository files navigation

Sailbot Notes

Sailbot Notes is a webapp that allows users to take notes, and search, filter, and tag them.

I created this app becuase I was curious about a few new technologies. On the backend, I wanted to try out Tom Christie's Starlette, which is awesome. On the frontend, I was curious about Turbolinks and Stimulus. These libraries were used to build Hey's email app, which notably doesn't use a client-rendered JavaScript framework such as React. I have some observations about these technologies which I've told myself I'll write a blog post about someday. In the meantime, here's how to setup the project.

Local development

docker-compose up

That's it. Go to a web browser and open localhost:8000.

Deploy to Lightsail

Sailbot Notes has two components that need to be setup: a Mongo database and the application container.

MongoDB

  1. Go to Lightsail and create an instance with Ubuntu 20.04. Copy the contents of mongo-cloud-init into the launch script field. This script installs and configures MongoDB. WARNING: This script is fine for this demo, but it's not up to par for use in production.
  2. After the instance is ready, SSH into it and make sure that mongo was installed and is up by running systemctl status mongod.
  3. Note the internal ip of your instance.

Build and upload your container image

  1. Go to Lightsail and create a container service. Skip setting up your first deployment.
  2. While your service is spinning up, build your container locally by running:
docker build . -t linksaver
  1. Upload your image to Lightsail:
aws lightsail push-container-image --service-name <the name you gave> --label linksaver --image linksaver
  1. Back on the Lightsail console, create a deployment with the following values.
    • Set an environment variable whose key is DB_CONNECTION and whose value is mongodb://admin:admin@<private ip of your mongo instance>:27017/?authSource=admin.
    • Open port 8000 with a protocol of HTTP.
  2. After your deployment is complete, go to your service's public URL and create an account for yourself.