forked from salsadigitalauorg/ckan-ex-qgov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ahoy.yml
163 lines (137 loc) · 5.19 KB
/
.ahoy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
ahoyapi: v2
commands:
# Docker commands.
build:
usage: Build or rebuild project.
cmd: |
ahoy title "Building project"
ahoy pre-flight
ahoy clean
(docker network prune -f > /dev/null && docker network inspect amazeeio-network > /dev/null || docker network create amazeeio-network)
ahoy up -- --build --force-recreate
ahoy install-dev
ahoy install-site
ahoy title "Build complete"
ahoy doctor
ahoy info 1
info:
usage: Print information about this project.
cmd: |
ahoy line "Project : " ${PROJECT}
ahoy line "Site local URL : " ${LAGOON_LOCALDEV_URL}
ahoy line "DB port on host : " $(docker port $(docker-compose ps -q postgres) 5432 | cut -d : -f 2)
ahoy line "Solr port on host : " $(docker port $(docker-compose ps -q solr) 8983 | cut -d : -f 2)
ahoy line "Mailhog URL : " http://mailhog.docker.amazee.io/
up:
usage: Build and start Docker containers.
cmd: |
docker-compose up -d "$@"
ahoy cli "dockerize -wait tcp://ckan:3000 -timeout 1m"
if docker-compose logs | grep -q "\[Error\]"; then docker-compose logs; exit 1; fi
if docker-compose logs | grep -q "Exception"; then docker-compose logs; exit 1; fi
docker ps -a --filter name=^/${COMPOSE_PROJECT_NAME}_
export DOCTOR_CHECK_CLI=0
down:
usage: Stop Docker containers and remove container, images, volumes and networks.
cmd: "if [ -f \"docker-compose.yml\" ]; then docker-compose down --volumes; fi"
start:
usage: Start existing Docker containers.
cmd: docker-compose start "$@"
stop:
usage: Stop running Docker containers.
cmd: docker-compose stop "$@"
restart:
usage: Restart all stopped and running Docker containers.
cmd: docker-compose restart
logs:
usage: Show Docker logs.
cmd: docker-compose logs "$@"
pull:
usage: Pull latest docker images.
cmd: if [ ! -z "$(docker image ls -q)" ]; then docker image ls --format \"{{.Repository}}:{{.Tag}}\" | grep amazeeio/ | grep -v none | xargs -n1 docker pull | cat; fi
cli:
usage: Start a shell inside CLI container or run a command.
cmd: if \[ "${#}" -ne 0 \]; then docker exec -i $(docker-compose ps -q ckan) sh -c ". /app/ckan/default/bin/activate; $*"; else docker exec -it $(docker-compose ps -q ckan) sh -c ". /app/ckan/default/bin/activate && sh"; fi
doctor:
usage: Find problems with current project setup.
cmd: .docker/scripts/doctor.sh "$@"
install-site:
usage: Install a site.
cmd: |
ahoy title "Installing a fresh site"
docker cp -L .docker/test.ini $(docker-compose ps -q ckan):/app/ckan/default/production.ini
ahoy cli "/app/scripts/init.sh"
clean:
usage: Remove containers and all build files.
cmd: |
ahoy down
# Remove other directories.
# @todo: Add destinations below.
rm -rf \
./ckan
reset:
usage: "Reset environment: remove containers, all build, manually created and Drupal-Dev files."
cmd: |
ahoy clean
git ls-files --others -i --exclude-from=.git/info/exclude | xargs chmod 777
git ls-files --others -i --exclude-from=.git/info/exclude | xargs rm -Rf
find . -type d -not -path "./.git/*" -empty -delete
install-dev:
usage: Install dependencies.
cmd: |
docker cp -L requirements-dev.txt $(docker-compose ps -q ckan):/app/.
docker cp -L .flake8 $(docker-compose ps -q ckan):/app/.
docker cp -L test $(docker-compose ps -q ckan):/app/.
ahoy cli "pip install -r /app/requirements-dev.txt"
hide: true
flush-redis:
usage: Flush Redis cache.
cmd: docker exec -i $(docker-compose ps -q redis) redis-cli flushall > /dev/null
lint:
usage: Lint code.
cmd: |
ahoy cli "flake8 ${@:-/app/ckanext}" || \
[ "${ALLOW_LINT_FAIL:-0}" -eq 1 ]
test-unit:
usage: Run unit tests.
cmd: |
ahoy cli "nosetests" || \
[ "${ALLOW_UNIT_FAIL:-0}" -eq 1 ]
test-bdd:
usage: Run BDD tests.
cmd: |
ahoy cli "behave ${*:-/app/test/features}" || \
[ "${ALLOW_BDD_FAIL:-0}" -eq 1 ]
# Utilities.
title:
cmd: printf "$(tput -Txterm setaf 4)==> ${1}$(tput -Txterm sgr0)\n"
hide: true
line:
cmd: printf "$(tput -Txterm setaf 2)${1}$(tput -Txterm sgr0)${2}\n"
hide: true
getvar:
cmd: eval echo "${@}"
hide: true
pre-flight:
cmd: |
export DOCTOR_CHECK_DB=${DOCTOR_CHECK_DB:-1}
export DOCTOR_CHECK_TOOLS=${DOCTOR_CHECK_TOOLS:-1}
export DOCTOR_CHECK_PORT=${DOCTOR_CHECK_PORT:-0}
export DOCTOR_CHECK_PYGMY=${DOCTOR_CHECK_PYGMY:-1}
export DOCTOR_CHECK_CLI=${DOCTOR_CHECK_CLI:-0}
export DOCTOR_CHECK_SSH=${DOCTOR_CHECK_SSH:-0}
export DOCTOR_CHECK_WEBSERVER=${DOCTOR_CHECK_WEBSERVER:-0}
export DOCTOR_CHECK_BOOTSTRAP=${DOCTOR_CHECK_BOOTSTRAP:-0}
ahoy doctor
hide: true
entrypoint:
- bash
- "-c"
- "-e"
- |
export LAGOON_LOCALDEV_URL=http://ckanext-qgov.docker.amazee.io
[ -f .env ] && [ -s .env ] && export $(grep -v '^#' .env | xargs) && if [ -f .env.local ] && [ -s .env.local ]; then export $(grep -v '^#' .env.local | xargs); fi
bash -e -c "$0" "$@"
- '{{cmd}}'
- '{{name}}'