Skip to content

storacha/bluesky-backup-webapp-server

Repository files navigation

blusky-backup-webapp-server

HOT HOT HOT identity and data backup for your ATProto PDS

Please visit https://bsky.storage to get started!

Local

Set up .env

First, please copy .env.tpl to .env and take a moment to review the contents and ensure they are correct for your dev plans.

Set up Postgresql

On OSX you can do this with:

brew install postgresql

You may need to start the postgres service after installation with

brew services start postgresql

After setup you'll need to create your development database. Use psql to start a database session:

psql

If this is your first time setting up postgres on your machine. There's a chance the command above fails when you run it. If that happens, try the one below instead:

psql postgres

And then in the SQL console:

create database bsky_backups_dev;
create role admin with login password 'bluey';
grant all privileges on database bsky_backups_dev to admin;

These names and credentials match the examples in .env.tpl and should be customized for your setup.

When you start the dev server for ths first time, be sure to use this command, pnpm run atproto:generate-jwk to generate the JWK endpoint key so you don't encounter this:

missing endpoint error TOKEN_ENDPOINT_PRIVATE_KEY_JWK

Set up ngrok

  1. Run pnpm dev.
  2. In another terminal, run script/start-tunnel.
    • (optional) You may want to set up a static domain in ngrok. Once you've set up a static domain, you can use it by instead running script/start-tunnel --url spicy-rooster-fondly.ngrok-free.app (replacing the URL with your own).
  3. Visit your forwarding URL in the browser.

Storybook

For many types of UI development you don't need a running app. Simply run pnpm storybook and visit http://localhost:6006 to see our Storybook.

Deployment

Deployment is handled via terrform using a Makefile.

Prerequisites:

  • Install and properly configured aws cli tool
  • Install OpenTofu (OpenTofu is a fork of Terraform that retains a full open source license -- please use OpenTofu when deploying Storacha services in order to avoid licensing issues).
brew update
brew install opentofu
tofu -u version
  • Install Docker (DockerDesktop for Mac for example)

To setup a deployment you can use for remote testing, do the following:

All commands for deployment should be run from the deploy directory, so do cd deploy before anything else.

From the deploy directory:

  1. Copy .env.terraform.tpl to .env.terraform
  2. Fill out the missing variables in .env.terraform (put your name in for TF_WORKSPACE for dev purposes)
  3. Run make apply -- the first time you run this, it will take a LONG time to deploy everything - also you'll have to confirm deploying various things a few times along the way
  4. If all is well, there's still a "blue-green" deployment to finish, so you'll want to make wait-deploy to wait for that to complete
  5. Lastly, run make migrate to run migrations on the remote database

Your environment should be deployed at ~your-name~.bsky.storage

About

A server-side version of the Bluesky Backup app

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 7