Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working rudimentary example version #2

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ install: uninstall
cp tt /usr/local/bin/ && \
mkdir -p /usr/local/share/tarantino/templates && \
cp *.sh /usr/local/share/tarantino && \
cp templates/docker-compose.yml /usr/local/share/tarantino/templates && \
cp -R templates/grafana /usr/local/share/tarantino/templates && \
cp -R templates /usr/local/share/tarantino && \
cp -f tt_completion /usr/local/share/tarantino && \
cp -f tt_completion_hook.bash /etc/bash_completion.d/ && \
./tt install && \
Expand Down
78 changes: 58 additions & 20 deletions dc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,90 @@ tt_dc() {
dc $@
}

dc_file() {
echo $(get_workspace_dir)/docker-compose.yml
dc_projects_file() {
echo $(get_workspace_dir)/docker-compose-projects.yml
}

dc_static_file() {
echo $(get_workspace_dir)/docker-compose-static.yml
}

dc_static() {
TT_PROJECTS=$TT_PROJECTS docker-compose -f $(dc_static_file) $@
}

dc_projects() {
TT_PROJECTS=$TT_PROJECTS docker-compose -f $(dc_projects_file) $@
}

dc() {
PROJECTS=$TT_PROJECTS TT_PROJECTS=$TT_PROJECTS docker-compose -f $(dc_file) $*
TT_PROJECTS=$TT_PROJECTS docker-compose -f $(dc_static_file) -f $(dc_projects_file) $@
}

dc_get_links() {
local key=services_"$1"_links
local links=$key[@]
eval $(parse_yaml $(dc_file) | grep $key)
eval $(parse_yaml $(dc_projects_file) | grep $key)
for link in ${!links}; do
echo $link
done
}

dc_get_all_services() {
if [ "$TT_IS_GLOBAL" = true -a -f "$ALL_SERVICES_FILE" ]; then
cat "$ALL_SERVICES_FILE"
else
dc config --services
get_workspace_cache_dir() {
local cachedir=$(get_workspace_dir)/.cache
mkdir -p $cachedir
echo $cachedir
}

generate_service_lists() {
local md5check=$(get_workspace_cache_dir)/dc_files.md5

if [ -f "$md5check" ]; then
if $(md5sum -c "$md5check" --quiet); then
return 0
fi
fi

local projects_file=$(get_workspace_cache_dir)/projects
local static_file=$(get_workspace_cache_dir)/static
local all_services_file=$(get_workspace_cache_dir)/all

dc_projects config --services > "$projects_file"
dc_static config --services > "$static_file"
dc config --services > "$all_services_file"

md5sum "$(dc_projects_file)" "$(dc_static_file)" > "$md5check"
}

dc_get_all_services() {
generate_service_lists
cat "$(get_workspace_cache_dir)/all"
}

dc_get_projects() {
generate_service_lists
cat "$(get_workspace_cache_dir)/projects"
}

dc_get_services() {
dc_get_all_services | grep -Ev $NOT_SERVICES_PATTERN
dc_get_static() {
generate_service_lists
cat "$(get_workspace_cache_dir)/static"
}

dc_get_repos() {
if [[ $# -gt 0 ]]; then
services=
ALL_INFRASTRUCTURE=$(dc_get_static | paste -sd '|' -)
repos=$@
while [ "$services" != "$repos" ]; do
services=$repos
repos=
for service in $services; do
self=$(echo $service | grep -Ev $NOT_SERVICES_PATTERN)
if [ ! -z "$self" ]; then
repos="$repos $self"
service=$(echo $service | grep -Ev $ALL_INFRASTRUCTURE)
if [ ! -z "$service" ]; then
repos="$repos $service"
fi
links=$(dc_get_links $service | grep -Ev $NOT_SERVICES_PATTERN)
links=$(dc_get_links $service | grep -Ev $ALL_INFRASTRUCTURE)
if [ ! -z "$links" ]; then
repos="$repos $links"
fi
Expand All @@ -56,10 +98,6 @@ dc_get_repos() {
echo "$repos"
fi
else
echo "$(tt_get_services)"
echo "$(dc_get_projects)"
fi
#hard-coded repos that for now will always be a dependency
echo gogo-templates
echo grafana
echo butch
}
7 changes: 0 additions & 7 deletions dynamo/Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions kibana/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions kibana/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion kibana/VERSION

This file was deleted.

47 changes: 0 additions & 47 deletions kibana/config/etc/nginx/sites-available/kibana

This file was deleted.

54 changes: 0 additions & 54 deletions kibana/config/etc/nginx/sites-available/kibana-secure

This file was deleted.

Loading