-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added deploy with docker CD * feat: docker deploy test * fix: CI * fix: path of `config.yaml` * fix: CI fail * docs: update doc for docker deploy * fix: typo * fix: add EOF && trigger CD Co-authored-by: nic-chen <johz@163.com> Co-authored-by: kv <gxthrj@163.com>
- Loading branch information
1 parent
ff33d97
commit 4cde6a3
Showing
7 changed files
with
172 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Test and Deploy with Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- v2.0 | ||
pull_request: | ||
branches: | ||
- master | ||
# NOTE: Just to trigger CD in this PR, will be removed before being merged | ||
- v2.0 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: Azure/docker-login@v1 | ||
with: | ||
login-server: apisixacr.azurecr.cn | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Build Docker Image | ||
run: | | ||
docker build -t dashboard:ci . | ||
- name: Modify ETCD IP | ||
run: | | ||
sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' api/conf/conf.yaml | ||
sed -i 's/host: 127.0.0.1/host: 0.0.0.0/' api/conf/conf.yaml | ||
- name: Run Docker Compose | ||
working-directory: ./api/test/docker-deploy | ||
run: | | ||
docker-compose up -d | ||
sleep 5 | ||
docker logs docker-deploy_managerapi_1 | ||
- name: Run Test | ||
run: api/test/shell/docker_deploy_test.sh | ||
|
||
- name: Deploy | ||
run: | | ||
docker tag dashboard:ci apisixacr.azurecr.cn/dashboard:${{ github.sha }} | ||
docker push apisixacr.azurecr.cn/dashboard:${{ github.sha }} | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
version: "3.6" | ||
|
||
services: | ||
etcd: | ||
image: quay.io/coreos/etcd:v3.4.0 | ||
ports: | ||
- "2379:2379" | ||
expose: | ||
- 2379 | ||
- 2380 | ||
networks: | ||
apisix_dashboard_e2e: | ||
ipv4_address: 172.16.238.10 | ||
environment: | ||
- ETCDCTL_API=3 | ||
command: | ||
- /usr/local/bin/etcd | ||
- --data-dir=/etcd-data | ||
- --name | ||
- node1 | ||
- --initial-advertise-peer-urls | ||
- http://172.16.238.10:2380 | ||
- --listen-peer-urls | ||
- http://0.0.0.0:2380 | ||
- --advertise-client-urls | ||
- http://172.16.238.10:2379 | ||
- --listen-client-urls | ||
- http://0.0.0.0:2379 | ||
|
||
managerapi: | ||
image: dashboard:ci | ||
restart: always | ||
volumes: | ||
- ../../conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro | ||
depends_on: | ||
- etcd | ||
ports: | ||
- '8080:8080/tcp' | ||
networks: | ||
apisix_dashboard_e2e: | ||
ipv4_address: 172.16.238.40 | ||
|
||
networks: | ||
apisix_dashboard_e2e: | ||
driver: bridge | ||
ipam: | ||
driver: default | ||
config: | ||
- | ||
subnet: 172.16.238.0/24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
set -ex | ||
|
||
# web page | ||
curl http://127.0.0.1:8080 | ||
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:8080) | ||
if [ ! $code -eq 200 ]; then | ||
echo "failed: failed to custom port" | ||
exit 1 | ||
fi | ||
|
||
# login | ||
resp=$(curl http://127.0.0.1:8080/apisix/admin/user/login -X POST -d '{"username":"admin", "password": "admin"}') | ||
token=$(echo "${resp}" | sed 's/{/\n/g' | sed 's/,/\n/g' | grep "token" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g' | sed 's/"//g') | ||
if [ -z "${token}" ]; then | ||
echo "login failed" | ||
fi | ||
|
||
# plugin orchestration | ||
echo $token | ||
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:8080/apisix/admin/routes/1 -X PUT -i -H "Authorization: $token" -d '{"id":"1","uri":"/index.html","upstream":{"type":"roundrobin","nodes":[{"host":"www.test.com","port":80,"weight":1}]},"script":{"rule":{"root":"451106f8-560c-43a4-acf2-2a6ed0ea57b8","451106f8-560c-43a4-acf2-2a6ed0ea57b8":[["code==403","b93d622c-92ef-48b4-b6bb-57e1ce893ee3"],["","988ef5c2-c896-4606-a666-3d4cbe24a731"]]},"conf":{"451106f8-560c-43a4-acf2-2a6ed0ea57b8":{"name":"uri-blocker","conf":{"block_rules":["root.exe","root.m+"],"rejected_code":403}},"988ef5c2-c896-4606-a666-3d4cbe24a731":{"name":"kafka-logger","conf":{"batch_max_size":1000,"broker_list":{},"buffer_duration":60,"inactive_timeout":5,"include_req_body":false,"kafka_topic":"1","key":"2","max_retry_count":0,"name":"kafkalogger","retry_delay":1,"timeout":3}},"b93d622c-92ef-48b4-b6bb-57e1ce893ee3":{"name":"fault-injection","conf":{"abort":{"body":"200","http_status":300},"delay":{"duration":500}}}},"chart":{}}}') | ||
if [ ! $code -eq 200 ]; then | ||
echo "failed to create route" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ conf: | |
listen: | ||
host: 0.0.0.0 | ||
port: 8080 | ||
dag_lib_path: '' | ||
etcd: | ||
endpoints: | ||
- 127.0.0.1:2379 | ||
|