-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ahoy.yml
86 lines (74 loc) · 2.7 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
---
ahoyapi: v2
commands:
up:
usage: Build and start project.
cmd: |
docker-compose up -d "$@"
stop:
usage: Stops the project
cmd: |
docker-compose stop "$@"
down:
usage: Delete project (CAUTION).
cmd: |
if [ "$1" == "y" ]; then
docker-compose down --volumes
else
ahoy confirm "Running this command will destroy your current site, database and build? Are you sure you didn't mean ahoy stop?" &&
# Run this if confirm returns true
docker-compose down --volumes ||
# Run this if confirm returns false
echo "OK, probably a wise choice..."
fi
build:
usage: Build project.
cmd: |
docker-compose up -d --build "$@"
cli:
usage: Start a shell inside a container.
cmd: docker-compose exec "$@" sh
ps:
usage: Check processes running inside the container.
cmd: docker-compose ps
logs:
usage: View logs.
cmd: docker-compose logs "$@"
restart:
usage: Restart the project.
cmd: docker-compose restart "$@"
generate-env:
usage: Generate a .env file with values entered via prompt.
cmd: |
echo "Generating .env file..."
if [ -f ".env" ]; then
echo ".env file already exists. Skipping..."
else
read -p "Enter value for PROJECT_NAME: " project_name
read -p "Enter value for DATASTORE_READONLY_PASSWORD (leave blank for 'pass'): " datastore_readonly_password
read -p "Enter value for POSTGRES_PASSWORD (leave blank for 'pass'): " postgres_password
# Check for blank values and assign default if necessary
[ -z "$datastore_readonly_password" ] && datastore_readonly_password="pass"
[ -z "$postgres_password" ] && postgres_password="pass"
echo "PROJECT_NAME=$project_name" > .env
echo "DATASTORE_READONLY_PASSWORD=$datastore_readonly_password" >> .env
echo "POSTGRES_PASSWORD=$postgres_password" >> .env
echo ".env file has been created!"
fi
import-db:
usage: Import a database dump.
cmd: |
if [ -f "$@" ]; then
docker-compose cp "$@" db:/tmp
docker-compose exec -T db pg_restore -U ckan_default -d ckan_default /tmp/"$@"
else
echo "File not found. Please check the path and try again."
fi
import-datastore:
usage: Import a datastore dump.
cmd: |
if [ -f "$@" ]; then
docker-compose exec -T db pg_restore -U ckan_default -d datastore_default -f "$@"
else
echo "File not found. Please check the path and try again."
fi