-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTaskfile.yml
163 lines (139 loc) · 4.56 KB
/
Taskfile.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
version: '3'
dotenv:
- .env
- packages/.env
vars:
DRY: ""
SKIP: ""
FLAGS: ""
tasks:
default: task -l
build:venv:
requires: { vars: [A] }
cmds:
- >
bash util/build-venv.sh
$(pwd)/packages/{{.A}}/requirements.txt
$(pwd)/packages/{{.A}}.zip
- task: build:action
sources:
- "packages/{{.A}}/requirements.txt"
generates:
- "packages/{{.A}}.zip"
build:node:
requires: { vars: [A] }
cmds:
- >
bash util/build-node.sh
$(pwd)/packages/{{.A}}/package.json
$(pwd)/packages/{{.A}}.zip
- task: build:action
sources:
- "packages/{{.A}}/package.json"
generates:
- "packages/{{.A}}.zip"
build:zip:
requires: { vars: [A] }
cmds:
- |
if test -e "packages/{{.A}}/package.json"
then echo "*** building nodejs deployment"
task build:node A="{{.A}}"
fi
if test -e "packages/{{.A}}/requirements.txt"
then echo "*** building python deployment"
task build:venv A="{{.A}}"
fi
build:action:
aliases: [b]
requires: { vars: [A] }
cmds:
- task: build:zip
- |
FILE=$(basename "{{.A}}")
cd packages/{{.A}}
zip ../$FILE.zip * -x requirements.txt
sources:
- packages/{{.A}}/*
generates:
- packages/{{.A}}.zip
clean:
ignore_error: true
cmds:
- rm -v packages/*/*.zip
setup:
desc: setup Nuvolaris MastroGPT
cmds:
- |
nuv -version
for i in packages/*/*/requirements.txt
do pip install -r $i
done
task config
cli:
desc: python cli
cmds:
- |
ipython -i util/init.ipy
serve:
desc: local web server
aliases: [s]
ignore_error: true
cmds:
- bash util/http-serve.sh
- echo "Terminated or another server started..."
single:
desc: deploy a single action (either a file or a directory)
requires: {vars: [A]}
cmds:
- python -m util.deploy -s "{{.A}}"
deploy:
desc: deploy actions
cmds:
- python -m util.deploy {{.FLAGS}}
- nuv web upload web
- echo "Deployed on:" "$NUVDEV_HOST"
undeploy:
ignore_error: true
desc: undeploy actions
cmds:
- task: clean
- >
nuv action list | awk 'NR>1 t{ print $1}' | xargs -L1 -r nuv action delete
- >
nuv package list | awk 'NR>1 t{ print $1}' | xargs -L1 -r nuv package delete
devel:
desc: incremental interactive development mode
cmds:
- task: undeploy
- python -m util.deploy -w {{.FLAGS}}
config:
desc: configure MastroGPT to access nuvolaris.dev
silent: true
cmds:
- |
clear
while ! test -e ~/.wskprops.v2
do
echo "*** Configuring Access to nuvolaris.dev with Azure OpenAI ***"
echo -n "Enter Username: "
read NUVDEV_USERNAME
if nuv -login https://nuvolaris.dev "$NUVDEV_USERNAME"
then
echo "## DO NOT EDIT - GENERATED BY task config" >.env
echo "## PUT YOUR SECRETS IN packages/.env OR as Codespace Secrets" >>.env
echo "## https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces" >>.env
echo ""
source ~/.wskprops
echo "NUVDEV_USERNAME=$NUVDEV_USERNAME" >>.env
echo "NUVDEV_HOST=https://$NUVDEV_USERNAME.nuvolaris.dev" >>.env
echo "OPENAI_API_HOST=https://openai.nuvolaris.io" >>.env
echo "$AUTH" | awk -F: '{print "OPENAI_API_KEY=" $1 }' >>.env
nuv -config -d >>.env
touch ~/.wskprops.v2
fi
done
echo "**************************************************************************************"
echo "*** Type 'deploy' to deploy your app to https://$NUVDEV_USERNAME.nuvolaris.dev"
echo "*** Type 'devel' to start incremental development mode"
echo "**************************************************************************************"