Skip to content

Commit a0373fa

Browse files
authored
feat: support dashboard systemd service unit (#133)
1 parent 91e3091 commit a0373fa

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

.github/workflows/package-apisix-dashboard-rpm-el7.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,50 @@ jobs:
9292
mv output/apisix-dashboard-local-${DASHBOARD_VERSION}-0.el7.x86_64.rpm output/apisix-dashboard-${DASHBOARD_VERSION}-0.el7.x86_64.rpm
9393
9494
- name: Publish Artifact
95-
uses: actions/upload-artifact@v2.2.4
95+
uses: actions/upload-artifact@v2
9696
with:
9797
name: apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm
9898
path: output/apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm
9999
retention-days: 5
100100
if-no-files-found: error
101+
test:
102+
runs-on: ubuntu-latest
103+
needs: build
104+
env:
105+
DASHBOARD_VERSION: 2.8
106+
services:
107+
etcd:
108+
image: bitnami/etcd:3.4.0
109+
ports:
110+
- 2379:2379
111+
- 2380:2380
112+
env:
113+
ALLOW_NONE_AUTHENTICATION: yes
114+
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
115+
steps:
116+
- name: Install podman
117+
run: |
118+
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:testing.list
119+
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:testing/xUbuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_testing.gpg > /dev/null
120+
sudo apt update
121+
sudo apt install podman
122+
123+
- name: Download artifact
124+
uses: actions/download-artifact@v2
125+
with:
126+
name: apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm
127+
128+
- name: Start CentOS 7 container
129+
run: |
130+
sudo podman run -d --name test --systemd true --net host centos:7 /usr/lib/systemd/systemd
131+
sudo podman cp apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm test:/apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm
132+
sudo podman exec test rpm -ivh /apisix-dashboard-${{ env.DASHBOARD_VERSION }}-0.el7.x86_64.rpm
133+
sudo podman exec test systemctl start apisix-dashboard
134+
135+
- name: Test APISIX Dashboard status
136+
run: |
137+
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9000)
138+
if [ ! $code -eq 200 ]; then
139+
echo "failed: failed to install Apache APISIX Dashboard by rpm"
140+
exit 1
141+
fi

dockerfiles/Dockerfile.package.apisix-dashboard

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ ENV ARTIFACT=${ARTIFACT}
1717
COPY --from=APISIX /tmp/build/output /tmp/build/output
1818
COPY --from=APISIX /tmp/dist /tmp/dist
1919
COPY package-apisix-dashboard.sh /package-apisix-dashboard.sh
20+
COPY usr /usr
2021

2122
RUN /package-apisix-dashboard.sh

package-apisix-dashboard.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ fpm -f -s dir -t "$PACKAGE_TYPE" \
2323
--license "ASL 2.0" \
2424
-C /tmp/build/output/apisix/dashboard/ \
2525
-p /output/ \
26-
--url 'https://github.com/apache/apisix-dashboard'
26+
--url 'https://github.com/apache/apisix-dashboard' \
27+
--config-files usr/lib/systemd/system/apisix-dashboard.service \
28+
--config-files usr/local/apisix/dashboard/conf/conf.yaml
2729

2830
# Rename deb file with adding $DIST section
2931
if [ "$PACKAGE_TYPE" == "deb" ]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=apisix-dashboard
3+
Conflicts=apisix-dashboard.service
4+
After=network-online.target
5+
6+
[Service]
7+
WorkingDirectory=/usr/local/apisix/dashboard
8+
ExecStart=/usr/local/apisix/dashboard/manager-api -c /usr/local/apisix/dashboard/conf/conf.yaml

0 commit comments

Comments
 (0)