Giter Club home page Giter Club logo

localstatus's Introduction

LocalStatus

Docs here

Automatically monitors the important parts of your local development environment. Not in a fancy way. Just in a fifteen-year-old-Honda-Civic kind of way.

  • Ping your local services
  • Verify needed files exist
  • Keep an eye on Git repos
  • and more

This is a work in progress. I use it, but I'd definitely still call it a beta. I'm hoping for thoughtful feedback and, of course, GitHub stars. ๐Ÿ˜… External validation for the win!

Example

After you create ~/.config/localstatus.toml and define your checks, you can run localstatus to perform them. With no arguments, it runs them all once:

/Users/tyler/dev/localstatus: localstatus
    6 checks to run...
!   zola check: exit status 101
OK  /Users/tyler/dev/minesweeper/package.json dependencies
OK  https://github.com
OK  Personal website HTTPS: tylermumford.com:443
OK  localstatus: Up to date with origin/main
OK  /Users/tyler/.config/localstatus.toml exists (526 bytes)
1 checks failed

Or, with the --watch flag, it keeps going. I like to keep a terminal window open all day to keep an eye on everything.

Screenshot of a terminal window. The first two lines say "Running every 3 minutes... (press Enter to re-run immmediately; press Ctrl-C to stop)". The rest is the same as the snippet above.

Configuring the checks

LocalStatus is configured with the TOML format. TOML is widely supported and has nice features, like comments and flexible string literals.

Right now, LocalStatus only looks for configuration at the hard-coded path of ~/.config/localstatus.toml. This will change and become more flexible in the future.

All of the available checks are documented here.

The config looks like this:

# ~/.config/localstatus.toml
checks = [
    {check = "command", program = "zola", args = ["check"]},
    {check = "npm.install", package = "/Users/tyler/dev/minesweeper/package.json"},
    {check = "http.ok", url = "https://github.com"},
    {check = "tcp.open", address = "tylermumford.com:443", label = "Personal website HTTPS"},
    {check = "git.branch", dir = "/Users/tyler/dev/localstatus", base = "origin/main"},
    {check = "file.exists", path = "/Users/tyler/.config/localstatus.toml"}
]

The snippet above is using TOML's inline table syntax to reduce the number of lines. The following snippet uses TOML's "array of tables" syntax to have shorter lines. Both snippets are equivalent.

[[checks]]
check = "command"
program = "zola"
args = ["check"]
dir  = "/Users/tyler/dev/tylermumford.github.io"

[[checks]]
check = "npm.install"
package = "/Users/tyler/dev/minesweeper/package.json"

[[checks]]
check = "http.ok"
url = "https://github.com"

[[checks]]
check = "tcp.open"
address = "tylermumford.com:443"
label = "Personal website HTTPS"

[[checks]]
check = "git.branch"
dir = "/Users/tyler/dev/localstatus"
base = "origin/main"

[[checks]]
check = "file.exists"
path = "/Users/tyler/.config/localstatus.toml"

Installing

brew install tylermumford/brew/localstatus

Or, download the source and run go install

(Scoop support will be added, too, but it's not ready yet.)

Motivation / Rant

๐Ÿ˜ตโ€๐Ÿ’ซ

At work, my local development environment needs to be just so. I need to remember to connect to the VPN, run the cloud storage emulator, and check the local status pages of about twelve services in case one of them has a problem. I need to make sure my repositories aren't falling too far behind my team, my database has the latest migrations, and I've run npm install since the last update to package.json. And there are local files that need to exist even though they aren't checked in to source control.

That's a lot of moving pieces, so of course, I created a tool to check them all for me.

Also, I'm just saddened by the trend I've been seeing with more and more systems only being runnable in the cloud. If your system doesn't work locally, then you can't do anything when your Internet goes down, or your cloud provider goes down, or your IT department can't get you access to something right away. In other words, local development is a "cause" I believe in.

Relevant projects

If you think LocalStatus is interesting, you might also like these projects:

Disclosure

I'm creating this project because I think it needs to exist. I use something similar at work already. But I'm also planning to create some paid macOS and Windows companion apps that will integrate with LocalStatus. Those will most likely be closed source. I don't want to sell the project. My hope is to create something of value that can earn some money.

This is my first open source project that I actually hope lots of people will use. But again, it's my first, so please bear with me as I figure this out. ๐Ÿ’›

Trivia

  • This project was almost named Brock, because GitHub generated a repo name of "friendly-broccoli."
  • This project was almost named Checkmate, generated by ChatGPT.
  • This project was almost named ldca, for Local Development is Cool Again.
  • This project was almost named Local Host Checker, for the cool acronym LHC.

localstatus's People

Contributors

tylermumford avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

localstatus's Issues

Two Git repos

As a developer, I want the git.branch output to indicate the repository somehow so that I can distinguish between two different repos in the output.

Known memory leak

Memory usage keeps increasing when using the tool in --watch mode. I've seen it climb up to 40 MB, which isn't terrible, but it's still a memory leak.

Config Location

Love the concept of this program. The one aspect that struck me odd though was that there was only one location to store the config. Granted it is a completely reasonable location and it should work for most of your potential users that only have one large project to manage. But I had these additional thoughts that I hope may be a consideration.

  1. ~/.local/localstatus.toml for a config that is unique to that machine for the user. Some merging possibilities:
    1. Don't merge. Just prefer ~/.local/localstatus.toml over ~/.config/localstatus.toml
    2. Merge treating ~/.config settings as defaults but only if it's allowed by a setting in ~/.local
    3. Merge automatically treating ~/.config settings as defaults
  2. /path/to/project_name/.local/localstatus.toml for when you have multiple large and disparate projects that share almost nothing on any given machine but are scattered across machines in different distributions and may have incompatible needs with one or more local projects

Benefits for number 1

  1. Safest, no accidental settings contamination possible
  2. Safety managed, accidental settings contamination less likely
  3. Should be safe as long as the settings don't get too complex

Safety is a relative concept as I don't believe anything your tool does is potentially destructive. So safety is a concept of settings for one project being incompatible with another project on the same machine. Something that is highly unlikely to happen for many devs but is a definite possibility. For instance many projects on the same machine may reference the same environment variables. Checking only system environment variables may not be good enough as some projects may use .env files or similar tools to make the project environment unique for itself.

Example for number 2

  • MachineA has ProjectA and ProjectB
  • MachineB has ProjectB, ProjectC, and ProjectD
  • MachineC has ProjectA, ProjectD, ProjectE, and ProjectF

Benefits of number 2

  • May be much easier to keep the config local to the project instead of the local or network user account
  • Updated config changes could be updated in each project with a simple git pull or what have you
  • Running localstatus in a project would not give you errors for things not related to that specific project

Grouping

It would be nice to be able to group checks together.

This is possible with separators, but indentation might be nicer.

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.