Compare commits

..

38 Commits

Author SHA1 Message Date
Arnie 3f700b538c Update run scripts for db import 2021-06-08 09:40:50 +02:00
Arnie 0fa50fa2d9 Update run script for maria db import 2021-06-08 09:38:27 +02:00
Arnie 12777d228c Update adminer 2021-03-06 09:19:11 +01:00
Arnie a8ac87cc2c Add fathom 2021-03-06 09:13:15 +01:00
Arnie 0931c0f1bb Add idea files to gitignore 2021-03-06 09:12:45 +01:00
Arnie d62c3bb404 Add realpath function for mac compat 2021-03-06 09:10:49 +01:00
Arnie 2e91e01590 Update code formatter 2021-03-06 09:10:18 +01:00
Arnie b99086b922 Update run script to include import command 2021-02-19 10:13:52 +01:00
Arnie 248aca2640 Fix dev proxy fallback 2021-01-28 08:18:40 +01:00
Arnie eb9046a016 Update dev proxy configuration 2021-01-26 07:48:22 +01:00
Arnie a923fb6351 Update dev proxy with explicit caddy reload after config change 2020-11-22 19:09:24 +01:00
Arnie 366cd94119 Add dockerignore to dev proxy 2020-11-22 15:07:28 +01:00
Arnie f21e70669c Do not cache not found site fallback 2020-11-22 14:02:05 +01:00
Arnie 8325f74371 Add 404 to dev proxy 2020-10-09 17:03:19 +02:00
Arnie 4d9365e411 Fix dev proxy fallbacks 2020-10-06 12:12:00 +02:00
Arnie 65fc1b91a4 Update adminer 2020-10-06 11:30:23 +02:00
Arnie 2e89c4bb39 Update dev proxy 2020-10-06 11:30:15 +02:00
Arnie bb10ae775e Add import script for mysql 2020-07-20 10:51:43 +02:00
Arnie 70cf118ddb Make sure mariadb is exposed locally only 2020-05-13 12:40:25 +02:00
Arnie 8c494acebe Expose maria db random port 2020-05-13 12:33:42 +02:00
Arnie 84a14307cb Update adminer 2019-11-20 13:50:33 +01:00
Arnie 98221c2f7a Allow omiting colors 2019-09-17 09:48:37 +02:00
Arnie 9a75a91df2 Fix code formatter 2019-09-09 15:52:51 +02:00
Arnie dc36be2efb Fix inspecting docker objects when starting container 2019-07-28 07:33:36 +02:00
Arnie 4da98f6580 Update pgadmin, add postgres migrations 2019-07-28 07:33:19 +02:00
Arnie 3ef3473236 Update development scripts 2019-05-30 08:52:33 +02:00
Arnie 1a2b31f16a Rename run scripts 2019-05-30 08:45:46 +02:00
Arnie 94b1de4aaa Update adminer 2019-05-30 08:43:18 +02:00
Arnie 6771e2af62 Update elasticsearch configuration 2019-05-30 08:42:58 +02:00
Arnie 71c9b169df Update elastic search 2019-03-25 07:10:28 +01:00
Arnie a499fed7ba Add node interpretter 2019-03-25 07:09:17 +01:00
Arnie 450cae64b9 Add update pgadmin, add default password 2019-03-25 07:02:29 +01:00
Arnie 453913e1ab Fix backup in maria db, update maria db 2019-03-25 07:02:11 +01:00
Arnie 56daea7eb6 Add new versions of elastic search 2019-03-25 07:01:42 +01:00
Arnie 3b44dff061 Bring back version 5.6 to code formatter, fucking A 2019-02-14 15:01:54 +01:00
Arnie e0f32d44b1 Update code formatter 2019-02-14 15:00:04 +01:00
Arnie e5c20726a8 Update code formatter 2019-01-30 07:21:12 +01:00
Arnie 00c1886dc1 Fix webpack hmr gzip 2019-01-09 13:29:24 +01:00
51 changed files with 906 additions and 428 deletions
+1
View File
@@ -1 +1,2 @@
**/env.shinc **/env.shinc
.idea
+9
View File
@@ -6,6 +6,15 @@ USER root
RUN rm /usr/local/etc/php/conf.d/0-upload_large_dumps.ini RUN rm /usr/local/etc/php/conf.d/0-upload_large_dumps.ini
RUN apk add --no-cache \
$PHPIZE_DEPS \
&& pecl install mongodb \
&& pecl clear-cache \
&& docker-php-ext-enable mongodb
COPY ["conf.d/", "/usr/local/etc/php/conf.d"] COPY ["conf.d/", "/usr/local/etc/php/conf.d"]
ENV ADMINER_PLUGINS="dump-date dump-json dump-php dump-zip edit-calendar edit-textarea"
ENV ADMINER_DESIGN="hever"
USER adminer USER adminer
+4 -1
View File
@@ -1,10 +1,11 @@
DOCKER_REGISTRY := dr.ys-dev.cz DOCKER_REGISTRY := dr.ys-dev.cz
DOCKER_PUBLIC_REGISTRY := yoursystemcz DOCKER_PUBLIC_REGISTRY := yoursystemcz
DOCKER_MY_REGISTRY := dr.cechis.cz
APP_NAME := adminer APP_NAME := adminer
IMAGE_NAME := adminer IMAGE_NAME := adminer
VERSION := 4.7.0 VERSION := 4.8.0
all: build release all: build release
.PHONY: all .PHONY: all
@@ -16,7 +17,9 @@ version/%:
release/%: release/%:
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$* $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$* docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$* $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$*
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$* $(DOCKER_MY_REGISTRY)/$(APP_NAME):$*
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$* docker push $(DOCKER_REGISTRY)/$(APP_NAME):$*
docker push $(DOCKER_MY_REGISTRY)/$(APP_NAME):$*
docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$* docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$*
+1 -1
View File
@@ -3,7 +3,7 @@
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P ) SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="yoursystemcz/adminer" IMAGE_NAME="yoursystemcz/adminer"
IMAGE_VERSION="4.7.0" IMAGE_VERSION="4.8.0"
SERVICE_NAME=adminer SERVICE_NAME=adminer
-304
View File
@@ -1,304 +0,0 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="alpine"
IMAGE_VERSION="3.6"
SERVICE_NAME=aws-cli
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
AWS_DEFAULT_REGION=eu-central-1
CUSTOM_ARGS=""
# This directory will be mounted if no other directory is specified on the command line
DEFAULT_DIRECTORY=${SCRIPT_PATH}
# To enable the default directory mount point, override this setting to 1 in env.shinc
USE_DEFAULT_DIRECTORY=0
CURRENT_DATE="$(date +%Y-%m-%d)"
platform=$(uname)
if [[ ${platform} = "FreeBSD" ]] || [[ ${platform} = "Darwin" ]]; then
EXPIRES=$(date -v+365d '+%a, %d %b %Y 00:00:00 GMT')
else
EXPIRES=$(date '+%a, %d %b %Y 00:00:00 GMT' -d "${CURRENT_DATE} + 365 day")
fi
CACHE_MAX_AGE="31536000"
ACL="public-read"
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
REQUIRED_VARIABLES=(AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY)
for _var in ${REQUIRED_VARIABLES[@]}; do
if [ -z ${!_var+x} ]; then
echo "Please provide credential in env.shinc file, missing definition of variable: ${_var}"
exit 2
fi
done
init() {
__build
[[ $? -ne 0 ]] && return 1
}
cmd() {
local localDir
if [[ ${USE_DEFAULT_DIRECTORY} -eq 1 ]]; then
localDir=${DEFAULT_DIRECTORY}
else
__msg "Specify a mount point to /mnt/host inside the docker container"
read localDir
if [[ ${localDir} = "" ]]; then
localDir="$(pwd -P)"
__warn "You have not provided a directory, using default directory path: ${localDir}"
__msg "Continue? [(y)/n]"
read CONTINUE
if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then
return 0
fi
fi
fi
__warn "Mounting ${localDir} to /mnt/host inside the docker container"
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${localDir}":/mnt/host \
${CUSTOM_ARGS} \
${SERVICE_NAME} \
aws "$@"
}
upload() {
local source="$1"
shift
local target="$1"
shift
local args="$@"
[[ ${source} = "" ]] && __err "You must provide a source directory (filesystem) as the first parameter" && return 137
[[ ${target} = "" ]] && __err "You must provide a target directory (s3) as the second parameter" && return 137
[[ ! -e ${source} ]] && __err "The source does not exist: ${source}" && return 6
__warn "Uploading ${source} to s3://${target}"
__msg "Cache expires on ${EXPIRES}"
if [[ -f ${source} ]]; then
# File
local dirName=$(dirname ${source})
local filename=$(basename ${source})
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${dirName}":/mnt/host \
${SERVICE_NAME} \
aws s3 cp "/mnt/host/${filename}" "s3://${target}" ${args} --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
else
# Directory
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${source}":/mnt/host \
${SERVICE_NAME} \
aws s3 cp /mnt/host "s3://${target}" ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
fi
}
download() {
local source="$1"
shift
local target="$1"
shift
local args="$@"
[[ ${source} = "" ]] && __err "You must provide a source (filesystem) as the first parameter" && return 137
[[ ${target} = "" ]] && __err "You must provide a target (s3) as the second parameter" && return 137
__warn "Downloading s3://${source} to ${target}"
if [[ ! -e ${target} ]]; then
__warn "The target ${target} does not exist. Is this a file (f) or a directory (d)? ..."
read type
if [[ ${type} = "f" ]]; then
mkdir -p $(dirname ${target})
touch ${target}
elif [[ ${type} = "d" ]]; then
mkdir -p ${target}
else
__err "The input is invalid, please use either 'f' or 'd'"
fi
fi
if [[ -f ${target} ]]; then
# File
local dirName=$(dirname ${target})
local filename=$(basename ${target})
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${dirName}":/mnt/host \
${SERVICE_NAME} \
aws s3 cp "s3://${source}" "/mnt/host/${filename}" ${args}
else
# Directory
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${target}":/mnt/host \
${SERVICE_NAME} \
aws s3 cp "s3://${source}" /mnt/host ${args} --recursive
fi
}
migrate() {
local source_dir="$1"
shift
local target_dir="$1"
shift
local args="$@"
[[ ${source_dir} = "" ]] && __err "You must provide a source directory (s3) as the first parameter" && return 137
[[ ${target_dir} = "" ]] && __err "You must provide a target directory (s3) as the second parameter" && return 137
__warn "Migrating s3://${source_dir} to s3://${target_dir}"
echo "Cache expires on ${EXPIRES}"
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
${SERVICE_NAME} \
aws s3 cp "s3://${source_dir}" "s3://${target_dir}" ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
}
move() {
local source_dir="$1"
shift
local target_dir="$1"
shift
local args="$@"
[[ ${source_dir} = "" ]] && __err "You must provide a source directory (s3) as the first parameter" && return 137
[[ ${target_dir} = "" ]] && __err "You must provide a target directory (s3) as the second parameter" && return 137
__warn "Migrating s3://${source_dir} to s3://${target_dir}"
echo "Cache expires on ${EXPIRES}"
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
${SERVICE_NAME} \
aws s3 mv "s3://${source_dir}" "s3://${target_dir}" ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
}
sync() {
local source_dir="$1"
shift
local target_dir="$1"
shift
local args="$@"
[[ ${source_dir} = "" ]] && __err "You must provide a source directory (s3) as the first parameter" && return 137
[[ ${target_dir} = "" ]] && __err "You must provide a target directory (s3) as the second parameter" && return 137
__warn "Syncing s3://${source_dir} to s3://${target_dir}"
echo "Cache expires on ${EXPIRES}"
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
${SERVICE_NAME} \
aws s3 sync "s3://${source_dir}" "s3://${target_dir}" ${args} --delete --metadata-directive COPY
}
setPermissions() {
local target_dir="$1"
if [[ ${target_dir} = "" ]]; then
__warn "Please provide an s3 path: "
read target_dir
fi
docker run --rm \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
${SERVICE_NAME} \
aws s3 cp "s3://${target_dir}" "s3://${target_dir}" --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
}
exec() {
local source_dir="$1"
if [[ ${source_dir} = "" ]]; then
if [[ ${USE_DEFAULT_DIRECTORY} -eq 1 ]]; then
source_dir=${DEFAULT_DIRECTORY}
else
source_dir=$(pwd -P)
__warn "You have not provided a directory, using current path: ${source_dir}"
__msg "Continue? [(y)/n]"
read CONTINUE
if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then
return 0
fi
fi
fi
docker run --rm -it \
-u $(id -u):$(id -g) \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
-v "${source_dir}":/mnt/host \
${SERVICE_NAME} \
sh
}
"$@"
exit $?
+10 -7
View File
@@ -1,28 +1,31 @@
FROM node:10-slim FROM node:12-slim
ARG PHP_VERSION
ENV PHP_CS_FIXER_IGNORE_ENV=true
# https support # https support
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y apt-transport-https ca-certificates apt-get install -y apt-transport-https ca-certificates curl gnupg2
# add yarn and php # add yarn and php
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
curl -sS https://packages.sury.org/php/apt.gpg | apt-key add - && \
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/${PHP_VERSION}.list && \
apt-get update && \ apt-get update && \
apt-get install -y yarn php7.0-cli && \ apt-get install -y yarn ${PHP_VERSION}-cli && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/* /tmp/* /var/tmp/*
# add php fixer # add php fixer
RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.10.0/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer && \ RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.3/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer && \
chmod a+x /usr/local/bin/php-cs-fixer chmod a+x /usr/local/bin/php-cs-fixer
WORKDIR /app WORKDIR /app
# add csscomb and prettier # add csscomb and prettier
RUN yarn add prettier csscomb --global && \ RUN npm install prettier csscomb --global
ln -s /app/node_modules/.bin/prettier /usr/local/bin/prettier && \
ln -s /app/node_modules/.bin/csscomb /usr/local/bin/csscomb
COPY ["src/entry.sh", "/app/entry.sh"] COPY ["src/entry.sh", "/app/entry.sh"]
+2 -4
View File
@@ -14,15 +14,13 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
# add php fixer # add php fixer
RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.10.0/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer && \ RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.0/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer && \
chmod a+x /usr/local/bin/php-cs-fixer chmod a+x /usr/local/bin/php-cs-fixer
WORKDIR /app WORKDIR /app
# add csscomb and prettier # add csscomb and prettier
RUN yarn add prettier csscomb --global && \ RUN npm install prettier csscomb --global
ln -s /app/node_modules/.bin/prettier /usr/local/bin/prettier && \
ln -s /app/node_modules/.bin/csscomb /usr/local/bin/csscomb
COPY ["src/entry.sh", "/app/entry.sh"] COPY ["src/entry.sh", "/app/entry.sh"]
+8 -4
View File
@@ -17,17 +17,21 @@ GIT_TAG = $(shell git describe --tags --exact-match 2>/dev/null)
VERSION := $(or $(GIT_TAG),latest) VERSION := $(or $(GIT_TAG),latest)
all : VERSION := 1.0.3 all : VERSION := 1.1.2
all : build release all : build release
.PHONY : all .PHONY : all
build : build :
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.0 . docker build --build-arg VERSION=$(VERSION) --build-arg PHP_VERSION="php7.3" --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.3 .
docker build --build-arg VERSION=$(VERSION) --build-arg PHP_VERSION="php7.4" --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 .
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6 . docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6 .
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.0 $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION) docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 $(DOCKER_REGISTRY)/$(APP_NAME):latest
release : build release : build
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.0 docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.3
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6 docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION) docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)
docker push $(DOCKER_REGISTRY)/$(APP_NAME):latest
+9 -6
View File
@@ -32,6 +32,8 @@ main() {
_version="${VERSION}" _version="${VERSION}"
fi fi
__initVariables "$@"
__header "Code-Formatter [${_version}]" __header "Code-Formatter [${_version}]"
@@ -41,25 +43,26 @@ main() {
case "${_cmd}" in case "${_cmd}" in
process) process)
__initVariables "$@"
source ${INCLUDES_PATH}/process.shinc source ${INCLUDES_PATH}/process.shinc
process process
return $? return $?
;; ;;
prettier) prettier)
__initVariables "$@"
source ${INCLUDES_PATH}/formatters/prettier.shinc source ${INCLUDES_PATH}/formatters/prettier.shinc
__prettier if [[ ${#CSS_FILES[@]} -ne 0 ]]; then
__prettier ${CSS_FILES[@]}
fi
if [[ ${#JS_FILES[@]} -ne 0 ]]; then
__prettier ${JS_FILES[@]}
fi
return $? return $?
;; ;;
csscomb) csscomb)
__initVariables "$@"
source ${INCLUDES_PATH}/formatters/csscomb.shinc source ${INCLUDES_PATH}/formatters/csscomb.shinc
__csscomb __csscomb ${CSS_FILES[@]}
return $? return $?
;; ;;
php-cs-fixer) php-cs-fixer)
__initVariables "$@"
source ${INCLUDES_PATH}/formatters/php-cs-fixer.shinc source ${INCLUDES_PATH}/formatters/php-cs-fixer.shinc
__phpFixer __phpFixer
return $? return $?
@@ -3,11 +3,12 @@
__csscomb() { __csscomb() {
__msg "Csscomb:" __msg "Csscomb:"
local files=("$@")
if [[ ${DRY_RUN} -eq 0 ]]; then if [[ ${DRY_RUN} -eq 0 ]]; then
csscomb -v "${CSS_FILES[@]}" csscomb -v "${files[@]}"
else else
csscomb --lint -v "${CSS_FILES[@]}" csscomb --lint -v "${files[@]}"
fi fi
return $? return $?
@@ -3,12 +3,13 @@
__prettier() { __prettier() {
__msg "Prettier:" __msg "Prettier:"
local files=("$@")
if [[ ${DRY_RUN} -eq 0 ]]; then if [[ ${DRY_RUN} -eq 0 ]]; then
prettier --write "${JS_FILES[@]}" prettier --write "${files[@]}"
else else
__msg "Listing (: unprettiered :) files:" 1 __msg "Listing (: unprettiered :) files:" 1
prettier --list-different "${JS_FILES[@]}" prettier --list-different "${files[@]}"
fi fi
return $? return $?
+5
View File
@@ -6,30 +6,35 @@
# Colors # Colors
__color_green() { __color_green() {
[[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return
printf '\033[1;31;32m' printf '\033[1;31;32m'
printf -- "%b" "$*" printf -- "%b" "$*"
printf '\033[0m' printf '\033[0m'
} }
__color_red() { __color_red() {
[[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return
printf '\033[1;31m' printf '\033[1;31m'
printf -- "%b" "$*" printf -- "%b" "$*"
printf '\033[0m' printf '\033[0m'
} }
__color_red_bg() { __color_red_bg() {
[[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return
printf '\033[1;41m' printf '\033[1;41m'
printf -- "%b" "$*" printf -- "%b" "$*"
printf '\033[0m' printf '\033[0m'
} }
__color_white() { __color_white() {
[[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return
printf '\033[1;37;40m' printf '\033[1;37;40m'
printf -- "%b" "$*" printf -- "%b" "$*"
printf '\033[0m' printf '\033[0m'
} }
__color_yellow() { __color_yellow() {
[[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return
printf '\033[1;31;33m' printf '\033[1;31;33m'
printf -- "%b" "$*" printf -- "%b" "$*"
printf '\033[0m' printf '\033[0m'
+4 -2
View File
@@ -11,13 +11,15 @@ process() {
# Run css comb # Run css comb
if [[ ${#CSS_FILES[@]} -ne 0 ]]; then if [[ ${#CSS_FILES[@]} -ne 0 ]]; then
__csscomb __csscomb "${CSS_FILES[@]}"
[[ $? -ne 0 ]] && failed=1
__prettier "${CSS_FILES[@]}"
[[ $? -ne 0 ]] && failed=1 [[ $? -ne 0 ]] && failed=1
fi fi
# Run JS prettier # Run JS prettier
if [[ ${#JS_FILES[@]} -ne 0 ]]; then if [[ ${#JS_FILES[@]} -ne 0 ]]; then
__prettier __prettier "${JS_FILES[@]}"
[[ $? -ne 0 ]] && failed=1 [[ $? -ne 0 ]] && failed=1
fi fi
+4
View File
@@ -11,6 +11,7 @@ PHP_FILES=()
DRY_RUN=0 DRY_RUN=0
OMIT_COLORS=0
VERBOSE=0 VERBOSE=0
@@ -21,6 +22,9 @@ __initVariables() {
--dry-run) --dry-run)
DRY_RUN=1 DRY_RUN=1
;; ;;
--no-color)
OMIT_COLORS=1
;;
--verbose) --verbose)
VERBOSE=1 VERBOSE=1
;; ;;
+29
View File
@@ -34,6 +34,19 @@ stop() {
start() { start() {
__msg "Starting container... " 0 no __msg "Starting container... " 0 no
docker inspect --type container "${SERVICE_NAME}" > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
init
CURRENT_STATUS=$(docker inspect --format "{{.State.Running}}" "${SERVICE_NAME}")
if [[ "${CURRENT_STATUS}" == "true" ]]; then
return 0
fi
fi
STATUS=$(docker start ${SERVICE_NAME} 2>&1) STATUS=$(docker start ${SERVICE_NAME} 2>&1)
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
__err "${STATUS}" __err "${STATUS}"
@@ -104,3 +117,19 @@ help() {
return 0 return 0
} }
realpath $PWD > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(readlink "$(basename "$1")")
while [ "$LINK" ]; do
cd "$(dirname "$LINK")"
LINK=$(readlink "$(basename "$1")")
done
REALPATH="$PWD/$(basename "$1")"
cd "$OURPWD"
echo "$REALPATH"
}
fi
+6 -6
View File
@@ -1,18 +1,18 @@
DOCKER_REGISTRY = dr.ys-dev.cz DOCKER_REGISTRY = dr.ys-dev.cz
DOCKER_PUBLIC_REGISTRY = yoursystemcz DOCKER_PUBLIC_REGISTRY = yoursystemcz
APP_NAME = dev-proxy APP_NAME = dev-proxy
APP_VERSION = 2.0
all: build tag release
all: build release
build: build:
docker build -t $(DOCKER_REGISTRY)/$(APP_NAME):latest --build-arg "IMAGE_NAME=nimmis/alpine" --build-arg "IMAGE_VERSION=3.8" ./src docker build -t $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION) ./src
tag: tag:
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):latest $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION) $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$(APP_VERSION)
release: tag release: tag
docker push $(DOCKER_REGISTRY)/$(APP_NAME):latest docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION)
docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$(APP_VERSION)
+27 -2
View File
@@ -3,7 +3,7 @@
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P ) SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="yoursystemcz/dev-proxy" IMAGE_NAME="yoursystemcz/dev-proxy"
IMAGE_VERSION="latest" IMAGE_VERSION="2.0"
SERVICE_NAME=dev-proxy SERVICE_NAME=dev-proxy
@@ -18,6 +18,10 @@ source ${SCRIPT_PATH}/../common.shinc
source ${SCRIPT_PATH}/env.shinc 2> /dev/null source ${SCRIPT_PATH}/env.shinc 2> /dev/null
init() { init() {
makePrivate
}
makePrivate() {
docker pull ${IMAGE_NAME}:${IMAGE_VERSION} || return $? docker pull ${IMAGE_NAME}:${IMAGE_VERSION} || return $?
NETWORKS=(${PROXY_NETWORK}) NETWORKS=(${PROXY_NETWORK})
@@ -27,6 +31,7 @@ init() {
--name ${SERVICE_NAME} \ --name ${SERVICE_NAME} \
-v /var/run/docker.sock:/tmp/docker.sock:ro \ -v /var/run/docker.sock:/tmp/docker.sock:ro \
-v dev-proxy:/root/.caddy \ -v dev-proxy:/root/.caddy \
-v ${SCRIPT_PATH}/src/errorPages:/errorPages \
--restart=unless-stopped \ --restart=unless-stopped \
-p 127.0.0.1:80:80 \ -p 127.0.0.1:80:80 \
-p 127.0.0.1:443:443 \ -p 127.0.0.1:443:443 \
@@ -38,9 +43,29 @@ init() {
__ask_to_start __ask_to_start
} }
makePublic() {
docker pull ${IMAGE_NAME}:${IMAGE_VERSION} || return $?
NETWORKS=(${PROXY_NETWORK})
__createNetworks
docker create \
--name ${SERVICE_NAME} \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
-v dev-proxy:/root/.caddy \
--restart=unless-stopped \
-p 80:80 \
-p 443:443 \
--net ${PROXY_NETWORK} \
${IMAGE_NAME}:${IMAGE_VERSION}
[[ $? -ne 0 ]] && return 1
__ask_to_start
}
reload() { reload() {
docker exec ${SERVICE_NAME} pkill -USR1 caddy docker exec ${SERVICE_NAME} caddy reload --config /etc/caddy/Caddyfile
} }
"$@" "$@"
+2
View File
@@ -0,0 +1,2 @@
/.dockerignore
/Dockerfile
+6 -6
View File
@@ -1,6 +1,6 @@
FROM alpine:3.8 FROM alpine:3.12
ARG CADDY_VERSION="0.11.1" ARG CADDY_VERSION="2.2.0"
ARG FOREGO_VERSION="0.16.1" ARG FOREGO_VERSION="0.16.1"
ARG DOCKER_GEN_VERSION="0.7.4" ARG DOCKER_GEN_VERSION="0.7.4"
@@ -32,19 +32,19 @@ RUN wget --quiet "https://github.com/jwilder/docker-gen/releases/download/$DOCKE
RUN curl --silent --show-error --fail --location \ RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://github.com/mholt/caddy/releases/download/v${CADDY_VERSION}/caddy_v${CADDY_VERSION}_linux_amd64.tar.gz" \ "https://github.com/mholt/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" \
| tar --no-same-owner -C /usr/bin -xz \ | tar --no-same-owner -C /usr/bin -xz \
&& chmod 0755 /usr/bin/caddy \ && chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version \ && /usr/bin/caddy version \
&& apk del .build-dependencies && apk del .build-dependencies
EXPOSE 80 443 2015 EXPOSE 80 443
VOLUME /etc/caddy VOLUME /etc/caddy
# Starting app: # Starting app:
ADD . /code COPY [".", "/code"]
WORKDIR /code WORKDIR /code
ENTRYPOINT ["sh", "/code/docker-entrypoint.sh"] ENTRYPOINT ["sh", "/code/docker-entrypoint.sh"]
+2 -2
View File
@@ -1,2 +1,2 @@
dockergen: docker-gen -notify-output -config /code/docker-gen/config/docker-gen.cfg dockergen: docker-gen -notify-output -config /code/docker-gen/config/docker-gen.cfg -notify caddy reload
caddy: caddy --conf /etc/caddy/Caddyfile --log stdout caddy: caddy run --config /etc/caddy/Caddyfile --watch
@@ -4,4 +4,4 @@ dest = "/etc/caddy/Caddyfile"
onlyexposed = false onlyexposed = false
watch = true watch = true
wait = "500ms:2s" wait = "500ms:2s"
notifycmd = "pkill -USR1 caddy" notifycmd = "caddy reload --config /etc/caddy/Caddyfile"
@@ -1,14 +1,23 @@
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }} {{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
{{ $hosts := groupByMulti $ "Env.VIRTUAL_HOST" "," }} {{ $hosts := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
{
auto_https disable_redirects
local_certs
}
{{ if not $hosts }} :80 {
log {
output stdout
}
127.0.0.1:2015 root * /code/errorPages/siteNotFound
log stdout file_server
errors stderr header Cache-Control "no-cache, max-age=0"
try_files {path} /index.html
}
{{ else }} {{ if $hosts }}
{{ range $host, $containers := $hosts }} {{ range $host, $containers := $hosts }}
{{ $c := first $containers }} {{ $c := first $containers }}
@@ -16,34 +25,40 @@ errors stderr
{{ $port := coalesce $c.Env.VIRTUAL_PORT "80" }} {{ $port := coalesce $c.Env.VIRTUAL_PORT "80" }}
http://{{ $host }}, https://{{ $host }} { http://{{ $host }}, https://{{ $host }} {
tls self_signed tls internal
reverse_proxy * {
header_up X-Real-IP {http.request.remote}
header_up X-Forwarded-Port {http.request.port}
header_up X-Forwarded-Proto {http.request.scheme}
flush_interval -1
proxy / {
policy round_robin
transparent
websocket
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
{{ range $i, $container := $containers }} {{ range $i, $container := $containers }}
{{ $addrLen := len $container.Addresses }} {{ $addrLen := len $container.Addresses }}
{{ range $knownNetwork := $CurrentContainer.Networks }} {{ range $knownNetwork := $CurrentContainer.Networks }}
{{ range $containerNetwork := $container.Networks }} {{ range $containerNetwork := $container.Networks }}
{{ if (and (and (ne $containerNetwork.Name "ingress") (ne $containerNetwork.Name "bridge")) (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }} {{ if (and (and (ne $containerNetwork.Name "ingress") (ne $containerNetwork.Name "bridge")) (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
## Can be connected with "{{ $containerNetwork.Name }}" network ## Can be connected with "{{ $containerNetwork.Name }}" network
upstream {{ $containerNetwork.IP }}:{{ $port }} to {{ $containerNetwork.IP }}:{{ $port }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
} }
gzip {
not /__webpack_hmr/ @hmr {
not {
path /__webpack_hmr
}
}
encode @hmr gzip
log {
output stdout
} }
log stdout
errors stderr
} }
{{ end }} {{ end }}
Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

File diff suppressed because one or more lines are too long
+13
View File
@@ -0,0 +1,13 @@
ARG IMAGE_NAME
ARG IMAGE_VERSION
FROM ${IMAGE_NAME}:${IMAGE_VERSION}
RUN bin/elasticsearch-plugin install x-pack
ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml
USER elasticsearch
+19
View File
@@ -0,0 +1,19 @@
http:
host: 0.0.0.0
transport:
host: 127.0.0.1
xpack:
security:
enabled: false
authc:
anonymous:
roles:
- role1
- role2
cluster:
routing:
allocation:
disk:
watermark:
low: 0.90
high: 0.95
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="elasticsearch"
IMAGE_VERSION="5.6.16"
SERVICE_NAME=ys-elastic-search-5
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
DOMAIN_NAME="elastic5.loc"
RELEASE_NAME="yoursystemcz/elasticsearch"
RELEASE_VERSION="5.6.16"
PERSISTENT_VOLUME="ys-elastic-5"
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
init() {
__init
# Create networks
NETWORKS=(${SEARCH_ENGINE_NETWORK} ${PROXY_NETWORK})
__createNetworks
docker create \
--name ${SERVICE_NAME} \
-e VIRTUAL_HOST=${DOMAIN_NAME} \
-e VIRTUAL_PORT=9200 \
-v ${PERSISTENT_VOLUME}:/usr/share/elasticsearch/data \
--net ${SEARCH_ENGINE_NETWORK} \
${RELEASE_NAME}:${RELEASE_VERSION}
[[ $? -ne 0 ]] && return 1
docker network connect ${PROXY_NETWORK} ${SERVICE_NAME}
__ask_to_start
}
build() {
docker build \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg IMAGE_VERSION=${IMAGE_VERSION} \
-t ${RELEASE_NAME}:${RELEASE_VERSION} \
${SCRIPT_PATH}
}
release() {
build
docker push ${RELEASE_NAME}:${RELEASE_VERSION}
return $?
}
"$@"
exit $?
+11
View File
@@ -0,0 +1,11 @@
ARG IMAGE_NAME
ARG IMAGE_VERSION
FROM ${IMAGE_NAME}:${IMAGE_VERSION}
ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml
USER elasticsearch
+19
View File
@@ -0,0 +1,19 @@
http:
host: 0.0.0.0
transport:
host: 127.0.0.1
xpack:
security:
enabled: false
authc:
anonymous:
roles:
- role1
- role2
cluster:
routing:
allocation:
disk:
watermark:
low: 0.90
high: 0.95
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="elasticsearch"
IMAGE_VERSION="6.5.4"
SERVICE_NAME=ys-elastic-search-6
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
DOMAIN_NAME="elastic6.loc"
RELEASE_NAME="yoursystemcz/elasticsearch"
RELEASE_VERSION="6.5.4"
PERSISTENT_VOLUME="ys-elastic-6"
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
init() {
__init
# Create networks
NETWORKS=(${SEARCH_ENGINE_NETWORK} ${PROXY_NETWORK})
__createNetworks
docker create \
--name ${SERVICE_NAME} \
-e VIRTUAL_HOST=${DOMAIN_NAME} \
-e VIRTUAL_PORT=9200 \
-v ${PERSISTENT_VOLUME}:/usr/share/elasticsearch/data \
--net ${SEARCH_ENGINE_NETWORK} \
${RELEASE_NAME}:${RELEASE_VERSION}
[[ $? -ne 0 ]] && return 1
docker network connect ${PROXY_NETWORK} ${SERVICE_NAME}
__ask_to_start
}
build() {
docker build \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg IMAGE_VERSION=${IMAGE_VERSION} \
-t ${RELEASE_NAME}:${RELEASE_VERSION} \
${SCRIPT_PATH}
}
release() {
build
docker push ${RELEASE_NAME}:${RELEASE_VERSION}
return $?
}
"$@"
exit $?
-2
View File
@@ -2,8 +2,6 @@ ARG IMAGE_NAME
ARG IMAGE_VERSION ARG IMAGE_VERSION
FROM ${IMAGE_NAME}:${IMAGE_VERSION} FROM ${IMAGE_NAME}:${IMAGE_VERSION}
RUN bin/elasticsearch-plugin install x-pack
ADD elasticsearch.yml /usr/share/elasticsearch/config/ ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root USER root
+7
View File
@@ -10,3 +10,10 @@ xpack:
roles: roles:
- role1 - role1
- role2 - role2
cluster:
routing:
allocation:
disk:
watermark:
low: 0.90
high: 0.95
@@ -5,7 +5,6 @@ SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="elasticsearch" IMAGE_NAME="elasticsearch"
# Old version, AWS supported # Old version, AWS supported
IMAGE_VERSION="2.3.5" IMAGE_VERSION="2.3.5"
#IMAGE_VERSION="5.3.2"
SERVICE_NAME=ys-elastic-search SERVICE_NAME=ys-elastic-search
@@ -21,7 +20,6 @@ DOMAIN_NAME="elastic.loc"
RELEASE_NAME="yoursystemcz/elasticsearch" RELEASE_NAME="yoursystemcz/elasticsearch"
# Old version, AWS supported # Old version, AWS supported
RELEASE_VERSION="2.3.5" RELEASE_VERSION="2.3.5"
#RELEASE_VERSION="5.3.2"
PERSISTENT_VOLUME="ys-elastic" PERSISTENT_VOLUME="ys-elastic"
Executable
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="usefathom/fathom"
IMAGE_VERSION="latest"
SERVICE_NAME=fathom
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
DOMAIN_NAME="fathom.loc"
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
init() {
__init
NETWORKS=(${PROXY_NETWORK} ${DB_NETWORK})
__createNetworks
docker create \
--name ${SERVICE_NAME} \
-e VIRTUAL_HOST=${DOMAIN_NAME} \
-e VIRTUAL_PORT=8080 \
-e FATHOM_DATABASE_DRIVER="postgres" \
-e FATHOM_DATABASE_NAME="fathom" \
-e FATHOM_DATABASE_USER="root" \
-e FATHOM_DATABASE_PASSWORD="megaheslo" \
-e FATHOM_DATABASE_HOST="pgsql-db" \
-e FATHOM_DATABASE_SSLMODE="disable" \
-e FATHOM_SECRET="abcdefghijqrstuvw34567890" \
${IMAGE_NAME}:${IMAGE_VERSION}
[[ $? -ne 0 ]] && return 1
docker network connect ${PROXY_NETWORK} ${SERVICE_NAME}
[[ $? -ne 0 ]] && return 1
docker network connect ${DB_NETWORK} ${SERVICE_NAME}
[[ $? -ne 0 ]] && return 1
__ask_to_start
}
"$@"
exit $?
View File
+43 -2
View File
@@ -3,7 +3,7 @@
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P ) SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="mariadb" IMAGE_NAME="mariadb"
IMAGE_VERSION="10.1" IMAGE_VERSION="10.3"
SERVICE_NAME=maria-db SERVICE_NAME=maria-db
@@ -32,6 +32,7 @@ init() {
--name ${SERVICE_NAME} \ --name ${SERVICE_NAME} \
--restart=unless-stopped \ --restart=unless-stopped \
-v ${DB_VOLUME}:/var/lib/mysql \ -v ${DB_VOLUME}:/var/lib/mysql \
-p 127.0.0.1::3306 \
-e MYSQL_ROOT_PASSWORD=${DB_PASSWORD} \ -e MYSQL_ROOT_PASSWORD=${DB_PASSWORD} \
--net ${DB_NETWORK} \ --net ${DB_NETWORK} \
${IMAGE_NAME}:${IMAGE_VERSION} ${IMAGE_NAME}:${IMAGE_VERSION}
@@ -46,6 +47,46 @@ cmd() {
docker run --rm -it -v $PWD:/current --net ${DB_NETWORK} ${IMAGE_NAME}:${IMAGE_VERSION} $@ docker run --rm -it -v $PWD:/current --net ${DB_NETWORK} ${IMAGE_NAME}:${IMAGE_VERSION} $@
} }
import() {
local dbname="$1"
shift
local filename="$1"
shift
if [[ "${dbname}" == "" ]] || [[ "${filename}" == "" ]]; then
__err "You must provide database name and filename of the file you want to import"
__msg "E.g. ./run import my-database-name \"\$PWD/my-file.sql\""
return 137
fi
if [[ ! -f "${filename}" ]]; then
__err "The filename was not located at ${filename}"
return 137
fi
echo -e "${C_WARN}This will import the file located at \"${C_WHITE}${filename}${C_WARN}\" to a database named \"${C_WHITE}${dbname}${C_WARN}\"${C_NONE}"
echo
__warn "Do you want to continue? [y/(n)] "
read CONTINUE
if [[ "${CONTINUE}" != "y" ]]; then
__msg "Quiting..."
return 0
fi
__msg "Importing, please wait..."
local path=$(realpath "${filename}")
local name=$(basename "${path}")
docker run --rm -it -v "${path}":"/import/${name}" --net ${DB_NETWORK} ${IMAGE_NAME}:${IMAGE_VERSION} mysql -h ${SERVICE_NAME} -u root -p${DB_PASSWORD} "${dbname}" -e "source /import/${name}"
}
bash() { bash() {
cmd bash cmd bash
} }
@@ -56,7 +97,7 @@ backup() {
local user=$(id -u) local user=$(id -u)
mkdir -p ${BACKUP_DIR} && \ mkdir -p ${BACKUP_DIR} && \
docker run --rm --volumes-from ${SERVICE_NAME} -v ${BACKUP_DIR}:/backup busybox tar cvf /backup/backup.tar /var/lib/mysql && chown -R ${user}:${user} ./backup docker run --rm --volumes-from ${SERVICE_NAME} -v ${BACKUP_DIR}:/backup busybox tar cvf /backup/backup.tar /var/lib/mysql && sudo chown -R ${user}:${user} ./backup
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
__err "Could not create the backup" __err "Could not create the backup"
exit 2 exit 2
View File
+18
View File
@@ -0,0 +1,18 @@
DOCKER_REGISTRY = dr.ys-dev.cz
DOCKER_PUBLIC_REGISTRY = yoursystemcz
APP_NAME = node-interpretter
all: build release
build:
docker build -t $(DOCKER_REGISTRY)/$(APP_NAME):latest --build-arg "IMAGE_NAME=node" --build-arg "IMAGE_VERSION=10.15.0-slim" ./src
tag:
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):latest $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest
release: tag
docker push $(DOCKER_REGISTRY)/$(APP_NAME):latest
docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
SERVICE_NAME="node-interpretter"
source ${SCRIPT_PATH}/shared.env.shinc 2> /dev/null
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
docker inspect --type container ${SERVICE_NAME} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "The node container does not exist"
exit 137
fi
NODE_SERVICE_STATE=$(docker inspect --type container ${SERVICE_NAME} --format "{{.State.Running}}")
if [[ $? -ne 0 ]]; then
echo "Could not get state of the node container"
exit 137
fi
if [[ "${NODE_SERVICE_STATE}" != "true" ]]; then
docker start ${SERVICE_NAME} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "Could not start the node container"
exit 137
fi
fi
case "${1}" in
npm|npx|yarn|yarnpkg|*npm-cli.js*|*npx-cli.js*)
docker exec -i ${SERVICE_NAME} "$@"
;;
*)
docker exec -i ${SERVICE_NAME} node "$@"
;;
esac
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node npm "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node npx "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node yarn "$@"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
node yarnpkg "$@"
+3
View File
@@ -0,0 +1,3 @@
PROJECTS_PATH="${HOME}/projects"
MOUNT_PATHS=("${HOME}:${HOME}" "${PROJECTS_PATH}:/projects" "/mnt:/mnt")
#RESTART=1
+129
View File
@@ -0,0 +1,129 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="yoursystemcz/node-interpretter"
IMAGE_VERSION="latest"
SERVICE_NAME="node-interpretter"
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
MOUNT_PATHS=()
RESTART=0
source ${SCRIPT_PATH}/shared.env.shinc 2> /dev/null
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
__createLink() {
local continue
local hostPath="${1}"
local binaryLink="${2}"
if [[ -f "${hostPath}" || -L "${hostPath}" ]]; then
__warn "There is already a ${hostPath}, are you sure you want to replace it? [y/(n)]:"
read continue
if [[ "${continue}" == "y" || "${continue}" == "Y" ]]; then
__msg "Linking node binary at ${hostPath}"
sudo rm -f "${hostPath}"
sudo ln -s "${SCRIPT_PATH}/bin/${binaryLink}" "${hostPath}"
[[ $? -ne 0 ]] && __err "Could not link ${binaryLink} binary at ${hostPath}" && return 137
fi
else
__msg "Linking node binary at ${hostPath}"
sudo ln -s "${SCRIPT_PATH}/bin/${binaryLink}" "${hostPath}"
fi
}
__deleteLink() {
local hostPath="${1}"
local binaryLink="${2}"
if [[ -L "${hostPath}" ]]; then
local linkName=$(readlink -f "${hostPath}")
if [[ $? -eq 0 && "${linkName}" == "${SCRIPT_PATH}/bin/${binaryLink}" ]]; then
__warn "Removing link at ${hostPath}"
sudo rm -f ${hostPath}
fi
fi
}
__createLinks() {
__createLink "${NODE_HOST_PATH}" node
__createLink "${NODE_HOST_PATH}js" node
__createLink "${NPM_HOST_PATH}" npm
__createLink "${NPX_HOST_PATH}" npx
__createLink "${YARN_HOST_PATH}" yarn
__createLink "${YARNPKG_HOST_PATH}" yarnpkg
}
__deleteLinks() {
__deleteLink "${NODE_HOST_PATH}" node
__deleteLink "${NODE_HOST_PATH}js" node
__deleteLink "${NPM_HOST_PATH}" npm
__deleteLink "${NPX_HOST_PATH}" npx
__deleteLink "${YARN_HOST_PATH}" yarn
__deleteLink "${YARNPKG_HOST_PATH}" yarnpkg
}
init() {
__createLinks
local mountPaths=""
[[ ${#MOUNT_PATHS[@]} -eq 0 ]] && __err "No MOUNT_PATHS were specified. Please provide these in an .env.shinc file at ${SCRIPT_PATH}/.env.shinc" && return 137
for mountPath in ${MOUNT_PATHS[@]}; do
mountPaths="${mountPaths} -v ${mountPath}"
done
args="${mountPaths} -v ${SCRIPT_PATH}/configs/${SERVICE_NAME/plex_/}:/config"
if [[ ${RESTART} -eq 1 ]]; then
args="${args} --restart=always"
fi
docker create \
--name ${SERVICE_NAME} \
--user $(id -u) \
-v ${SSH_KEY}:/home/node/.ssh/${SSH_KEY_NAME} \
-v ${KNOWN_HOSTS}:/home/node/.ssh/known_hosts \
-v npm-cache:/home/node/.npm \
-e TZ=Europe/Prague \
${args} \
--net host \
--entrypoint /cmd \
${IMAGE_NAME}:${IMAGE_VERSION}
[[ $? -ne 0 ]] && __err "Could not create the docker container" && return 137
docker start ${SERVICE_NAME} && \
docker exec --user 0 ${SERVICE_NAME} mkdir -p /usr/local/lib/node_modules && \
docker exec --user 0 ${SERVICE_NAME} chown $(id -u) /usr/local/lib/node_modules && \
docker exec --user 0 ${SERVICE_NAME} chown $(id -u) /usr/local/bin
}
remove() {
stop
__msg "Removing container... " 0 no
STATUS=$(docker rm ${SERVICE_NAME} 2>&1)
if [[ $? -ne 0 ]]; then
__err "${STATUS}"
return 1
else
__success "[ok]"
fi
__deleteLinks
return 0
}
"$@"
exit $?
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
SSH_KEY="$HOME/.ssh/id_rsa"
SSH_KEY_NAME="id_rsa"
KNOWN_HOSTS="${HOME}/.ssh/known_hosts"
PROJECTS_PATH="${HOME}/projects"
NODE_HOST_PATH="/usr/local/bin/node"
NPM_HOST_PATH="/usr/local/bin/npm"
NPX_HOST_PATH="/usr/local/bin/npx"
YARN_HOST_PATH="/usr/local/bin/yarn"
YARNPKG_HOST_PATH="/usr/local/bin/yarnpkg"
+8
View File
@@ -0,0 +1,8 @@
ARG IMAGE_NAME
ARG IMAGE_VERSION
FROM ${IMAGE_NAME}:${IMAGE_VERSION}
COPY ["./cmd", "/cmd"]
ENTRYPOINT ["node"]
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
echo "Waiting for commands..."
while :
do
sleep 10 &
wait
done
exit 0
+8 -4
View File
@@ -2,8 +2,8 @@
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P ) SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="chorss/docker-pgadmin4" IMAGE_NAME="dpage/pgadmin4"
IMAGE_VERSION="3.0" IMAGE_VERSION="4.10"
SERVICE_NAME=pgadmin SERVICE_NAME=pgadmin
@@ -15,6 +15,8 @@ source ${SCRIPT_PATH}/../common.shinc
# #
DOMAIN_NAME="pgadmin.loc" DOMAIN_NAME="pgadmin.loc"
PGADMIN_DEFAULT_EMAIL="admin"
PGADMIN_DEFAULT_PASSWORD="admin"
source ${SCRIPT_PATH}/env.shinc 2> /dev/null source ${SCRIPT_PATH}/env.shinc 2> /dev/null
@@ -29,8 +31,10 @@ init() {
docker create \ docker create \
--name ${SERVICE_NAME} \ --name ${SERVICE_NAME} \
-e VIRTUAL_HOST=${DOMAIN_NAME} \ -e VIRTUAL_HOST=${DOMAIN_NAME} \
-e VIRTUAL_PORT=5050 \ -e VIRTUAL_PORT=80 \
-v pgadmin_data:/data \ -e PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} \
-e PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} \
-v pgadmin:/var/lib/pgadmin \
--restart=unless-stopped \ --restart=unless-stopped \
${IMAGE_NAME}:${IMAGE_VERSION} ${IMAGE_NAME}:${IMAGE_VERSION}
Executable
+155
View File
@@ -0,0 +1,155 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="postgres"
IMAGE_VERSION="10.9"
POSTGIS_MAJOR="2.5"
POSTGIS_VERSION="2.5.2+dfsg-1~exp1.pgdg90+1"
SERVICE_NAME=pgsql-db
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
DB_VOLUME=pgsql_persistent_10
PORT=5432
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
__build() {
docker build \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg VERSION=${IMAGE_VERSION} \
--build-arg POSTGIS_MAJOR=${IMAGE_VERSION} \
--build-arg POSTGIS_VERSION=${IMAGE_VERSION} \
-t ${SERVICE_NAME}:latest \
${SCRIPT_PATH}/build
return $?
}
init() {
__init
NETWORKS=(${DB_NETWORK})
__createNetworks
__msg "Removing old postgres bin volume..."
docker volume rm -f ${PGSQL_DB_BIN} &&
docker create \
--name ${SERVICE_NAME} \
--restart=unless-stopped \
-v ${DB_VOLUME}:/var/lib/postgresql/data \
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
-e POSTGRES_USER=${DB_USER} \
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
--net ${DB_NETWORK} \
-p ${PORT}:5432 \
${IMAGE_NAME}:${IMAGE_VERSION}
[[ $? -ne 0 ]] && return 1
__ask_to_start
}
import() {
local dbname="$1"
shift
local filename="$1"
shift
if [[ "${dbname}" == "" ]] || [[ "${filename}" == "" ]]; then
__err "You must provide database name and filename of the file you want to import"
__msg "E.g. ./run import my-database-name \"\$PWD/my-file.sql\""
return 137
fi
if [[ ! -f "${filename}" ]]; then
__err "The filename was not located at ${filename}"
return 137
fi
echo -e "${C_WARN}This will import the file located at \"${C_WHITE}${filename}${C_WARN}\" to a database named \"${C_WHITE}${dbname}${C_WARN}\"${C_NONE}"
echo
__warn "Do you want to continue? [y/(n)] "
read CONTINUE
if [[ "${CONTINUE}" != "y" ]]; then
__msg "Quiting..."
return 0
fi
__msg "Importing, please wait..."
local path=$(realpath "${filename}")
local name=$(basename "${path}")
docker run --rm -it -v "${path}":"/import/${name}" --net ${DB_NETWORK} ${IMAGE_NAME}:${IMAGE_VERSION} pg_restore --no-owner -Fc --host=${SERVICE_NAME} --password --dbname=${dbname} "/import/${name}"
}
migrate9to10() {
local migrationVolume="pgsql-9-10-dump-migration"
local migrationPath="/pgsql-data-dump"
stop
docker volume create ${migrationVolume}
docker run --rm -d \
--name postgres_migration_from_9 \
-v ${DB_VOLUME}:/var/lib/postgresql/data \
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
-v ${migrationVolume}:${migrationPath} \
-e POSTGRES_USER=${DB_USER} \
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
mdillon/postgis:9.5
echo "Waiting for postgres to initialize"
sleep 10
docker exec -it \
postgres_migration_from_9 \
bash -c "pg_dumpall > ${migrationPath}/full.dump"
if [[ $? -ne 0 ]]; then
docker stop postgres_migration_from_9
__err "Bad thing, don't continue, quitsies, bye"
exit 137
fi
docker stop postgres_migration_from_9
docker volume rm -f ${DB_VOLUME}
docker volume create ${DB_VOLUME}
docker run --rm -d \
--name postgres_migration_to_10 \
-v ${DB_VOLUME}:/var/lib/postgresql/data \
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
-v ${migrationVolume}:${migrationPath} \
-e POSTGRES_USER=${DB_USER} \
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
mdillon/postgis:10
echo "Waiting for postgres to initialize"
sleep 30
docker exec -it \
postgres_migration_to_10 \
psql -f ${migrationPath}/full.dump
docker stop postgres_migration_to_10
__init
}
"$@"
exit $?
-49
View File
@@ -1,49 +0,0 @@
#!/usr/bin/env bash
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
IMAGE_NAME="mdillon/postgis"
IMAGE_VERSION="9.5"
SERVICE_NAME=pgsql-db
source ${SCRIPT_PATH}/../common.shinc
#
# Project specific variables
#
DB_VOLUME=pgsql_persistent
PORT=5432
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
init() {
__init
NETWORKS=(${DB_NETWORK})
__createNetworks
__msg "Removing old postgres bin volume..."
docker volume rm -f ${PGSQL_DB_BIN} &&
docker create \
--name ${SERVICE_NAME} \
--restart=unless-stopped \
-v ${DB_VOLUME}:/var/lib/postgresql/data \
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
-e POSTGRES_USER=${DB_USER} \
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
--net ${DB_NETWORK} \
-p ${PORT}:5432 \
${IMAGE_NAME}:${IMAGE_VERSION}
[[ $? -ne 0 ]] && return 1
__ask_to_start
}
"$@"
exit $?