diff --git a/.github/workflows/debian-package.yml b/.github/workflows/debian-package.yml index 20da994..6d2bb74 100644 --- a/.github/workflows/debian-package.yml +++ b/.github/workflows/debian-package.yml @@ -7,7 +7,8 @@ on: - 'v*.*.*' jobs: build: - runs-on: self-hosted + #runs-on: self-hosted + runs-on: ubuntu-latest steps: - name: Check out repository code uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index 6329b12..ff9c6b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ COPY . . ENV GO111MODULE=on -RUN make change-version-number set-production starlight-proxy-for-alpine && mkdir ./out/data +RUN make change-version-number set-production starlight-proxy-for-alpine #CMD ["/go/src/app/out/starlight-proxy"] FROM alpine:3.12 AS starlight-proxy @@ -20,7 +20,9 @@ FROM golang:1.18 AS starlight-cli-build WORKDIR /go/src/app COPY . . -RUN make change-version-number set-production ctr-starlight-for-alpine && mkdir ./out/data +ENV GO111MODULE=on + +RUN make change-version-number set-production ctr-starlight-for-alpine FROM alpine:3.12 AS starlight-cli diff --git a/cmd/starlight-proxy/main.go b/cmd/starlight-proxy/main.go index d584daf..8c5d9fb 100644 --- a/cmd/starlight-proxy/main.go +++ b/cmd/starlight-proxy/main.go @@ -77,7 +77,6 @@ information about Starlight, please visit our repository at https://github.com/m // ---- &cli.StringFlag{ Name: "host", - Aliases: []string{"h"}, EnvVars: []string{"STARLIGHT_HOST"}, DefaultText: cfg.ListenAddress, Usage: "host", diff --git a/demo/chart/templates/NOTES.txt b/demo/chart/templates/NOTES.txt index 27bacab..1da818b 100644 --- a/demo/chart/templates/NOTES.txt +++ b/demo/chart/templates/NOTES.txt @@ -9,47 +9,44 @@ For more info, please visit https://github.com/mc256/starlight __/ | |___/ -{{- if .Values.registry.enabled}} -You have enabled container registry. -{{- end}} {{- if .Values.ingress.enabled }} Get the application URL by running these commands: - - {{ range $host := .Values.ingress.hosts }} + {{- range $host := .Values.ingress.hosts }} Starlight Proxy : http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }} {{- if $.Values.registry.enabled }} Container Registry : http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}/v2 {{- end }} - {{ end }} - + {{- end }} + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "starlight.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP echo $SERVICE_IP Please point your domain to $SERVICE_IP in your hosts file or DNS server. - The maximum upload size of the Nginx ingress has set to {{ index .Values.ingress.annotations "nginx.ingress.kubernetes.io/proxy-body-size" }}. {{- else }} You have not enabled ingress. {{- end }} -{{ if .Values.postgres.enabled }} -You have enabled local postgresql. -In production environment, please consider using an external postgresql with porperly configured security and parition large tables. -{{ if .Values.adminer.enabled }} -A light-weight database management tool Adminer has been enabled. +{{- if .Values.postgres.enabled }} +-------------------------------------------------------------------------------- +You have enabled a local PostgresQL database. +In production environment, please consider using an external postgresql with properly configured security and partition. +{{- if .Values.adminer.enabled }} - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "starlight.fullname" . }}-adminer 8080:8080 +-------------------------------------------------------------------------------- +A light-weight database management tool Adminer has been enabled, to view the database content: -{{ end }} -{{ end }} + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "starlight.fullname" . }} 8080:8080 + open it in http://localhost:8080/ and the default login credential is 'postgres'. + +{{- end }} +{{- end }} {{ if .Values.edge.enabled}} You have enabled edge server. - The purpose of this deployment is to keep the Starlight CLI image on every edge node, so that whever the user uses initContainer, there is a starlight CLI container for that. @@ -58,8 +55,9 @@ You still need to install the Starlight daemon (containerd snapshotter) and enab ON THE WORKER NODE: 1. Install the Starlight daemon - wget https://github.com/mc256/starlight/releases/download/v0.2.3/starlight_0.2.3_amd64.deb - sudo dpkg -i starlight_0.2.3_amd64.deb + echo ARCH=$(dpkg --print-architecture) # one of amd64, arm64, armhf + wget https://github.com/mc256/starlight/releases/download/v{{ .Chart.Version }}/starlight_{{ .Chart.Version }}_$ARCH.deb + sudo dpkg -i starlight_{{ .Chart.Version }}_$ARCH.deb sudo systemctl enable starlight sudo systemctl start starlight @@ -80,10 +78,8 @@ ON THE WORKER NODE: 3. and restart the container sudo systemctl restart containerd - {{ end}} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "starlight.fullname" . }}' diff --git a/demo/chart/templates/daemonset-edge.yaml b/demo/chart/templates/daemonset-edge.yaml index 88f495f..1b650be 100644 --- a/demo/chart/templates/daemonset-edge.yaml +++ b/demo/chart/templates/daemonset-edge.yaml @@ -37,7 +37,8 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.edge.repository }}:{{ .Values.edge.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.edge.imagePullPolicy }} - command: {{ .Values.edge.command }} + command: + {{- toYaml .Values.edge.command | nindent 12 }} resources: {{- toYaml .Values.edge.resources | nindent 12}} env: diff --git a/demo/chart/templates/deployment-proxy.yaml b/demo/chart/templates/deployment-proxy.yaml index fdd9c3c..580675c 100644 --- a/demo/chart/templates/deployment-proxy.yaml +++ b/demo/chart/templates/deployment-proxy.yaml @@ -54,16 +54,20 @@ spec: port: 8090 resources: {{- toYaml .Values.starlightProxy.resources | nindent 12}} + #command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 60 ; done"] command: ["/opt/starlight-proxy"] - args: - - --registry - - {{ .Values.starlightProxy.defaultRegistry | quote | default "http://container-registry.default.svc.cluster.local:5000" }} - - --log-level - - {{ .Values.starlightProxy.logLevel | quote | default "info" }} - - --postgres - - {{ .Values.starlightProxy.dbConnection | quote | default "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" }} - - --port - - "8090" + # args: ["--config", "/etc/starlight/proxy_config.json"] + env: + - name: STARLIGHT_HOST + value: "0.0.0.0" + - name: STARLIGHT_PORT + value: "8090" + - name: LOG_LEVEL + value: {{ .Values.starlightProxy.logLevel | quote | default "info" }} + - name: DB_CONNECTION_STRING + value: {{ .Values.starlightProxy.dbConnection | quote | default "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" }} + - name: REGISTRY + value: {{ .Values.starlightProxy.defaultRegistry | quote | default "http://container-registry.default.svc.cluster.local:5000" }} {{- if .Values.postgres.enabled }} ############################################################ - name: starlight-metadata diff --git a/demo/chart/templates/deployment-registry.yaml b/demo/chart/templates/deployment-registry.yaml index ffc45b3..61fe291 100644 --- a/demo/chart/templates/deployment-registry.yaml +++ b/demo/chart/templates/deployment-registry.yaml @@ -1,3 +1,4 @@ +{{- if .Values.registry.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -68,3 +69,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end}} \ No newline at end of file diff --git a/demo/chart/values.yaml b/demo/chart/values.yaml index d7143d0..4f72c4a 100644 --- a/demo/chart/values.yaml +++ b/demo/chart/values.yaml @@ -13,7 +13,7 @@ starlightProxy: # dbConnection specify # Default is set to the postgres instance in the same deployment. - dbConnection: "postgres://postgres:postgres@postgres:5432/starlight?sslmode=disable" + dbConnection: "postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable" # logLevel is the log level for the proxy, options are: trace, debug, info, warn, error, fatal logLevel: "info" # defaultRegistry is the default registry when the full image name is not specified