Coder Social home page Coder Social logo

vault's Introduction

Template for deploying Vaultwarden on Fly.io

This is a template for deploying Vaultwarden on Fly.io with Caddy for websockets support and supercronic for hourly restic backups with e-mail failure notification via msmtp.

This uses a single fly machine, within Fly's free allowance.

Usage

You first need to create a new repo for your config, by clicking on the Use this template button on this page.

Then, clone your new repo and cd into it.

Install dependencies

  1. Install go-task:

    We use go-task to automate some steps, you can check the task code under .taskfiles. to see which commands each task run.

    brew install go-task/tap/go-task
  2. Install flyctl:

    brew install flyctl

Configuration

The .config.env file contains environment variables needed to deploy the apps in this template.

  1. Copy the .config.sample.env to .config.env and fill out all the environment variables. All uncommented variables are required.

Fly.io setup

For some commands below, we use a task instead of flyctl because we the task writes (on app creation) and reads (subsequent commands) your app name from the config file. This is the only way to keep your app name hidden.

  1. Signup to Fly

    If you already have a Fly account, use flyctl auth login instead.

    flyctl auth signup
  2. Create a new fly app

    If this is your first app, you'll be asked to add credit card information, but, don't worry, you'll not be charged by this app.

    task fly:app:create
  3. Create a new volume

    This will show you a warning about invididual volumes. It's ok to have a single volume because we're not concerned about downtime for our Vaultwarden instance.

    task fly:volume:create
  4. Deploy your app

    task fly:app:deploy
  5. Setup your custom domain

    After your app is deployed, follow the steps here to setup your custom domain.

  6. Open your new Vaultwarden website

    That's all! Now you can open your custom domain and Vaultwarden should work.

Keeping dependencies up to date

This template uses Renovatebot to scan and open new PRs when dependencies are out of date.

To enable this, open their Github app page, click the "Configure" button, then choose your repo. The template already provides Renovate configs and there's no need for further action.

Troubleshooting

If your deployment failed or you can't open Vaultwarden web, you can see the logs with:

task fly:app:logs

If that command fails (eg, if the machine is stopped), try opening your logs in the browser:

task fly:app:logs:web

You can also ssh in the machine with:

task fly:app:ssh

and check individual logs using overmind:

# Run this command inside your fly machine
overmind connect vaultwarden

This will open a tmux window with vaultwarden logs. You can scroll your tmux window with Ctrl-B-] and use Ctrl-B-D to exit the tmux window.

Substitute vaultwarden with caddy, or backup to see logs for other apps.

Continuous deployment

After your first manual deploy to Fly.io, per instructions above, you can setup continuous deployment via Github Actions.

  1. Install Github CLI

    brew install gh
  2. Login to Github

    gh auth login
  3. Set Fly secrets to your Github repo

    task github:secrets:set
  4. Test your workflow deployment

    task github:workflow:deploy

That's all! Now, any changes to your Dockerfile, fly.toml or scripts/config will trigger a fly deploy.

FAQ

  1. Why every fly command I run errors with: Error: the config for your app is missing an app name?

    For security reasons the app name is not sdaved in the fly.toml file. In that case, you have to add -a your-app-name to all fly commands.

    Your app name is found in your .config.env file.

    Example:

    fly secrets list -a your-app-name

    Or you can add:

    app = "your-app-name"

    to the beginning of your fly.toml file.

  2. How do I update the environment variables?

    After updating the .config.env file, you can update your environment variables in two different ways:

    task fly:secrets:set

    will read your .config.env file and import every defined variable to your fly app, Or you can just do a new deployment:

    task fly:app:deploy

    which will run the command above and do a new deployment afterwards.

vault's People

Contributors

sean351 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.