Open Staubgeborener opened 1 month ago
Huh that's weird, I cant recreate the issue. :/ Could you please tell me which url you specified in the webhook settings?
I found the issue, there was an old .doco-cd.yml in my GitHub (remote!) repository, which has this "test config". In my local repository was the correct .doco-cd.yml. I updated the remote one with the content i mentioned above and it seems to work more or less. I thought doco-cd is just using the local one, my bad.
Like i said i am using a gatus-compose.yml for testing. The content is very basic:
version: "3.9"
services:
gatus:
container_name: gatus
image: twinproduction/gatus:v5.1.0
restart: always
network_mode: host
volumes:
- ./config:/config
When i change the version number (like from gatus:v5.5.0
to gatus:v5.1.0
) i would expect doco-cd to get this new version number from my remote repo and update the gatus-copmpose.yml on my local repository. But what actually happens:
user@server:~$ docker logs --since 1h doco-cd
{"time":"2024-10-12T07:14:35.231535779Z","level":"debug","msg":"received webhook event","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5"}
{"time":"2024-10-12T07:14:35.231942414Z","level":"info","msg":"preparing stack deployment","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops"}
{"time":"2024-10-12T07:14:35.231960162Z","level":"debug","msg":"cloning repository to temporary directory","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops","url":"https://github.com/Staubgeborener/gitops.git"}
{"time":"2024-10-12T07:14:35.231971452Z","level":"debug","msg":"repository is private","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops"}
{"time":"2024-10-12T07:14:35.799740785Z","level":"debug","msg":"repository cloned","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops","path":"/tmp/Staubgeborener/gitops"}
{"time":"2024-10-12T07:14:35.799781207Z","level":"debug","msg":"retrieving deployment configuration","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops"}
{"time":"2024-10-12T07:14:35.800159658Z","level":"debug","msg":"deployment configuration retrieved","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops","stack":"test","reference":"refs/heads/main","config":{"Name":"test","Reference":"refs/heads/main","WorkingDirectory":".","ComposeFiles":["gatus-compose.yml"],"RemoveOrphans":true,"ForceRecreate":false,"ForceImagePull":false,"Timeout":180,"BuildOpts":{"ForceImagePull":false,"Quiet":false,"Args":null,"NoCache":false}}}
{"time":"2024-10-12T07:14:35.807146283Z","level":"info","msg":"deploying stack","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops","stack":"test","reference":"refs/heads/main"}
{"time":"2024-10-12T07:14:45.918802237Z","level":"info","msg":"deployment successful","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops"}
{"time":"2024-10-12T07:14:45.918945369Z","level":"debug","msg":"cleaning up","job_id":"3201f85f-c1c5-4562-9067-f53b15b391f5","repository":"Staubgeborener/gitops","path":"/tmp/Staubgeborener/gitops"}
checking the gatus-compose.yml locally:
user@server:~$ cat ./gatus-compose.yml
version: "3.8"
services:
gatus:
container_name: gatus
image: twinproduction/gatus:v5.5.0
restart: always
network_mode: host
volumes:
- ./config:/config
Still the old gatus:v5.5.0
and not gatus:v5.5.0
like in my remote repository. But doco-cd created and deployed a gatus docker container with twinproduction/gatus:v5.1.0
. I thought doco-cd would also adjust the local compose file? So to summarize and maybe close this issue: With doco-cd i don't need any local copmpose file anymore, i just do my stuff in a gitops way on my remote repository and doco-cd pulls this if something has changed and deploys everything by itself? If yes, how do i handle config files - for example, the gatus container is deployed. but is not running because its missing the config file.
When a job gets triggered, doco-cd clones the remote repository, then reads the config file(s) and deploys from the branches you specified there. So if you need changes to be deployed, you need to push them first to your remote.
There is also the force_image_pull
option in the deploy settings, that tells docker to always pull the image, even if the tag is the same as the deployed state (useful if you use e.g. latest
), otherwise it gets skipped.
It depends, if you only need read access, you could use it like you specified it or docker configs:
services:
gatus:
container_name: gatus
image: twinproduction/gatus:v5.5.0
restart: always
network_mode: host
configs:
- source: my_config
target: /config
configs:
my_config:
file: ./config
Otherwise you need to use docker volumes
services:
gatus:
container_name: gatus
image: twinproduction/gatus:v5.5.0
restart: always
network_mode: host
volumes:
- config:/config
volumes:
config:
If you try to mount local directories for write access that won't work since the mount happens inside the doco-cd container and the cloned repo gets cleaned up after deployment.
Sorry for deleting the post, that was bad timing.
I will close this issue and play around with doco-cd.
I need to reopen this issue as i don't get the config section to work. In my remote repository is a folder "gatus" which has a docker-compose.yml and a config.json file.
This is my .doco-cd.yml:
name: gatus
reference: refs/heads/main
working_dir: gatus
compose_files:
- docker-compose.yml
This is the compose file:
services:
gatus:
container_name: gatus
image: twinproduction/gatus:v5.5.0
restart: always
network_mode: host
volumes:
- config:/config
volumes:
config:
This is working, doco-cd pulls the content and deploys the container.
Nope nothing, if i check the docker logs i see that there is a error regarding "no config file found". Do i need the config file local? Or remote? Or both? I can only tell that this container is working flawlessly with the config but as soon i try to deploy it via doco-cd i get those "config not found" errors.
Right now I assume that I need the config only remote. If this is true how can I setup my credentials and tokens (for example .env files) of those needs to be remote?
Seems like there is a weird bug/behavior in docker when files are mounted from inside a container to another. I maybe know why and how to work around that issue, but let me investigate it further.
First of all, this is my
docker-compose.yml
:Behind port 82 is a reverse proxy which is listening for webhooks on a subdomain. Lets call it
sub.domain.com
This is my docker log for doco-cd:
My triggered webhook gets the error code 500 in GitHub
Headers:
Body:
.doco-cd.yml:
gatus-compose.yml
is my "test compose" file.All files, docker-compose.yml (doco-cd), gatus-compose.yml, .doco-cd.yml are in the same directory. I can't see any connection to test.compose.yml.