npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

surek

v1.0.3

Published

Surek is an utility built on top of Docker Compose to make managing self-hosted services easier.

Downloads

3

Readme

Surek

Surek is an utility built on top of Docker Compose to make managing self-hosted services easier.

It manages Caddy reverse proxy for your containers, can backup Docker volumes, and comes with Portainer and Netdata to easily manage and monitor your server.

Install

Surek requires that you have Docker and Node.js (tested with v22) installed. It also assumes you have a domain pointed to your server.

Run this command to install Surek. If your docker installation requires using sudo, install Surek with sudo too.

npm install -g surek

Usage

Create a folder where you wish to keep your config and service definitions (stacks). If you intend to push this folder into git, add this line to .gitignore

surek-data

Create a file named surek.yml. This is main config.

# Root domain 
root_domain: example.com
# Used for Netdata, also can be used in stack configs
default_auth: surek:test42
# Optional. Backup volumes into S3 compatible storage
backup:
  password: "test42"
  s3_endpoint: "s3.eu-central-003.backblazeb2.com"
  s3_bucket: "surek-backup"
  s3_access_key: "beep"
  s3_secret_key: "boop"
# Optional. GitHub personal access token. Enables pulling stacks from github (including private repositories)
github:
  pat: secret

With central config in place, you can start system containers. Those include Caddy, Portainer, Netdata and everything else Surek needs to work properly.

# Run with sudo if your Docker installation requires it
surek system start

After system containers started, you can verify their status with command:

surek status

Next are stacks. Stack is a collection of services that are related. In Surek, stacks are stored in stacks folder (create it!) and defined by surek.stack.yml file. This file defines location of compose file and other stack parameters.

name: any-name-you-want
# All files we need are already here. Convenient for services that have their Docker images in the registry
source:
  type: local
  # Or pull service from Github
  # type: github
  # #ref is git reference (commit, tag, branch, etc) and is optional, will use HEAD by default
  # slug: OlegWock/repo-name#ref

# Path to compose file relative to stack config in case of local source, or relative to repo root for github sources
compose_file_path: "./docker-compose.yml"
# Optional. Services to expose as subdomains
public:
  # You can use <root> and other variables in configs (about them later)
  - domain: owncloud.<root>
    target: owncloud:8080 # <service name>:<port inside container>
    auth: admin:password123 # Optional. Adds Basic HTTP auth to subdomain
# Optional. Environment variables to add to particular (or all) container
env:
  by_container:
    owncloud: # service name
      - OWNCLOUD_DOMAIN=owncloud.<root>
      - OWNCLOUD_TRUSTED_DOMAINS=owncloud.<root>
  shared:
    - EXAMPLE=1
# Optional. Exclude certain volumes from backup
backup:
  exclude_volumes:
    - volume-name

And last important piece is compose file itself. You write compose files as you would do normally, except a few specifics.

  • You don't need to expose any ports from container
  • You should use named volumes (not bind mounts) if you want them to be backuped. It's also important to not set any parameters for these volumes (like driver or driver parameters), as they will be overwritten by Surek.
  • All services (from all stacks) will be placed in same internal network, so if you have any code depending on container hostname (e.g. connecting database to app), make sure you set hostname explicitly or use unique service name for them to avoid collisions with common services (like MySQL, Redis, etc.) from other stacks.

With that finished, you can start stack with this command:

surek deploy <stack name from config>

This will deploy stack. What happens under the hood is:

  1. If using GitHub, Surek will pull latest version into temporary folder.
  2. Surek will copy all files from stack folder (folder where surek.stack.yml is stored) into temporary folder (overwriting files and merging folders). If you need to overwrite or add any files to stack pulled from GitHub repo, this is the way.
  3. Surek will read compose file (by path specified in stack config), transform it by adding containers to network, updating volume configuration, etc., and save as docker-compose.surek.yml.
  4. Docker Compose will be used to deploy the stack.

To stop stack:

surek stop <stack name>

To start stack again without re-pulling and transforming compose file:

surek start <stack name>

Examples

You can find example stacks in example-stacks folder.

Variables

In Stack config, it's possible to use variables in public.domain, public.auth, and env sections. List of available variables:

  • <root> – root domain, as defined in surek.yml.
  • <default_auth> – shortcut for <default_user>:<default_password>.
  • <default_user> – default user, as defined in surek.yml.
  • <default_password> – default password, as defined in surek.yml.

And those are available only if you have backup configured in surek.yml:

  • <backup_password>
  • <backup_s3_endpoint>
  • <backup_s3_bucket>
  • <backup_s3_access_key>
  • <backup_s3_secret_key>