diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06f39ab..56c413a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,16 +17,16 @@ concurrency: jobs: unit-tests-master: name: unit-tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: DOKKU_VERSION: master steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.7.x' @@ -59,16 +59,16 @@ jobs: unit-tests-0_19_0: name: unit-tests-0.19.0 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: DOKKU_TAG: v0.19.0 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.7.x' diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 846c457..0d7a4fb 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -10,7 +10,7 @@ on: jobs: tagged-release: name: tagged-release - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: "marvinpinto/action-automatic-releases@v1.2.1" diff --git a/Dockerfile b/Dockerfile index dcc9ca6..8a04a33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1 @@ -FROM redis:7.0.12 +FROM redis:7.2.3 diff --git a/Makefile b/Makefile index 51c3528..d14111a 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,9 @@ ifeq ($(SYSTEM_NAME),darwin) brew install shellcheck else ifeq ($(ARCH),arm64) - sudo add-apt-repository 'deb http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse' + sudo add-apt-repository 'deb http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse' else - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse' + sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse' endif sudo rm -rf /var/lib/apt/lists/* && sudo apt-get clean sudo apt-get update -qq && sudo apt-get install -qq -y shellcheck diff --git a/README.md b/README.md index 4f2f34e..d12d835 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dokku redis [![Build Status](https://img.shields.io/github/actions/workflow/status/dokku/dokku-redis/ci.yml?branch=master&style=flat-square "Build Status")](https://github.com/dokku/dokku-redis/actions/workflows/ci.yml?query=branch%3Amaster) [![IRC Network](https://img.shields.io/badge/irc-libera-blue.svg?style=flat-square "IRC Libera")](https://webchat.libera.chat/?channels=dokku) -Official redis plugin for dokku. Currently defaults to installing [redis 7.0.12](https://hub.docker.com/_/redis/). +Official redis plugin for dokku. Currently defaults to installing [redis 7.2.3](https://hub.docker.com/_/redis/). ## Requirements @@ -74,9 +74,9 @@ flags: - `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited) - `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to - `-p|--password PASSWORD`: override the user-level service password -- `-P|--post-create-network NETWORKS`: a comman-separated list of networks to attach the service container to after service creation +- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation - `-r|--root-password PASSWORD`: override the root-level service password -- `-S|--post-start-network NETWORKS`: a comman-separated list of networks to attach the service container to after service start +- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start - `-s|--shm-size SHM_SIZE`: override shared memory size for redis docker container Create a redis service named lollipop: @@ -93,7 +93,7 @@ export REDIS_IMAGE_VERSION="${PLUGIN_IMAGE_VERSION}" dokku redis:create lollipop ``` -You can also specify custom environment variables to start the redis service in semi-colon separated form. +You can also specify custom environment variables to start the redis service in semicolon-separated form. ```shell export REDIS_CUSTOM_ENV="USER=alpha;HOST=beta" @@ -151,7 +151,7 @@ dokku redis:info lollipop --version ```shell # usage -dokku redis:list +dokku redis:list ``` List all services: @@ -457,9 +457,9 @@ flags: - `-i|--image IMAGE`: the image name to start the service with - `-I|--image-version IMAGE_VERSION`: the image version to start the service with - `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to -- `-P|--post-create-network NETWORKS`: a comman-separated list of networks to attach the service container to after service creation +- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation - `-R|--restart-apps "true"`: whether or not to force an app restart (default: false) -- `-S|--post-start-network NETWORKS`: a comman-separated list of networks to attach the service container to after service start +- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start - `-s|--shm-size SHM_SIZE`: override shared memory size for redis docker container You can upgrade an existing service to a new image or image-version: @@ -501,9 +501,9 @@ flags: - `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited) - `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to - `-p|--password PASSWORD`: override the user-level service password -- `-P|--post-create-network NETWORKS`: a comman-separated list of networks to attach the service container to after service creation +- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation - `-r|--root-password PASSWORD`: override the root-level service password -- `-S|--post-start-network NETWORKS`: a comman-separated list of networks to attach the service container to after service start +- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start - `-s|--shm-size SHM_SIZE`: override shared memory size for redis docker container You can clone an existing service to a new one: diff --git a/Vagrantfile b/Vagrantfile index 4aec135..093340f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-20.04" +BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-22.04" BOX_MEMORY = ENV["BOX_MEMORY"] || "2048" DOKKU_VERSION = "master" diff --git a/bin/generate b/bin/generate index 89b9999..f4f14e7 100755 --- a/bin/generate +++ b/bin/generate @@ -1,15 +1,30 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function + import os import re -def compile(service, version, variable, alias, image, scheme, ports, sponsors, options, unimplemented, dokku_version): - prefix = "\n\n".join([ - header(service), - description(service, image, version), - ]) +def compile( + service, + version, + variable, + alias, + image, + scheme, + ports, + sponsors, + options, + unimplemented, + dokku_version, +): + prefix = "\n\n".join( + [ + header(service), + description(service, image, version), + ] + ) if len(sponsors) > 0: prefix += "\n\n" @@ -21,8 +36,19 @@ def compile(service, version, variable, alias, image, scheme, ports, sponsors, o prefix, requirements_section(dokku_version), installation_section(service, dokku_version), - commands_section(service, variable, alias, image, scheme, ports, unimplemented), - usage_section(service, variable, alias, image, scheme, ports, options, unimplemented), + commands_section( + service, variable, alias, image, scheme, ports, unimplemented + ), + usage_section( + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + ), ] ) .replace("\n\n\n\n\n", "\n") @@ -55,17 +81,25 @@ def sponsors_section(service, sponsors): if len(sponsors) == 0: return "" - sponsor_data = ["## Sponsors", "", f"The {service} plugin was generously sponsored by the following:", ""] + sponsor_data = [ + "## Sponsors", + "", + f"The {service} plugin was generously sponsored by the following:", + "", + ] sponsor_data.extend([f"- [{s}](https://github.com/{s})" for s in sponsors]) - return "\n".join( - sponsor_data - ) + return "\n".join(sponsor_data) def requirements_section(dokku_version): return "\n".join( - ["## Requirements", "", f"- dokku {dokku_version}", "- docker 1.8.x",] + [ + "## Requirements", + "", + f"- dokku {dokku_version}", + "- docker 1.8.x", + ] ) @@ -115,17 +149,31 @@ def commands_section(service, variable, alias, image, scheme, ports, unimplement return "\n".join(content) -def usage_section(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_section( + service, variable, alias, image, scheme, ports, options, unimplemented +): return "\n\n".join( [ "## Usage", f"Help for any commands can be displayed by specifying the command as an argument to {service}:help. Plugin help output in conjunction with any files in the `docs/` folder is used to generate the plugin documentation. Please consult the `{service}:help` command for any undocumented commands.", - usage_intro(service, variable, alias, image, scheme, ports, options, unimplemented), - usage_lifecycle(service, variable, alias, image, scheme, ports, options, unimplemented), - usage_automation(service, variable, alias, image, scheme, ports, options, unimplemented), - usage_data_management(service, variable, alias, image, scheme, ports, options, unimplemented), - usage_backup(service, variable, alias, image, scheme, ports, options, unimplemented), - usage_docker_pull(service, variable, alias, image, scheme, ports, options, unimplemented), + usage_intro( + service, variable, alias, image, scheme, ports, options, unimplemented + ), + usage_lifecycle( + service, variable, alias, image, scheme, ports, options, unimplemented + ), + usage_automation( + service, variable, alias, image, scheme, ports, options, unimplemented + ), + usage_data_management( + service, variable, alias, image, scheme, ports, options, unimplemented + ), + usage_backup( + service, variable, alias, image, scheme, ports, options, unimplemented + ), + usage_docker_pull( + service, variable, alias, image, scheme, ports, options, unimplemented + ), ] ) @@ -135,11 +183,22 @@ def usage_intro(service, variable, alias, image, scheme, ports, options, unimple content = ["### Basic Usage"] return fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ) -def usage_lifecycle(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_lifecycle( + service, variable, alias, image, scheme, ports, options, unimplemented +): commands = [ "connect", "enter", @@ -160,11 +219,22 @@ def usage_lifecycle(service, variable, alias, image, scheme, ports, options, uni ] return fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ) -def usage_automation(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_automation( + service, variable, alias, image, scheme, ports, options, unimplemented +): commands = ["app-links", "clone", "exists", "linked", "links"] content = [ "### Service Automation", @@ -174,11 +244,22 @@ def usage_automation(service, variable, alias, image, scheme, ports, options, un ] return fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ) -def usage_data_management(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_data_management( + service, variable, alias, image, scheme, ports, options, unimplemented +): commands = ["import", "export"] content = [ "### Data Management", @@ -188,11 +269,22 @@ def usage_data_management(service, variable, alias, image, scheme, ports, option ] return fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ) -def usage_backup(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_backup( + service, variable, alias, image, scheme, ports, options, unimplemented +): commands = [ "backup-auth", "backup-deauth", @@ -215,11 +307,22 @@ def usage_backup(service, variable, alias, image, scheme, ports, options, unimpl ] return fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ) -def usage_docker_pull(service, variable, alias, image, scheme, ports, options, unimplemented): +def usage_docker_pull( + service, variable, alias, image, scheme, ports, options, unimplemented +): service_prefix = service.upper() return "\n".join( [ @@ -233,11 +336,30 @@ def usage_docker_pull(service, variable, alias, image, scheme, ports, options, u def fetch_commands_content( - service, variable, alias, image, scheme, ports, options, unimplemented, commands, content + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + commands, + content, ): i = 0 for command in commands: - output = command_help(command, service, variable, alias, image, scheme, ports, options, unimplemented) + output = command_help( + command, + service, + variable, + alias, + image, + scheme, + ports, + options, + unimplemented, + ) if output == "": continue content.append(output) @@ -275,7 +397,9 @@ def parse_args(line): return " ".join(arguments) -def command_help(command, service, variable, alias, image, scheme, ports, options, unimplemented): +def command_help( + command, service, variable, alias, image, scheme, ports, options, unimplemented +): if command in unimplemented: return "" @@ -285,7 +409,7 @@ def command_help(command, service, variable, alias, image, scheme, ports, option "", "```shell", "# usage", - f"dokku {service}:{command} {data['arguments_string']}", + f"dokku {service}:{command} {data['arguments_string']}".strip(), "```", ] @@ -442,11 +566,11 @@ def process_sentence(sentence_lines): parts = [] for word in sentence.strip().split(" "): if word.isupper() and len(word) > 1: - for ending in [':', '.']: + for ending in [":", "."]: if word.endswith(ending): - word = '`{0}`{1}'.format(word[:-1], ending) + word = "`{0}`{1}".format(word[:-1], ending) else: - word = '`{0}`'.format(word) + word = "`{0}`".format(word) parts.append(word) text.append(" ".join(parts)) @@ -491,10 +615,10 @@ def main(): with open("Dockerfile") as f: for line in f.readlines(): - if "FROM " in line: - image, version = line.split(" ")[1].split(":") - image = image.strip() - version = version.strip() + if "FROM " in line: + image, version = line.split(" ")[1].split(":") + image = image.strip() + version = version.strip() with open("config") as f: for line in f.readlines(): @@ -524,10 +648,22 @@ def main(): with open("plugin.toml") as f: for line in f.readlines(): if line.startswith("sponsors"): - sponsors = re.search("\[([\"\w\s,_-]+)\]", line).group(1) - sponsors = [s.strip("\"") for s in sponsors.split(",")] + sponsors = re.search('\[(["\w\s,_-]+)\]', line).group(1) + sponsors = [s.strip('"') for s in sponsors.split(",")] - text = compile(service, version, variable, alias, image, scheme, ports, sponsors, options, unimplemented, "0.19.x+") + text = compile( + service, + version, + variable, + alias, + image, + scheme, + ports, + sponsors, + options, + unimplemented, + "0.19.x+", + ) base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) readme_file = os.path.join(base_path, "README.md") diff --git a/plugin.toml b/plugin.toml index a48bf43..401fd1c 100644 --- a/plugin.toml +++ b/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku redis service plugin" -version = "1.35.0" +version = "1.37.2" [plugin.config] diff --git a/subcommands/clone b/subcommands/clone index eb10519..b9d99a3 100755 --- a/subcommands/clone +++ b/subcommands/clone @@ -17,9 +17,9 @@ service-clone-cmd() { #F -m|--memory MEMORY, container memory limit in megabytes (default: unlimited) #F -N|--initial-network INITIAL_NETWORK, the initial network to attach the service to #F -p|--password PASSWORD, override the user-level service password - #F -P|--post-create-network NETWORKS, a comman-separated list of networks to attach the service container to after service creation + #F -P|--post-create-network NETWORKS, a comma-separated list of networks to attach the service container to after service creation #F -r|--root-password PASSWORD, override the root-level service password - #F -S|--post-start-network NETWORKS, a comman-separated list of networks to attach the service container to after service start + #F -S|--post-start-network NETWORKS, a comma-separated list of networks to attach the service container to after service start #F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container declare desc="create container then copy data from into " local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@") diff --git a/subcommands/create b/subcommands/create index 87135e5..7112f18 100755 --- a/subcommands/create +++ b/subcommands/create @@ -14,7 +14,7 @@ service-create-cmd() { #E export ${PLUGIN_VARIABLE}_IMAGE_VERSION="${PLUGIN_IMAGE_VERSION}" #E dokku $PLUGIN_COMMAND_PREFIX:create lollipop #E you can also specify custom environment variables to start - #E the ${PLUGIN_COMMAND_PREFIX} service in semi-colon separated form. + #E the ${PLUGIN_COMMAND_PREFIX} service in semicolon-separated form. #E export ${PLUGIN_VARIABLE}_CUSTOM_ENV="USER=alpha;HOST=beta" #E dokku $PLUGIN_COMMAND_PREFIX:create lollipop #A service, service to run command against @@ -25,9 +25,9 @@ service-create-cmd() { #F -m|--memory MEMORY, container memory limit in megabytes (default: unlimited) #F -N|--initial-network INITIAL_NETWORK, the initial network to attach the service to #F -p|--password PASSWORD, override the user-level service password - #F -P|--post-create-network NETWORKS, a comman-separated list of networks to attach the service container to after service creation + #F -P|--post-create-network NETWORKS, a comma-separated list of networks to attach the service container to after service creation #F -r|--root-password PASSWORD, override the root-level service password - #F -S|--post-start-network NETWORKS, a comman-separated list of networks to attach the service container to after service start + #F -S|--post-start-network NETWORKS, a comma-separated list of networks to attach the service container to after service start #F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container declare desc="create a $PLUGIN_SERVICE service" local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@") diff --git a/subcommands/upgrade b/subcommands/upgrade index 93352c1..3eeccde 100755 --- a/subcommands/upgrade +++ b/subcommands/upgrade @@ -15,9 +15,9 @@ service-upgrade-cmd() { #F -i|--image IMAGE, the image name to start the service with #F -I|--image-version IMAGE_VERSION, the image version to start the service with #F -N|--initial-network INITIAL_NETWORK, the initial network to attach the service to - #F -P|--post-create-network NETWORKS, a comman-separated list of networks to attach the service container to after service creation + #F -P|--post-create-network NETWORKS, a comma-separated list of networks to attach the service container to after service creation #F -R|--restart-apps "true", whether or not to force an app restart (default: false) - #F -S|--post-start-network NETWORKS, a comman-separated list of networks to attach the service container to after service start + #F -S|--post-start-network NETWORKS, a comma-separated list of networks to attach the service container to after service start #F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container declare desc="upgrade service to the specified versions" local cmd="$PLUGIN_COMMAND_PREFIX:upgrade" argv=("$@")