fabrizio2210 / docker_volume_synchronizator Goto Github PK
View Code? Open in Web Editor NEWA container that syncronize volumes
License: MIT License
A container that syncronize volumes
License: MIT License
Instead of issuing the command "docker service ps .." command in order to check if some variation occurred, it should be used the endpoint /events exposed by the unix socket.
This approach will reduce a lot the CPU consumed.
In first attempt, /events can be used just to see if some changes occurred and then use the same command as before to verify if interesting changes occurred.
After a better approach can be use, filtering on which events are interesting.
Hi,
I've tried running this Docker service (https://hub.docker.com/r/fabrizio2210/docker_volume_synchronizer) as I want to sync two data volumes, but ran into and error. In the logs I can see:
++ service=core_sync_squid
++ '[' -z core_sync_squid ']'
+++ findValueByLabel core_sync_squid async.service
+++ _my_service=core_sync_squid
+++ _label=async.service
++++ docker service ls --format '{{print .Name}}'
+++ for _service in $(docker service ls --format '{{print .Name}}')
+++ '[' core_sync_squid == core_squid ']'
+++ for _service in $(docker service ls --format '{{print .Name}}')
+++ '[' core_sync_squid == core_sync_squid ']'
+++ docker service inspect core_sync_squid '--format={{ index .Spec.Labels "async.service"}}'
+ set +x
+++ return
++ serviceToSync=
++ '[' -z '' ']'
++ echo 'Service to sync not found'
Service to sync not found
++ exit 2
cat: '/var/run/*.pid': No such file or directory
If I run this command from the command prompt:
docker service inspect core_sync_squid '--format={{ index .Spec.Labels "async.service"}}'
I get no results, which I would expect to see as it replicates the log. However, if I run:
docker service inspect core_sync_squid --format="{{ index .Spec.TaskTemplate.ContainerSpec.Labels \"async.service\" }}"
then it returns :
squid
which is what I think the script is expecting to see. So, I think that there may be an error on line 253, of src/lib.sh could be incorrect.
I've tried changing this, and building the docker container locally, but a native build on ARM hardware fails at RUN [ "cross-build-start" ]
with an exec error, so presumably this is incorrect architecture.
If I run the build on my amd64 hardware, it compiles successfully, but I get the same exec error when the node is deployed to the ARM hardware I'm running it on.
Any help would be greatly appreciated.
The watchdog is identifying changes although they are not related to the service.
The problem is that other services are triggering events and the watchdog doesn't filter by name of the service.
For example the following event is triggering the watchdog
{"status":"exec_die","id":"cc928e18ce819b5222464bc70e73c6d9f31e8c6bf0ff9b9a2cdfb72c95a140d5","from":"fabrizio2210/zabbix-server-mysql-alpine:armhf","Type":"container","Action":"exec_die","Actor":{"ID":"cc928e18ce819b5222464bc70e73c6d9f31e8c6bf0ff9b9a2cdfb72c95a140d5","Attributes":{"com.docker.stack.namespace":"Zabbix","com.docker.swarm.node.id":"bjjftibfnf5w38400ub4b1k3g","com.docker.swarm.service.id":"p6v8m5qcwpmqr2bdrh5lx0zj3","com.docker.swarm.service.name":"Zabbix_zabbix-server","com.docker.swarm.task":"","com.docker.swarm.task.id":"q17kmb507ddoxqulpf28xefyw","com.docker.swarm.task.name":"Zabbix_zabbix-server.1.q17kmb507ddoxqulpf28xefyw","com.zabbix.company":"Zabbix SIA","com.zabbix.component":"zabbix-server","com.zabbix.dbtype":"mysql","com.zabbix.description":"Zabbix server with MySQL database support","com.zabbix.os":"alpine","execID":"3a866dc33edeb6a403b2e67ed7f2181688863794183105f373e52403f41eb0ec","exitCode":"0","image":"fabrizio2210/zabbix-server-mysql-alpine:armhf","io.balena.architecture":"rpi","io.balena.device-type":"raspberry-pi","io.balena.qemu.version":"4.0.0+balena-arm","maintainer":"Alexey Pustovalov \[email protected]\u003e","name":"Zabbix_zabbix-server.1.q17kmb507ddoxqulpf28xefyw","org.label-schema.build-date":"","org.label-schema.description":"Zabbix server with MySQL database support","org.label-schema.docker.cmd":"docker run --name zabbix-server-mysql --link mysql-server:mysql -p 10051:10051 -d zabbix-server-mysql:alpine-4.2.5","org.label-schema.license":"GPL v2.0","org.label-schema.name":"zabbix-server-mysql-alpine","org.label-schema.schema-version":"1.0","org.label-schema.url":"https://zabbix.com/","org.label-schema.usage":"https://www.zabbix.com/documentation/4.2/manual/installation/containers","org.label-schema.vcs-ref":"","org.label-schema.vcs-url":"https://git.zabbix.com/scm/zbx/zabbix.git","org.label-schema.vendor":"Zabbix LLC","org.label-schema.version":"4.2.5"}},"scope":"local","time":1601755506,"timeNano":1601755506720369721}
The file to change is https://github.com/fabrizio2210/Docker_Volume_Synchronizator/blob/master/src/wd_conf.sh
in line 61
Hello,
thank-you for your work.
can I help you to make a version for use without swarm and just for syncronise two folders via docker.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.