Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0334a62202 | ||
|
|
2c2c003a96 | ||
|
|
8699bd9c45 | ||
|
|
25ab99a4e2 | ||
|
|
a182961848 | ||
|
|
409cfc06c0 | ||
|
|
754f87ba99 | ||
|
|
cc7478c656 | ||
|
|
a03a6d996a | ||
|
|
c18722af2b | ||
|
|
4d6536b924 | ||
|
|
b2dab2649e | ||
|
|
6582f0c633 | ||
|
|
b794db26f8 | ||
|
|
e9512ae4d5 | ||
|
|
76d535358b | ||
|
|
b58b3ebce7 | ||
|
|
f7a2e6c866 | ||
|
|
c2774ac51f | ||
|
|
28b28e51f4 | ||
|
|
ad13120ef9 | ||
|
|
ec45752306 | ||
|
|
63535f934d | ||
|
|
0be882b8a4 | ||
|
|
0769fd1fd3 | ||
|
|
ab1e14b986 | ||
|
|
5aea44f11c | ||
|
|
832a8045d5 | ||
|
|
d25e6e6483 | ||
|
|
f309f16c7b | ||
|
|
1a0f6815ca | ||
|
|
76cfd9a091 | ||
|
|
4e808c6ff9 | ||
|
|
9974da1abe | ||
|
|
e414eaccec | ||
|
|
6f1ad4c20e | ||
|
|
b7030307ef | ||
|
|
9ab0660b14 | ||
|
|
56f688e8aa |
@@ -1,60 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
commands:
|
||||
build:
|
||||
description: "run the build"
|
||||
parameters:
|
||||
python_version:
|
||||
type: string
|
||||
default: "3.7.0"
|
||||
steps:
|
||||
- checkout
|
||||
- run: pyenv global << parameters.python_version >>
|
||||
- run: make setup
|
||||
- run: sudo sysctl -w vm.max_map_count=262144
|
||||
- run:
|
||||
command: |
|
||||
make generate
|
||||
if ! git diff --quiet README.md; then
|
||||
echo "Please run `make generate`"
|
||||
git status --short
|
||||
git --no-pager diff README.md
|
||||
exit 1
|
||||
fi
|
||||
- run: make test
|
||||
- store_artifacts:
|
||||
path: build
|
||||
destination: build
|
||||
- store_artifacts:
|
||||
path: tmp/test-results
|
||||
destination: test-results
|
||||
- store_test_results:
|
||||
path: tmp/test-results
|
||||
|
||||
executors:
|
||||
machine:
|
||||
machine:
|
||||
docker_layer_caching: false
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
jobs:
|
||||
build-master:
|
||||
environment:
|
||||
DOKKU_VERSION: master
|
||||
executor: machine
|
||||
steps:
|
||||
- build
|
||||
|
||||
build-version:
|
||||
environment:
|
||||
DOKKU_VERSION: v0.19.0
|
||||
executor: machine
|
||||
steps:
|
||||
- build
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- "build-master"
|
||||
- "build-version"
|
||||
24
.devcontainer/20_init_plugin
Executable file
24
.devcontainer/20_init_plugin
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
log-info() {
|
||||
declare desc="Log info formatter"
|
||||
echo " $*" 1>&2
|
||||
}
|
||||
|
||||
log-fail() {
|
||||
declare desc="Log fail formatter"
|
||||
echo "! $*" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
main() {
|
||||
dokku plugin:install
|
||||
|
||||
# built in the Dockerfile
|
||||
PLUGIN_NAME="$(source /tmp/.env && echo "$PLUGIN_NAME")"
|
||||
PLUGIN_VARIABLE="$(source /tmp/.env && echo "$PLUGIN_VARIABLE")"
|
||||
echo "export ${PLUGIN_VARIABLE}_HOST_ROOT=${SERVICE_HOST_ROOT}/$PLUGIN_NAME" > /etc/default/dokku
|
||||
}
|
||||
|
||||
main "$@"
|
||||
26
.devcontainer/Dockerfile
Normal file
26
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
FROM dokku/dokku:latest
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install --no-install-recommends -y build-essential && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove --yes && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
mkdir -p /mnt/dokku/home/dokku /mnt/dokku/var/lib/dokku/config /mnt/dokku/var/lib/dokku/data /mnt/dokku/var/lib/dokku/services && \
|
||||
chown -R dokku:dokku /mnt/dokku/home/dokku /mnt/dokku/var/lib/dokku/config /mnt/dokku/var/lib/dokku/data /mnt/dokku/var/lib/dokku/services && \
|
||||
echo "dokku.me" > /home/dokku/VHOST
|
||||
|
||||
ADD https://raw.githubusercontent.com/dokku/dokku/master/tests/dhparam.pem /mnt/dokku/etc/nginx/dhparam.pem
|
||||
|
||||
COPY .devcontainer/20_init_plugin /etc/my_init.d/20_init_plugin
|
||||
COPY .devcontainer/bin/ /usr/local/bin/
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN source /tmp/config && \
|
||||
echo "export ${PLUGIN_DISABLE_PULL_VARIABLE}=true" > /tmp/.env && \
|
||||
echo "export PLUGIN_NAME=${PLUGIN_COMMAND_PREFIX}" >> /tmp/.env && \
|
||||
echo "export PLUGIN_VARIABLE=${PLUGIN_VARIABLE}" >> /tmp/.env
|
||||
|
||||
RUN source /tmp/.env && \
|
||||
dokku plugin:install file:///tmp --name $PLUGIN_NAME && \
|
||||
make ci-dependencies
|
||||
8
.devcontainer/bin/copy-file
Executable file
8
.devcontainer/bin/copy-file
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main() {
|
||||
PLUGIN_NAME="$(source /tmp/.env && echo "$PLUGIN_NAME")"
|
||||
cp "$1" "/var/lib/dokku/plugins/enabled/$PLUGIN_NAME/$1"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"context": ".."
|
||||
},
|
||||
"containerEnv": {
|
||||
"SERVICE_HOST_ROOT": "${localWorkspaceFolder}/tmp/data"
|
||||
},
|
||||
"initializeCommand": ["mkdir", "-p", "tmp/data"],
|
||||
"mounts": [
|
||||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
|
||||
"source=${localWorkspaceFolder}/tmp/data/,target=/var/lib/dokku/services/,type=bind"
|
||||
],
|
||||
"overrideCommand": false,
|
||||
"runArgs": ["--init"]
|
||||
}
|
||||
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
100
.github/workflows/ci.yml
vendored
Normal file
100
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
name: CI
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
unit-tests-master:
|
||||
name: unit-tests
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
env:
|
||||
DOKKU_VERSION: master
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7.x'
|
||||
|
||||
- run: make setup
|
||||
|
||||
- run: sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
- run: |
|
||||
git fetch -q origin master
|
||||
changed=$(git --no-pager diff --name-only $GITHUB_SHA..origin/master)
|
||||
if [ $changed = "Dockerfile" ]; then
|
||||
echo "Please run 'make generate' to update the image version in the README.md"
|
||||
else
|
||||
make generate
|
||||
if ! git diff --quiet README.md; then
|
||||
echo "Please run 'make generate'"
|
||||
git status --short
|
||||
git --no-pager diff README.md
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
- run: make test
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: tmp/test-results
|
||||
path: test-results
|
||||
|
||||
unit-tests-0_19_0:
|
||||
name: unit-tests-0.19.0
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
env:
|
||||
DOKKU_TAG: v0.19.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7.x'
|
||||
|
||||
- run: make setup
|
||||
|
||||
- run: sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
- run: |
|
||||
git fetch -q origin master
|
||||
changed=$(git --no-pager diff --name-only $GITHUB_SHA..origin/master)
|
||||
if [ $changed = "Dockerfile" ]; then
|
||||
echo "Please run 'make generate' to update the image version in the README.md"
|
||||
else
|
||||
make generate
|
||||
if ! git diff --quiet README.md; then
|
||||
echo "Please run 'make generate'"
|
||||
git status --short
|
||||
git --no-pager diff README.md
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
- run: make test
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: tmp/test-results
|
||||
path: test-results
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/tmp
|
||||
.vagrant
|
||||
bootstrap.sh
|
||||
|
||||
1
Dockerfile
Normal file
1
Dockerfile
Normal file
@@ -0,0 +1 @@
|
||||
FROM postgres:13.4
|
||||
19
Makefile
19
Makefile
@@ -11,7 +11,7 @@ ifneq ($(shell bats --version >/dev/null 2>&1 ; echo $$?),0)
|
||||
brew install bats-core
|
||||
endif
|
||||
else
|
||||
git clone https://github.com/josegonzalez/bats-core.git /tmp/bats
|
||||
git clone https://github.com/bats-core/bats-core.git /tmp/bats
|
||||
cd /tmp/bats && sudo ./install.sh /usr/local
|
||||
rm -rf /tmp/bats
|
||||
endif
|
||||
@@ -63,7 +63,7 @@ unit-tests:
|
||||
@echo running unit tests...
|
||||
@mkdir -p tmp/test-results/bats
|
||||
@cd tests && echo "executing tests: $(shell cd tests ; ls *.bats | xargs)"
|
||||
cd tests && bats --formatter bats-format-junit -e -T -o ../tmp/test-results/bats *.bats
|
||||
cd tests && bats --report-formatter junit --timing -o ../tmp/test-results/bats *.bats
|
||||
|
||||
tmp/xunit-reader:
|
||||
mkdir -p tmp
|
||||
@@ -71,28 +71,15 @@ tmp/xunit-reader:
|
||||
tar xf tmp/xunit-reader.tgz -C tmp
|
||||
chmod +x tmp/xunit-reader
|
||||
|
||||
tmp/xunit-to-github:
|
||||
mkdir -p tmp
|
||||
curl -o tmp/xunit-to-github.tgz -sL https://github.com/josegonzalez/go-xunit-to-github/releases/download/v$(XUNIT_TO_GITHUB_VERSION)/xunit-to-github_$(XUNIT_TO_GITHUB_VERSION)_$(SYSTEM_NAME)_$(HARDWARE).tgz
|
||||
tar xf tmp/xunit-to-github.tgz -C tmp
|
||||
chmod +x tmp/xunit-to-github
|
||||
|
||||
setup:
|
||||
bash tests/setup.sh
|
||||
$(MAKE) ci-dependencies
|
||||
|
||||
test: lint unit-tests
|
||||
|
||||
report: tmp/xunit-reader tmp/xunit-to-github
|
||||
report: tmp/xunit-reader
|
||||
tmp/xunit-reader -p 'tmp/test-results/bats/*.xml'
|
||||
tmp/xunit-reader -p 'tmp/test-results/shellcheck/*.xml'
|
||||
ifdef TRAVIS_REPO_SLUG
|
||||
ifdef GITHUB_ACCESS_TOKEN
|
||||
ifneq ($(TRAVIS_PULL_REQUEST),false)
|
||||
tmp/xunit-to-github --skip-ok --job-url "$(TRAVIS_JOB_WEB_URL)" --pull-request-id "$(TRAVIS_PULL_REQUEST)" --repository-slug "$(TRAVIS_REPO_SLUG)" --title "DOKKU_VERSION=$(DOKKU_VERSION)" tmp/test-results/bats tmp/test-results/shellcheck
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# dokku postgres [](https://circleci.com/gh/dokku/dokku-postgres/tree/master) [](https://webchat.freenode.net/?channels=dokku)
|
||||
# dokku postgres [](https://github.com/dokku/dokku-postgres/actions/workflows/ci.yml?query=branch%3Amaster) [](https://webchat.libera.chat/?channels=dokku)
|
||||
|
||||
Official postgres plugin for dokku. Currently defaults to installing [postgres 11.6](https://hub.docker.com/_/postgres/).
|
||||
Official postgres plugin for dokku. Currently defaults to installing [postgres 13.4](https://hub.docker.com/_/postgres/).
|
||||
|
||||
## Requirements
|
||||
|
||||
- dokku 0.12.x+
|
||||
- dokku 0.19.x+
|
||||
- docker 1.8.x
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
# on 0.12.x+
|
||||
# on 0.19.x+
|
||||
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
|
||||
```
|
||||
|
||||
|
||||
63
bin/generate
63
bin/generate
@@ -5,12 +5,20 @@ import os
|
||||
import re
|
||||
|
||||
|
||||
def compile(service, version, variable, alias, image, scheme, ports, unimplemented, dokku_version):
|
||||
def compile(service, version, variable, alias, image, scheme, ports, sponsors, unimplemented, dokku_version):
|
||||
prefix = "\n\n".join([
|
||||
header(service),
|
||||
description(service, image, version),
|
||||
])
|
||||
|
||||
if len(sponsors) > 0:
|
||||
prefix += "\n\n"
|
||||
prefix += sponsors_section(service, sponsors)
|
||||
|
||||
return (
|
||||
"\n\n".join(
|
||||
[
|
||||
header(service),
|
||||
description(service, version),
|
||||
prefix,
|
||||
requirements_section(dokku_version),
|
||||
installation_section(service, dokku_version),
|
||||
commands_section(service, variable, alias, image, scheme, ports, unimplemented),
|
||||
@@ -27,14 +35,32 @@ def header(service):
|
||||
return " ".join(
|
||||
[
|
||||
f"# dokku {service}",
|
||||
f'[](https://circleci.com/gh/dokku/dokku-{service}/tree/master)',
|
||||
f'[](https://webchat.freenode.net/?channels=dokku)',
|
||||
f'[](https://github.com/dokku/dokku-{service}/actions/workflows/ci.yml?query=branch%3Amaster)',
|
||||
f'[](https://webchat.libera.chat/?channels=dokku)',
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def description(service, version):
|
||||
return f"Official {service} plugin for dokku. Currently defaults to installing [{service} {version}](https://hub.docker.com/_/{service}/)."
|
||||
def description(service, full_image, version):
|
||||
base = "_"
|
||||
image = full_image
|
||||
if "/" in full_image:
|
||||
base = "r/" + full_image.split("/")[0]
|
||||
image = full_image.split("/")[1]
|
||||
|
||||
return f"Official {service} plugin for dokku. Currently defaults to installing [{full_image} {version}](https://hub.docker.com/{base}/{image}/)."
|
||||
|
||||
|
||||
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.extend([f"- [{s}](https://github.com/{s})" for s in sponsors])
|
||||
|
||||
return "\n".join(
|
||||
sponsor_data
|
||||
)
|
||||
|
||||
|
||||
def requirements_section(dokku_version):
|
||||
@@ -448,12 +474,16 @@ def main():
|
||||
image = None
|
||||
alias = None
|
||||
unimplemented = []
|
||||
|
||||
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()
|
||||
|
||||
with open("config") as f:
|
||||
for line in f.readlines():
|
||||
if "IMAGE_VERSION=${" in line:
|
||||
version = re.search('"(.+)"', line).group(1)
|
||||
if "_IMAGE=${" in line:
|
||||
image = re.search('"(.+)"', line).group(1)
|
||||
if "PLUGIN_COMMAND_PREFIX=" in line:
|
||||
service = re.search('"(.+)"', line).group(1)
|
||||
if "PLUGIN_DEFAULT_ALIAS=" in line:
|
||||
@@ -469,12 +499,19 @@ def main():
|
||||
if match is not None:
|
||||
unimplemented = [s.strip('"') for s in match.group(1).split(" ")]
|
||||
|
||||
text = compile(service, version, variable, alias, image, scheme, ports, unimplemented, "0.12.x+")
|
||||
sponsors = []
|
||||
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(",")]
|
||||
|
||||
text = compile(service, version, variable, alias, image, scheme, ports, sponsors, 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")
|
||||
with open(readme_file, "w") as f:
|
||||
f.write(text)
|
||||
f.write(text + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -120,7 +120,7 @@ retry-docker-command() {
|
||||
local i=0 success=false
|
||||
until [ $i -ge 100 ]; do
|
||||
set +e
|
||||
docker exec -it "$ID" sh -c "$COMMAND" 2>/dev/null
|
||||
suppress_output docker exec "$ID" sh -c "$COMMAND"
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" == 0 ]]; then
|
||||
@@ -188,18 +188,18 @@ service_backup() {
|
||||
dokku_log_fail "Provide AWS credentials or use the --use-iam flag"
|
||||
fi
|
||||
|
||||
TMPDIR=$(mktemp -d --tmpdir)
|
||||
trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
||||
BACKUP_TMPDIR=$(mktemp -d --tmpdir)
|
||||
trap 'rm -rf "$BACKUP_TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
docker inspect "$ID" &>/dev/null || dokku_log_fail "Service container does not exist"
|
||||
is_container_status "$ID" "Running" || dokku_log_fail "Service container is not running"
|
||||
|
||||
(service_export "$SERVICE" >"${TMPDIR}/export")
|
||||
(service_export "$SERVICE" >"${BACKUP_TMPDIR}/export")
|
||||
|
||||
# Build parameter list for s3backup tool
|
||||
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e BUCKET_NAME=$BUCKET_NAME"
|
||||
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e BACKUP_NAME=${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
|
||||
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -v ${TMPDIR}:/backup"
|
||||
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -v ${BACKUP_TMPDIR}:/backup"
|
||||
|
||||
if [[ -f "$SERVICE_BACKUP_ROOT/AWS_DEFAULT_REGION" ]]; then
|
||||
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_DEFAULT_REGION=$(cat "$SERVICE_BACKUP_ROOT/AWS_DEFAULT_REGION")"
|
||||
@@ -383,7 +383,7 @@ service_info() {
|
||||
local flag key valid_flags
|
||||
|
||||
local flag_map=(
|
||||
"--config-dir: ${SERVICE_ROOT}/config"
|
||||
"--config-dir: ${SERVICE_ROOT}/${PLUGIN_CONFIG_SUFFIX}"
|
||||
"--data-dir: ${SERVICE_ROOT}/data"
|
||||
"--dsn: ${SERVICE_URL}"
|
||||
"--exposed-ports: $(service_exposed_ports "$SERVICE")"
|
||||
@@ -453,6 +453,7 @@ service_link() {
|
||||
fi
|
||||
|
||||
[[ -n $LINK ]] && dokku_log_fail "Already linked as $LINK"
|
||||
plugn trigger service-action pre-link "$SERVICE" "$APP"
|
||||
touch "$LINKS_FILE"
|
||||
echo "$APP" >>"$LINKS_FILE"
|
||||
sort "$LINKS_FILE" -u -o "$LINKS_FILE"
|
||||
@@ -465,7 +466,9 @@ service_link() {
|
||||
dokku docker-options:add "$APP" build,deploy,run "--link $SERVICE_NAME:$SERVICE_DNS_HOSTNAME"
|
||||
fi
|
||||
[[ -n "$SERVICE_QUERYSTRING" ]] && SERVICE_URL="${SERVICE_URL}?${SERVICE_QUERYSTRING}"
|
||||
plugn trigger service-action post-link "$SERVICE" "$APP"
|
||||
config_set "$APP" "${ALIAS}_URL=$SERVICE_URL"
|
||||
plugn trigger service-action post-link-complete "$SERVICE" "$APP"
|
||||
}
|
||||
|
||||
service_linked_apps() {
|
||||
@@ -771,6 +774,7 @@ service_unlink() {
|
||||
local SERVICE_DNS_HOSTNAME=$(service_dns_hostname "$SERVICE")
|
||||
local LINK=($(echo "$EXISTING_CONFIG" | grep "$SERVICE_URL" | cut -d: -f1)) || true
|
||||
|
||||
plugn trigger service-action pre-unlink "$SERVICE" "$APP"
|
||||
remove_from_links_file "$SERVICE" "$APP"
|
||||
|
||||
if declare -f -F add_passed_docker_option >/dev/null; then
|
||||
@@ -782,7 +786,9 @@ service_unlink() {
|
||||
fi
|
||||
|
||||
[[ -z ${LINK[*]} ]] && dokku_log_fail "Not linked to app $APP"
|
||||
plugn trigger service-action post-unlink "$SERVICE" "$APP"
|
||||
config_unset "$APP" "${LINK[*]}"
|
||||
plugn trigger service-action post-unlink-complete "$SERVICE" "$APP"
|
||||
}
|
||||
|
||||
service_version() {
|
||||
|
||||
6
config
6
config
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
export POSTGRES_IMAGE=${POSTGRES_IMAGE:="postgres"}
|
||||
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="11.6"}
|
||||
_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export POSTGRES_IMAGE=${POSTGRES_IMAGE:="$(awk -F '[ :]' '{print $2}' "${_DIR}/Dockerfile")"}
|
||||
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="$(awk -F '[ :]' '{print $3}' "${_DIR}/Dockerfile")"}
|
||||
export POSTGRES_ROOT=${POSTGRES_ROOT:="$DOKKU_LIB_ROOT/services/postgres"}
|
||||
export POSTGRES_HOST_ROOT=${POSTGRES_HOST_ROOT:=$POSTGRES_ROOT}
|
||||
|
||||
@@ -21,6 +22,7 @@ export PLUGIN_SCHEME="postgres"
|
||||
export PLUGIN_SERVICE="Postgres"
|
||||
export PLUGIN_VARIABLE="POSTGRES"
|
||||
export PLUGIN_BASE_PATH="$PLUGIN_PATH"
|
||||
export PLUGIN_CONFIG_SUFFIX="data"
|
||||
if [[ -n $DOKKU_API_VERSION ]]; then
|
||||
export PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH"
|
||||
fi
|
||||
|
||||
@@ -40,6 +40,7 @@ service_create() {
|
||||
docker pull "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" || dokku_log_fail "$PLUGIN_SERVICE image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION pull failed"
|
||||
fi
|
||||
|
||||
plugn trigger service-action pre-create "$SERVICE"
|
||||
mkdir -p "$SERVICE_ROOT" || dokku_log_fail "Unable to create service directory"
|
||||
mkdir -p "$SERVICE_ROOT/data" || dokku_log_fail "Unable to create service data directory"
|
||||
touch "$LINKS_FILE"
|
||||
@@ -60,7 +61,9 @@ service_create() {
|
||||
fi
|
||||
|
||||
write_database_name "$SERVICE"
|
||||
plugn trigger service-action post-create "$SERVICE"
|
||||
service_create_container "$SERVICE"
|
||||
plugn trigger service-action post-create-complete "$SERVICE"
|
||||
}
|
||||
|
||||
service_create_container() {
|
||||
@@ -146,9 +149,13 @@ service_start() {
|
||||
dokku_log_info2 "Container started"
|
||||
elif service_image_exists "$SERVICE" && [[ -n "$PASSWORD" ]]; then
|
||||
service_create_container "$SERVICE"
|
||||
else
|
||||
if ! service_image_exists "$SERVICE"; then
|
||||
dokku_log_verbose_quiet "Missing image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION for $SERVICE"
|
||||
else
|
||||
dokku_log_verbose_quiet "Neither container nor valid configuration exists for $SERVICE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
service_url() {
|
||||
|
||||
@@ -76,10 +76,10 @@ fn-help-contents() {
|
||||
|
||||
fn-help-contents-subcommand() {
|
||||
declare SUBCOMMAND="$1" FULL_OUTPUT="$2"
|
||||
local TMPDIR=$(mktemp -d --tmpdir)
|
||||
local UNCLEAN_FILE="${TMPDIR}/cmd-unclean" CLEAN_FILE="${TMPDIR}/cmd-clean"
|
||||
local HELP_TMPDIR=$(mktemp -d --tmpdir)
|
||||
local UNCLEAN_FILE="${HELP_TMPDIR}/cmd-unclean" CLEAN_FILE="${HELP_TMPDIR}/cmd-clean"
|
||||
local BOLD CMD_OUTPUT CYAN EXAMPLE LIGHT_GRAY NORMAL
|
||||
trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
||||
trap 'rm -rf "$HELP_TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
rm -rf "$UNCLEAN_FILE" "$CLEAN_FILE"
|
||||
cat "$SUBCOMMAND_ROOT/$SUBCOMMAND" >"$UNCLEAN_FILE"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku postgres service plugin"
|
||||
version = "1.11.5"
|
||||
version = "1.13.0"
|
||||
[plugin.config]
|
||||
|
||||
@@ -41,13 +41,15 @@ service-destroy-cmd() {
|
||||
fi
|
||||
|
||||
dokku_log_info2_quiet "Deleting $SERVICE"
|
||||
plugn trigger service-action pre-delete "$SERVICE"
|
||||
service_backup_unschedule "$SERVICE"
|
||||
service_container_rm "$SERVICE"
|
||||
|
||||
dokku_log_verbose_quiet "Removing data"
|
||||
docker run --rm -v "$SERVICE_HOST_ROOT/data:/data" -v "$SERVICE_HOST_ROOT/config:/config" "$PLUGIN_BUSYBOX_IMAGE" chmod 777 -R /config /data
|
||||
docker run --rm -v "$SERVICE_HOST_ROOT/data:/data" -v "$SERVICE_HOST_ROOT/$PLUGIN_CONFIG_SUFFIX:/config" "$PLUGIN_BUSYBOX_IMAGE" chmod 777 -R /config /data
|
||||
rm -rf "$SERVICE_ROOT"
|
||||
|
||||
plugn trigger service-action post-delete "$SERVICE"
|
||||
dokku_log_info2 "$PLUGIN_SERVICE container deleted: $SERVICE"
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
dokku apps:create my_app
|
||||
dokku apps:create my-app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app >&2
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app >&2
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:hook:pre-delete) removes app from links file when destroying app" {
|
||||
[[ -n $(< "$PLUGIN_DATA_ROOT/l/LINKS") ]]
|
||||
dokku --force apps:destroy my_app
|
||||
dokku --force apps:destroy my-app
|
||||
[[ -z $(< "$PLUGIN_DATA_ROOT/l/LINKS") ]]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:export) success with SSH_TTY" {
|
||||
if [[ -n "$GITHUB_WORKFLOW" ]]; then
|
||||
skip "No tty is available on Github Actions"
|
||||
fi
|
||||
export SSH_TTY=`tty`
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
|
||||
echo "output: $output"
|
||||
|
||||
@@ -24,6 +24,9 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:import) error when data is not provided" {
|
||||
if [[ -n "$GITHUB_WORKFLOW" ]]; then
|
||||
skip "No tty is available on Github Actions"
|
||||
fi
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:import" l
|
||||
assert_contains "${lines[*]}" "No data provided on stdin"
|
||||
assert_failure
|
||||
|
||||
@@ -4,13 +4,13 @@ load test_helper
|
||||
setup() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" m
|
||||
dokku apps:create my_app
|
||||
dokku apps:create my-app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" m
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
dokku --force apps:destroy my_app
|
||||
dokku --force apps:destroy my-app
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) error when the service does not exist" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" not_existing_service my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" not_existing_service my-app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_contains "${lines[*]}" "service not_existing_service does not exist"
|
||||
@@ -47,73 +47,73 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) error when the service is already linked to app" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_contains "${lines[*]}" "Already linked as DATABASE_URL"
|
||||
assert_failure
|
||||
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) exports DATABASE_URL to app" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
url=$(dokku config:get my_app DATABASE_URL)
|
||||
url=$(dokku config:get my-app DATABASE_URL)
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_contains "$url" "postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) generates an alternate config url when DATABASE_URL already in use" {
|
||||
dokku config:set my_app DATABASE_URL=postgres://user:pass@host:5432/db
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku config my_app
|
||||
dokku config:set my-app DATABASE_URL=postgres://user:pass@host:5432/db
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
run dokku config my-app
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_AQUA_URL"
|
||||
assert_success
|
||||
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" m my_app
|
||||
run dokku config my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" m my-app
|
||||
run dokku config my-app
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_BLACK_URL"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" m my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" m my-app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) links to app with docker-options" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku docker-options:report my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
run dokku docker-options:report my-app
|
||||
assert_contains "${lines[*]}" "--link dokku.postgres.l:dokku-postgres-l"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) uses apps POSTGRES_DATABASE_SCHEME variable" {
|
||||
dokku config:set my_app POSTGRES_DATABASE_SCHEME=postgres2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
url=$(dokku config:get my_app DATABASE_URL)
|
||||
dokku config:set my-app POSTGRES_DATABASE_SCHEME=postgres2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
url=$(dokku config:get my-app DATABASE_URL)
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_contains "$url" "postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) adds a querystring" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app --querystring "pool=5"
|
||||
url=$(dokku config:get my_app DATABASE_URL)
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app --querystring "pool=5"
|
||||
url=$(dokku config:get my-app DATABASE_URL)
|
||||
assert_contains "$url" "?pool=5"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) uses a specified config url when alias is specified" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app --alias "ALIAS"
|
||||
url=$(dokku config:get my_app ALIAS_URL)
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app --alias "ALIAS"
|
||||
url=$(dokku config:get my-app ALIAS_URL)
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_contains "$url" "postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ load test_helper
|
||||
|
||||
setup() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
||||
dokku apps:create my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
dokku apps:create my-app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
dokku --force apps:destroy my_app
|
||||
dokku --force apps:destroy my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) error when there are no arguments" {
|
||||
@@ -29,34 +29,34 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) error when the service does not exist" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:promote" not_existing_service my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:promote" not_existing_service my-app
|
||||
assert_contains "${lines[*]}" "service not_existing_service does not exist"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) error when the service is already promoted" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:promote" l my-app
|
||||
assert_contains "${lines[*]}" "already promoted as DATABASE_URL"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) changes DATABASE_URL" {
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
dokku config:set my_app "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
|
||||
url=$(dokku config:get my_app DATABASE_URL)
|
||||
dokku config:set my-app "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my-app
|
||||
url=$(dokku config:get my-app DATABASE_URL)
|
||||
assert_equal "$url" "postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) creates new config url when needed" {
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
dokku config:set my_app "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
|
||||
run dokku config my_app
|
||||
dokku config:set my-app "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my-app
|
||||
run dokku config my-app
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_"
|
||||
}
|
||||
@test "($PLUGIN_COMMAND_PREFIX:promote) uses POSTGRES_DATABASE_SCHEME variable" {
|
||||
password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
dokku config:set my_app "POSTGRES_DATABASE_SCHEME=postgres2" "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
|
||||
url=$(dokku config:get my_app DATABASE_URL)
|
||||
dokku config:set my-app "POSTGRES_DATABASE_SCHEME=postgres2" "DATABASE_URL=postgres://u:p@host:5432/db" "DOKKU_POSTGRES_BLUE_URL=postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my-app
|
||||
url=$(dokku config:get my-app DATABASE_URL)
|
||||
assert_contains "$url" "postgres2://postgres:$password@dokku-postgres-l:5432/l"
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
dokku apps:create my_app
|
||||
dokku apps:create my-app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
dokku --force apps:destroy my_app
|
||||
dokku --force apps:destroy my-app
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when there are no arguments" {
|
||||
@@ -27,27 +27,27 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when the service does not exist" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" not_existing_service my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" not_existing_service my-app
|
||||
assert_contains "${lines[*]}" "service not_existing_service does not exist"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when service not linked to app" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
assert_contains "${lines[*]}" "Not linked to app my_app"
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
assert_contains "${lines[*]}" "Not linked to app my-app"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:unlink) removes link from docker-options" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
|
||||
check_value="Docker options build: Docker options deploy: --restart=on-failure:10 Docker options run:"
|
||||
options=$(dokku --quiet docker-options:report my_app | xargs)
|
||||
options=$(dokku --quiet docker-options:report my-app | xargs)
|
||||
assert_equal "$options" "$check_value"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:unlink) unsets config url from app" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
config=$(dokku config:get my_app DATABASE_URL || true)
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my-app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my-app
|
||||
config=$(dokku config:get my-app DATABASE_URL || true)
|
||||
assert_equal "$config" ""
|
||||
}
|
||||
|
||||
@@ -19,12 +19,15 @@ echo "Dokku version $DOKKU_VERSION"
|
||||
|
||||
export DOKKU_LIB_ROOT="/var/lib/dokku"
|
||||
export DOKKU_PLUGINS_ROOT="$DOKKU_LIB_ROOT/plugins/available"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
pushd "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" >/dev/null
|
||||
source "config"
|
||||
popd >/dev/null
|
||||
sudo rm -rf "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX"
|
||||
sudo mkdir -p "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX" "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/subcommands" "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/scripts"
|
||||
sudo mkdir -p "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX" "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/subcommands" "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/scripts" "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/templates"
|
||||
sudo find ./ -maxdepth 1 -type f -exec cp '{}' "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX" \;
|
||||
[[ -d "./scripts" ]] && sudo find ./scripts -maxdepth 1 -type f -exec cp '{}' "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/scripts" \;
|
||||
[[ -d "./subcommands" ]] && sudo find ./subcommands -maxdepth 1 -type f -exec cp '{}' "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/subcommands" \;
|
||||
[[ -d "./templates" ]] && sudo find ./templates -maxdepth 1 -type f -exec cp '{}' "$DOKKU_PLUGINS_ROOT/$PLUGIN_COMMAND_PREFIX/templates" \;
|
||||
sudo mkdir -p "$PLUGIN_CONFIG_ROOT" "$PLUGIN_DATA_ROOT"
|
||||
sudo dokku plugin:enable "$PLUGIN_COMMAND_PREFIX"
|
||||
sudo dokku plugin:install
|
||||
|
||||
Reference in New Issue
Block a user