tebakaja commited on
Commit
4597f89
1 Parent(s): 776f89e

feat: add Proxy-3 and Proxy-4

Browse files
.github/workflows/proxy_deployment.yaml CHANGED
@@ -175,6 +175,106 @@ jobs:
175
  git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main --force
176
 
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  # Functional Testing
179
  functional_testing:
180
  name: Functional Testing
@@ -185,6 +285,8 @@ jobs:
185
  - tebakaja_proxy_space-0
186
  - tebakaja_proxy_space-1
187
  - tebakaja_proxy_space-2
 
 
188
 
189
  steps:
190
  - name: Set global directory
 
175
  git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main --force
176
 
177
 
178
+ # TebakAja Proxy-3
179
+ tebakaja_proxy_space-3:
180
+ name: Proxy-3 [ Docker - Hugging Face ]
181
+ runs-on: ubuntu-latest
182
+ needs: unit_testing
183
+
184
+ env:
185
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
186
+ SPACE_NAME: tebakaja_proxy_space-3
187
+ HF_USERNAME: qywok
188
+ ENDPOINT: qywok-tebakaja-proxy-space-3.hf.space
189
+
190
+ steps:
191
+ - name: Set global directory
192
+ run: git config --global --add safe.directory /github/workspace
193
+
194
+ - uses: actions/checkout@v3
195
+ with:
196
+ persist-credentials: false
197
+ fetch-depth: 1000
198
+
199
+ - name: Check git status
200
+ run: git status
201
+
202
+ - name: Configure git
203
+ run: |
204
+ git config --local user.email "alfariqyraihan@gmail.com"
205
+ git config --local user.name "qywok"
206
+
207
+ - name: Pull changes from remote
208
+ run: |
209
+ git pull https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main || \
210
+ (git merge --strategy-option theirs)
211
+
212
+ - name: Change Endpoint
213
+ run: |
214
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/docs.go
215
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/swagger.json
216
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/swagger.yaml
217
+
218
+ - name: Add and commit changes
219
+ run: |
220
+ git add -A
221
+ git diff-index --quiet HEAD || git commit -m "$SPACE_NAME"
222
+
223
+ - name: Push to Hugging Face
224
+ run: |
225
+ git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main --force
226
+
227
+
228
+ # TebakAja Proxy-4
229
+ tebakaja_proxy_space-4:
230
+ name: Proxy-4 [ Docker - Hugging Face ]
231
+ runs-on: ubuntu-latest
232
+ needs: unit_testing
233
+
234
+ env:
235
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
236
+ SPACE_NAME: tebakaja_proxy_space-4
237
+ HF_USERNAME: qywok
238
+ ENDPOINT: qywok-tebakaja-proxy-space-4.hf.space
239
+
240
+ steps:
241
+ - name: Set global directory
242
+ run: git config --global --add safe.directory /github/workspace
243
+
244
+ - uses: actions/checkout@v3
245
+ with:
246
+ persist-credentials: false
247
+ fetch-depth: 1000
248
+
249
+ - name: Check git status
250
+ run: git status
251
+
252
+ - name: Configure git
253
+ run: |
254
+ git config --local user.email "alfariqyraihan@gmail.com"
255
+ git config --local user.name "qywok"
256
+
257
+ - name: Pull changes from remote
258
+ run: |
259
+ git pull https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main || \
260
+ (git merge --strategy-option theirs)
261
+
262
+ - name: Change Endpoint
263
+ run: |
264
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/docs.go
265
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/swagger.json
266
+ sed -i "s/192.168.137.1:7860/$ENDPOINT/g" docs/swagger.yaml
267
+
268
+ - name: Add and commit changes
269
+ run: |
270
+ git add -A
271
+ git diff-index --quiet HEAD || git commit -m "$SPACE_NAME"
272
+
273
+ - name: Push to Hugging Face
274
+ run: |
275
+ git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main --force
276
+
277
+
278
  # Functional Testing
279
  functional_testing:
280
  name: Functional Testing
 
285
  - tebakaja_proxy_space-0
286
  - tebakaja_proxy_space-1
287
  - tebakaja_proxy_space-2
288
+ - tebakaja_proxy_space-3
289
+ - tebakaja_proxy_space-4
290
 
291
  steps:
292
  - name: Set global directory
Dockerfile CHANGED
@@ -26,7 +26,7 @@ RUN cat > ${DOTENV} <<EOF
26
  TEBAKAJA_PROXY_HOST=${HOST}
27
  TEBAKAJA_PROXY_PORT=${PORT}
28
 
29
- TEBAKAJA_CORS_ALLOW_ORIGINS=https://huggingface.co,https://qywok-tebakaja-proxy-space-0.hf.space,https://qywok-tebakaja-proxy-space-1.hf.space,https://qywok-tebakaja-proxy-space-2.hf.space
30
  TEBAKAJA_CORS_ALLOW_HEADERS=*
31
  TEBAKAJA_CORS_ALLOW_METHODS=GET,POST
32
  EOF
 
26
  TEBAKAJA_PROXY_HOST=${HOST}
27
  TEBAKAJA_PROXY_PORT=${PORT}
28
 
29
+ TEBAKAJA_CORS_ALLOW_ORIGINS=https://huggingface.co,https://qywok-tebakaja-proxy-space-0.hf.space,https://qywok-tebakaja-proxy-space-1.hf.space,https://qywok-tebakaja-proxy-space-2.hf.space,https://qywok-tebakaja-proxy-space-3.hf.space,https://qywok-tebakaja-proxy-space-4.hf.space
30
  TEBAKAJA_CORS_ALLOW_HEADERS=*
31
  TEBAKAJA_CORS_ALLOW_METHODS=GET,POST
32
  EOF
endpoints_test.sh CHANGED
@@ -2,6 +2,8 @@
2
  PROD_ENDPOINT_0="https://qywok-tebakaja-proxy-space-0.hf.space"
3
  PROD_ENDPOINT_1="https://qywok-tebakaja-proxy-space-1.hf.space"
4
  PROD_ENDPOINT_2="https://qywok-tebakaja-proxy-space-2.hf.space"
 
 
5
 
6
 
7
  check_status() {
@@ -61,3 +63,23 @@ make_post_request "$PROD_ENDPOINT_2/crypto/prediction" "{\"days\": 7, \"currency
61
  make_get_request "$PROD_ENDPOINT_2/national-currency/lists" "natcurr-list-prod-2"
62
  make_post_request "$PROD_ENDPOINT_2/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-2"
63
  echo " "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  PROD_ENDPOINT_0="https://qywok-tebakaja-proxy-space-0.hf.space"
3
  PROD_ENDPOINT_1="https://qywok-tebakaja-proxy-space-1.hf.space"
4
  PROD_ENDPOINT_2="https://qywok-tebakaja-proxy-space-2.hf.space"
5
+ PROD_ENDPOINT_3="https://qywok-tebakaja-proxy-space-3.hf.space"
6
+ PROD_ENDPOINT_4="https://qywok-tebakaja-proxy-space-4.hf.space"
7
 
8
 
9
  check_status() {
 
63
  make_get_request "$PROD_ENDPOINT_2/national-currency/lists" "natcurr-list-prod-2"
64
  make_post_request "$PROD_ENDPOINT_2/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-2"
65
  echo " "
66
+
67
+
68
+ echo "-------- [ Proxy 3 ] --------"
69
+ make_get_request "$PROD_ENDPOINT_3/stock/lists" "stock-list-prod-3"
70
+ make_post_request "$PROD_ENDPOINT_3/stock/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "stock-prediction-prod-3"
71
+ make_get_request "$PROD_ENDPOINT_3/crypto/lists" "crypto-list-prod-3"
72
+ make_post_request "$PROD_ENDPOINT_3/crypto/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "crypto-prediction-prod-3"
73
+ make_get_request "$PROD_ENDPOINT_3/national-currency/lists" "natcurr-list-prod-3"
74
+ make_post_request "$PROD_ENDPOINT_3/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-3"
75
+ echo " "
76
+
77
+
78
+ echo "-------- [ Proxy 4 ] --------"
79
+ make_get_request "$PROD_ENDPOINT_4/stock/lists" "stock-list-prod-4"
80
+ make_post_request "$PROD_ENDPOINT_4/stock/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "stock-prediction-prod-4"
81
+ make_get_request "$PROD_ENDPOINT_4/crypto/lists" "crypto-list-prod-4"
82
+ make_post_request "$PROD_ENDPOINT_4/crypto/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "crypto-prediction-prod-4"
83
+ make_get_request "$PROD_ENDPOINT_4/national-currency/lists" "natcurr-list-prod-4"
84
+ make_post_request "$PROD_ENDPOINT_4/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-4"
85
+ echo " "
main.go CHANGED
@@ -61,11 +61,13 @@ func main() {
61
  }))
62
 
63
  proxyService.Use(func(c *fiber.Ctx) error {
64
- c.Set("Content-Security-Policy", fmt.Sprintf("frame-ancestors 'self' %s %s %s %s",
65
  "https://huggingface.co",
66
  "https://qywok-tebakaja-proxy-space-0.hf.space",
67
  "https://qywok-tebakaja-proxy-space-1.hf.space",
68
  "https://qywok-tebakaja-proxy-space-2.hf.space",
 
 
69
  ))
70
  return c.Next()
71
  })
 
61
  }))
62
 
63
  proxyService.Use(func(c *fiber.Ctx) error {
64
+ c.Set("Content-Security-Policy", fmt.Sprintf("frame-ancestors 'self' %s %s %s %s %s %s",
65
  "https://huggingface.co",
66
  "https://qywok-tebakaja-proxy-space-0.hf.space",
67
  "https://qywok-tebakaja-proxy-space-1.hf.space",
68
  "https://qywok-tebakaja-proxy-space-2.hf.space",
69
+ "https://qywok-tebakaja-proxy-space-3.hf.space",
70
+ "https://qywok-tebakaja-proxy-space-4.hf.space",
71
  ))
72
  return c.Next()
73
  })