-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use a configuration file for Canto's init script #2478
base: master
Are you sure you want to change the base?
Conversation
Thanks James. That all looks great. And thanks for the thorough documentation. @vmt25 Vitor do you use the canto-docker-initd script from the Canto repository or have you got your own copy? It's this file that I'm thinking about: https://github.com/pombase/canto/blob/master/etc/canto-docker-initd James has done work to tidy it up and make it more reusable. Will changing cause any problems for you? |
Hi Kim, We use an edited version of canto-docker-initd script, which just has a different value (location) for the CANTO_SPACE variable. Could you please confirm whether my understanding of the changes is correct: The bigger issue is that the setup of how canto is run by the system was done by another person and I don't really know how your systemd setup would play out. Apologies if some/all of this does not make much sense but, like I said, I am not a IT person/coder |
Hi Vitor. If you are happy to have your own copy of the scripts then you could just ignore these changes.
Yep. The main thing James has done is to combine the two scripts into one. That makes sense because one of them does very little except for executing the other script. So James has removed Probably the new versions from James would work on your server after editing the new settings file but if your current script works for you there is probably no reason to change. I'm very happy to have a Skype chat about this sometime. |
@vmt25 Just to add a bit more in response:
Under this new system, you would need to set this location value in
The new service script defaults to port number 5000, but the port number can be configured in the I'm not sure I understand the part about "no defined log for 'stop' (and no instructions for restart?)". The new script logs output to a file called
The new script doesn't require systemd; the script is just a plain init script (technically a SysV-style init script). If your team followed the previous instructions for installing the service using |
@kimrutherford I think there might be a typo in the default path for |
PomBase doesn't use Docker so we don't have a |
That sounds like a sensible default. I guess underscores are more conventional than hyphens for directory names. I'll amend the pull request. |
@kimrutherford One more question: I've just checked the documentation for Starman, and it mentions that Starman uses the stop)
pid=`/bin/cat $CANTO_SPACE/$PID_PATH`
echo stopping $pid
(cd $CANTO_SPACE; docker exec canto kill -TERM $pid)
;; Does this cause different behaviour, or would |
Good catch! The documentation says they are different. I've just read the docs (twice) and I think the change we need is to add I've made a PR with my suggested change: jseager7#7 |
@kimrutherford I think this PR is almost ready now. I've just noticed one more thing from testing on our demo server: the I assume that there should be something logged there, since the command that runs Canto should at least append the date to the file:
Do I need to |
The log file might be ending up somewhere unhelpful. You can probably find it with:
which will search the whole filesystem.
It should create the file or fail if it doesn't have the correct permissions.
I think so. It's probably in the home directory of the user running the script. Which is probably root. :-/ To control this better you could move the
which will put the log in Or give a full path to the log file:
(also untested) I don't have a preference as to which is best. |
I'd opt for providing an absolute path to the log file, like the second option you suggested. I'll test this locally and then commit here once it's working. |
Looks like the log file is working with an absolute path. Now I can also see the handling of the new signal flags:
|
(Fixes #2476)
This PR adds a configuration file for the
canto-docker-initd
script. The configuration file is atetc/canto.defaults
.On the server, the configuration file is copied to
/etc/default/canto
. The init script will source the file and use any (uncommented) variables in the file to override the default values for variables in the script. Currently the file can override Canto's port number, base directory, number of workers for Server::Starter, and the path to the PID file for Server::Starter (although technically it can override any named variable).I've removed the intermediary example script that only existed to run the actual service script (formerly at
etc/example-canto-docker-init.d
) since there's no need to pass arguments into the script now. Note that the default values incanto-docker-initd
are not the same as in the example script, specifically the port number. I hope this doesn't affect any other users of Canto, like FlyBase.I've updated the documentation at
etc/canto-init.d.md
with instructions for the new configuration file, and instructions for installing the init script using systemd.@kimrutherford You might want to double-check the documentation for any mistakes or omissions. I've tested the script with the configuration file on a virtual machine and it all seems to work fine.
One other thing we might want to resolve at this point is the differences between the PomBase init script and this init script. For example, the PomBase script has an additional environment variable,
DBIC_TRACE=0
, passed into the command that runs Server::Starter, and it also usestee
for the log file instead of appending:Should any of these changes be applied to this init script? I'm guessing not, since this script was authored later.