anyproto / any-sync-dockercompose

docker-compose for testing any-sync
MIT License
234 stars 29 forks source link

Do not hardcode the numbers of sync nodes #75

Open hellodword opened 1 week ago

hellodword commented 1 week ago

Have you read a contributing guide?

Clear and concise description of the problem

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/.env.common#L22-L38

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/docker-generateconfig/anyconf.sh#L33-L35

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/docker-generateconfig/anyconf.sh#L39-L41

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/docker-generateconfig/anyconf.sh#L55-L56

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/docker-generateconfig/processing.sh#L29

https://github.com/anyproto/any-sync-dockercompose/blob/9609edfaecd2c2ee4859653c8780cf3e40410884/docker-generateconfig/processing.sh#L39-L46

Suggested solution

I'm not sure, maybe jinja2 is a good choice?

Alternative

No response

Additional context

No response

fb929 commented 6 days ago

this will be too complicated: as it will also require simultaneous templating of docker-compose.yml files, .env, and the generator, along with post-processing configurations. moreover, this does not align with the goals of this repository

hellodword commented 6 days ago

I think it is already too complicated. There are too many shell scripts and Python scripts, and hardcoding makes customization difficult.

Furthermore, are three nodes by default necessary for self-hosted and all-in-one users? Are there any design reasons for this?

Meanwhile, env.py and setListenIp.py are dynamic, they're good starts for removing hardcodings:

https://github.com/anyproto/any-sync-dockercompose/blob/82b9ec1ce96f5bb2ae56ff036f31a8aa0ccf72e7/docker-generateconfig/setListenIp.py#L57-L61