Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f187bf6ff | ||
|
|
fe950d727e | ||
|
|
b576967efa | ||
|
|
b5cb24fc6c | ||
|
|
aa1d1757a6 | ||
|
|
c11f1658e3 | ||
|
|
e2311100dd | ||
|
|
f28a340403 | ||
|
|
6dff5dc994 | ||
|
|
7b6c259ff2 | ||
|
|
b6394a8a33 | ||
|
|
dbb6dfdf0d | ||
|
|
81b78bd7a0 | ||
|
|
94c05b115b | ||
|
|
a7a900557e | ||
|
|
6b5356a646 | ||
|
|
9b33948f94 | ||
|
|
bb7a6cc03d | ||
|
|
2c5d67b094 | ||
|
|
0dc36897ec | ||
|
|
902b72b041 | ||
|
|
c18413786f | ||
|
|
2a171663ab | ||
|
|
843f9748d5 | ||
|
|
d932f241b0 | ||
|
|
5c484f96f2 |
@@ -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"]
|
||||
}
|
||||
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 +1 @@
|
||||
FROM mysql:5.7.28
|
||||
FROM mysql:8.0.26
|
||||
|
||||
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 mysql [](https://circleci.com/gh/dokku/dokku-mysql/tree/master) [](https://webchat.freenode.net/?channels=dokku)
|
||||
# dokku mysql [](https://github.com/dokku/dokku-mysql/actions/workflows/ci.yml?query=branch%3Amaster) [](https://webchat.libera.chat/?channels=dokku)
|
||||
|
||||
Official mysql plugin for dokku. Currently defaults to installing [mysql 5.7.28](https://hub.docker.com/_/mysql/).
|
||||
Official mysql plugin for dokku. Currently defaults to installing [mysql 8.0.26](https://hub.docker.com/_/mysql/).
|
||||
|
||||
## 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-mysql.git mysql
|
||||
```
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ 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)',
|
||||
]
|
||||
)
|
||||
|
||||
@@ -506,12 +506,12 @@ def main():
|
||||
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.12.x+")
|
||||
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
|
||||
|
||||
@@ -151,9 +151,13 @@ service_start() {
|
||||
dokku_log_info2 "Container started"
|
||||
elif service_image_exists "$SERVICE" && [[ -n "$ROOTPASSWORD" ]] && [[ -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() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku mysql service plugin"
|
||||
version = "1.13.0"
|
||||
version = "1.14.1"
|
||||
[plugin.config]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,10 +23,11 @@ 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