Create an installer with a flag (argument) #134
Replies: 9 comments
-
I would like to have tracker-configuration file to be specified by some schema, and configured over a management API. The exception should be the core configuration options of the tracker. Settings that guide the access to the trackers management API (such as the management socket, or the public key of the administrator). These should be passed-in either by launch arguments, or picked up from environmental variables. Once the tracker has been launched, then all configuration should happen over it's management API. For example, The torrust index client could then be extended with an interface for management of the Tracker. |
Beta Was this translation helpful? Give feedback.
-
Ok, cool! Just a couple of ideas:
- Core settings could be the ones that require a service restart. For
example the socket, as you mentioned.
- We can also use a mounted file for settings especially for secrets. I
read on the docker docs that is safer than env vars. I have to read more
about that.
- We need to think where to store the default values. If you are planning
to move not core setting to the DB we could prefill the database with them,
but maybe it's better to hard code default values and use the DB only if
you want to override them.
…On Sat, 3 Dec 2022, 12:06 Cameron Garnham, ***@***.***> wrote:
I would like to have tracker-configuration file to be specified by some
schema, and configured over a management API.
The exception should be the core configuration options of the tracker.
Settings that guide the access to the trackers management API (such as the
management socket, or the public key of the administrator). These should be
passed-in either by launch arguments, or picked up from environmental
variables.
Once the tracker has been launched, then all configuration should happen
over it's management API.
For example, The torrust index client could then be extended with an
interface for management of the Tracker.
—
Reply to this email directly, view it on GitHub
<#122 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOLQDEO6HE4ZG3KXHKVMDWLMZTHANCNFSM6AAAAAASRWUPS4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hmm... I think that server should be configured via it's management API, including for any setting that may need to have the server restarted. The server can maintain a list of setting that are going to be applied on next startup. The core settings should be limited to the settings that are needed for the initial access, or override access, to the management api.
We need some sort of database-connection-configuration, this should be limited to the setting required for the server to connect to it's database. This file should be in some sort of internal format. And created and managed by the management api.
All other settings should be stored inside the database, including what is the default values, and if a setting is was set explicitly or as left as a default. Even if that setting can only be applied on the next load of the server. When an default value is updated, it should be in a form of database migration, and appropriately deal with the old defaults (i.e. leave them as they are and add a old-default-migration-xyz flag or migrate the value to the updated value). The management schema that the server gives to the clients should always accurately describe the current default values, and should be versioned by the db-migrations. An additional schema should be provided to the client that describes the history the settings-db-migrations. (i.e. what value was updated to and when). Over the management api, Clients should be able to review the changes to the settings by the migrations of the server to a new version, and keep/apply/or/revert new updated defaults. |
Beta Was this translation helpful? Give feedback.
-
hi @da2ce7, this is an interesting discussion. I'm going to ask you some questions to ensure I understand your proposal. Questions
Maybe It would be better if you explain it to us in the next meeting until we have the same understanding and we can write down the final proposal. It could maybe even be a BEP. |
Beta Was this translation helpful? Give feedback.
-
When the application loads it has the following goals, in this order:
Each step takes a different form of configuration.
The configuration for the Management API is provide by the Host. (i.e. Environmental Variables, Command Arguments, or Injected Configuration Files, it dose not matter). The app somehow needs to be supplied with:
If the application has some persistent private storage. This can be used to keep a cached copy of the database configuration. (If not supplied by the host, but the management api).
|
Beta Was this translation helpful? Give feedback.
-
Good idea, but I will add it to my own project as a flag, so that it creates it when asked. |
Beta Was this translation helpful? Give feedback.
-
hi @Power2All, yes that was my first idea, running something like:
In fact, I thought it could have a silent mode and an interactive mode with a nice console assistant than can generate the final I decided to use a different binary just to skip parsing the arguments for the time being in the main. But then when I implemented it I realized that it made things harder in the building phase. You need to build both binaries in the Dockerfile and overite the entry-point. SO definitively I would use a flag. I was trying to sue the application to give me the default configuration file instead of building it by my self because the format could change and I will need to re-write the code to generate the configuration. |
Beta Was this translation helpful? Give feedback.
-
We can define a more concrete behaviour: It generates the default
It prints the default
It runs an interactive installer that can generate the final configuration (long-term feature):
|
Beta Was this translation helpful? Give feedback.
-
I've fixed my Docker deployment. |
Beta Was this translation helpful? Give feedback.
-
When you run the tracker the first time, you see this output:
Running the tracker without the setting file has a side effect. It creates a setting file with the default configuration.
I suggest showing a message like this:
That "install" binary could be extended in the feature to be an installation assistant if you run it in interactive mode.
But the main reason for this change is I'm working on setting up docker configuration to automate deployments for the Turrust tracker and running a process that returns an error that could lead to errors while building docker images or others tasks.
On the other hand, I always prefer to be explicit about side effects. Besides, showing an error the first time you run a tracker could make people think the application is not good.
If you do not like that approach, the second option could be to ask the user if they want to create that file, but I do not like that option because it forces the app to be always interactive. We should have added an option to avoid that question in this case and return an error message with an error return value (not a panic message).
Beta Was this translation helpful? Give feedback.
All reactions