From 9a1faac8b07b053ed71f32955511163517766a73 Mon Sep 17 00:00:00 2001 From: Darren <27513732@qq.com> Date: Wed, 18 Oct 2023 17:21:53 +0800 Subject: [PATCH] fix --- docker/apphub/README.md | 3 ++- docker/deployment/Dockerfile | 5 +++++ docker/deployment/environment.go | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 docker/deployment/environment.go diff --git a/docker/apphub/README.md b/docker/apphub/README.md index 2183a7b4..45ea11c4 100644 --- a/docker/apphub/README.md +++ b/docker/apphub/README.md @@ -7,4 +7,5 @@ - use virtualenv for pip install requirements.txt - create volumes at dockerfile - EXPOSE port -- process logs should output to docker logs by supervisord \ No newline at end of file +- process logs should output to docker logs by supervisord +- [uvicorn](https://www.uvicorn.org/) load Fastapi \ No newline at end of file diff --git a/docker/deployment/Dockerfile b/docker/deployment/Dockerfile index 8680fa8b..f97bd38b 100644 --- a/docker/deployment/Dockerfile +++ b/docker/deployment/Dockerfile @@ -7,11 +7,16 @@ COPY init_portainer.go / RUN go build -o init_portainer /init_portainer.go RUN chmod +x /init_portainer +#COPY environment.go / +#RUN go build -o environment /environment.go +#RUN chmod +x /environment + # step2: Copy build go program to portainer # Dockerfile refer to: https://github.com/portainer/portainer/blob/develop/build/linux/Dockerfile FROM portainer/portainer-ce:2.19.0 LABEL maintainer="websoft9" LABEL version="2.19.0" COPY --from=builder /init_portainer / +#COPY --from=builder /environment / ENTRYPOINT ["/init_portainer"] \ No newline at end of file diff --git a/docker/deployment/environment.go b/docker/deployment/environment.go new file mode 100644 index 00000000..de332196 --- /dev/null +++ b/docker/deployment/environment.go @@ -0,0 +1,30 @@ +#### go code below + +package main + +#1 wait and get credential +#2 portainer api login +#3 add local if not exist +``` +name: local +url: /var/run/docker.sock +``` + + +curl -X POST -H "Content-Type: application/json" -d '{"username":"admin", "Password":"'$new_password'"}' http://$portainer_ip:9000/api/users/admin/init +curl "http://$appmanage_ip:5000/AppUpdateUser?user_name=admin&password=$new_password" + + + +#### other place + +- add it to Dockerfile +- docker compose health check + +``` +healthcheck: +test: ["CMD", "/healthcheck"] +interval: 1m30s +timeout: 10s +retries: 3 +```