Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move services out of primary config file into a services folder #85

Closed
quantumzedno opened this issue Jun 8, 2022 · 12 comments
Closed
Labels
enhancement New feature or request

Comments

@quantumzedno
Copy link

I'd like to request a feature where in instead of configuring all of the services as part of the primary config file, that the primary config file pull them from any .yml file in a given services folder.

I've been playing around with services all afternoon and got 3 working, after which I commented them all out in the config file in order to work on a 4th (logging was getting very busy) only to realize that the server overwrite / deleted all commented lines in the config file thus resulting in me needing to start from scratch on the 3 I had already got working.

Having each service be it's own file would allow for easy enabling/disabling by renaming the files to a non .yml extension and would also just keep everything a lot more organized when you end up with dozens of monitored services (my goal is to use this to monitor all server based applications we host eventually which could end up being quite a lot)

@quantumzedno quantumzedno added the enhancement New feature or request label Jun 8, 2022
@JosephKav
Copy link
Collaborator

I really don't see any benefit to doing this. I much prefer having it all in one file as it makes comparisons/copying easier and it'd mean potentially loads of tiny files. I'd much rather spend time looking into how I'd get commented out lines to be kept on save.
There's really no need to comment out services if it's just for testing as you can -test.service

@quantumzedno
Copy link
Author

Id say there is some benefit to it if you get into automating writing config files (purely speculative) in that i could overwrite a single service file without needing to parse the entire config first. but that may not actually be needed depending on how handling of pulling current versions off servers would work (I haven't gotten that far yet) but yea, my main struggle was with comments being removed so ill look into using the test service but ideally not deleting comments would be good as id at the very least like to be able to make notes in the config for how specific things work for future reference

Thank you so much again!

@quantumzedno
Copy link
Author

could a middle ground solution be having a service directory and you can have multiple services files in it, but each file could contain 1 or more services, would allow what you are saying where you can have them all in a single file, but also allow for breaking them up to fit use cases such as the one I outlined (this is similar to how applications such as apache handle site configs)

@quantumzedno
Copy link
Author

quantumzedno commented Jun 9, 2022

It is split into several files forming the configuration hierarchy outlined
below, all located in the /etc/apache2/ directory:

   /etc/apache2/
   |-- apache2.conf
   |       `--  ports.conf
   |-- mods-enabled
   |       |-- *.load
   |       `-- *.conf
   |-- conf-enabled
   |       `-- *.conf
   `-- sites-enabled
           `-- *.conf

@samcro1967
Copy link

I also would prefer all service configs in one file. I use -test.service quite a lot when adding new services where I only want to test that service. Maybe another option could be adding a service option called active (or something more creative) with a value of true or false so that it is only added to the dashboard and checks if true. If not present, defaults to true. That way it can be kept in the config file at all times and set to false.

Maybe a quick alternative to comments could be to just add it to the yaml config and do nothing with it.

  Argus:
    comment:  This is a test comment.
    type: github
    url: release-argus/argus

@JosephKav
Copy link
Collaborator

I agree with samcro. I just merged a change giving that active: false option to services. Thinking I'll do the comment suggestion as well since it'd not a lot of work and some people may like/want it.

Supporting multiple files would be a pain from a saving perspective as it'd have to keep track of where each service is stored and then go through the list of all services and check which others may be in that file. Then there's the issue of defaults/settings/notify/webhook which would have all have to be in the same file (each type) and then we'd need to store the location of those files. I'm just gonna keep it how it is with 1 file for the config for the time being

@samcro1967
Copy link

Tested both active and comment and both are working for me. I was envisioning if a service was set as not active, it would also not display the card. Not sure if that is an easy ask. Or maybe a separate Boolean parameter called visibile? Although not sure why one would want it active and then hidden from the dashboard.

@JosephKav
Copy link
Collaborator

Tested both active and comment and both are working for me. I was envisioning if a service was set as not active, it would also not display the card. Not sure if that is an easy ask. Or maybe a separate Boolean parameter called visibile? Although not sure why one would want it active and then hidden from the dashboard.

Had a bit of a rethink on how to hide the !active services and got it working cleanly (imo). I've done a rebase and modified the original commit that added active. active: false should now hide the service completely from the web ui, but it'll still be visible in the config file after saves as well as at Status/Configuration in the web ui

@samcro1967
Copy link

Test latest commit and it has removed a test services from the dashboard.

@JosephKav
Copy link
Collaborator

JosephKav commented Jun 19, 2022

Test latest commit and it has removed a test services from the dashboard.

Config? Or it's not displaying a service that is active: false, so is working

@samcro1967
Copy link

samcro1967 commented Jun 19, 2022

I guess my response was a little ambiguous. It worked as expected. It persisted in the config with active set to false, but is not displayed on the dashboard.

@JosephKav
Copy link
Collaborator

Closing this because I don't see value in supporting this. I much prefer having everything in one file. It'd require a rewrite in the saving as every config section would need to be tagged with the file it came from and then only those written to that file. Added active: false for disabling without removing from the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants