You are here
I'd like to edit confconsole in order to support one application of mine as "UI", but I am a bit confused about the steps. Do you know if there is any howto/guide, please?
I'd like to use a TKL application to deploy one C# application of mine with Mono. This C# application is currently executed at boot as crono job on a TKL-core virtual machine with Mono installed. However, as it is, there is no way to check mono application status and/or check/edit its configuration.
Therefore, I thought to edit Turnkey Linux Configuration Console in order to allow users to check C# application status and configuration.
In order to do that, I found some discussion in the forum about confconsole, but I am not much skilled in setting-up a Debian/Ubuntu and I think I am missing some (to be optimistic) points.. sorry :(
As far as I understood, I have to edit confconsoly.py in order to add wanted new features. Then, which steps should I take to achieve my goal?
Sorry for the newbie questions and thanks in advance for your help!
All the best.
P.S. I forgot to mention that i am currently using TKL-core 14.1 for AMD64.
Can you please clarify what you are trying to do?
If you want to just change the text that confconsole displays then edit /etc/confconsole/services.txt (edit/add it to the overlay if you are building an app from scratch).
Further if you think that your app would be useful for others, is ready for prime time and is open source then please consider releasing it as a TurnKey appliance. I can help you out there if you want...
Sure
To clarify, this C# application reads data from some sources, do some process, and pushes processed data to some data bases. Both sources and data bases are specified by two configuration files. Additionally, this C# application produce a log of its actions stored in a file log.
I'd like to show in confconsole the current sources, current data bases, and the tail of file log. Is it possible?
As far as I understood services.txt doesn't do any magic.. unless I store those informations in environment variables, whose enviroment variables should be populated with a script in inithooks directory.. Am i right? I do not know if there is any easier and more elegant way..
I already thought about releasing the Turnkey appliance, but this C# application is not open source.. :(
However, I aim to release an appliance for debugging Mono applications remotely, if it may be usefull ;) and any help would be really appreciated, thanks!
Unless you know python
Your ideas sound reasonable but TBH I haven't played with it much myself so you might need to do some trial and error...
PS I removed that other post as it was just from a spammer.
TBH, I have never developed
TBH, I have never developed with python, but confconsoly.py seems as hard as any other uncommented script to understand :-P.
For example, if I understood correctly, to add another sub-menu in "advanced menu", it should be enough to:
1. add another line which appends a new item in "_get_advmenu" (e.g. items.append(("NewSubMenu", "NewSubMenu Brief Description"));
2. add a new function "_get_ifconfNEW(self, ifname)" which can be based on "_get_ifconftext" as template;
3. add "self._get_ifconfNew(self.ifname)" in "ifconf" (e.g.
).
Am I right?
Instead, if I'd like to use "services.txt" to add my new features, I should edit services.txt in something like:
Am I right?
Howerever, is it right my guess that $newVariable should be an enviroment variable of linux? Otherwise, how do I define such $newVariable?
It is a lovely news that you are currently tweaking confconsole! ;-)
P.S. Thanks for removing the spammer, and, of cource, for your help!
Sounds like a reasonable plan.
I suggest that you have a bit of a play (using trial and error) and see how you go. Post your progress and if you get totally stuck I'll see if I can get someone to help steer you in the right direction.
Sorry I can't be of more help, I'm just not 100% sure myself...
Definitely, I'll keep this
Definitely, I'll keep this post updated ;-)
Good, if it sounds reasonable to you as well, I'm going to start to play!
Do not worry, if you do not know actually how confconsole works, you know much more than me.
BTW, do you know if to see the results of edit is enought to re-execute the inithooks? (e.g. by rebooting the virtual machine?)
Thanks again for your support!
Awesome.
As for applying your changes, confconsole runs as a daemon so restarting that should be sufficient. I.e.:
Rebooting the VM will definitely do it though!
Super! Jeremy, finally, I
Super!
Jeremy, finally, I have managed to obtain what I was aiming to! Of course, it does not have any whistle or bell but, it do its job.
I was aiming to add a sub-menu to confconsole which shows some configuration parameters from certain files; Here, the stepes that allowed my to do so:
1. Add the new Sub-menu to advanced menu in confconsole
Edit confconsole.py method "_get_advmenu" by adding your new sub-menu item to the advanced menu of confconsole. For example, listening below represents the code to add "my app" sub-menu to the advanced menu.
2. Add the mothod called when sub-menu is selected
Edit confconsole.py by adding a new method which is called when sub-menu is selected. It is important to name well this method as, as far as I understood, it have to be called "_adv_" + [sub-menu first item]. For example, for "myapp" it have to be called "_adv_myapp". Listening below shows an example of "myapp" sub-menu method implementation.
3. Save & test it
Save confconsole.py and run it via "confconsole" or "service confconsole restart" (as suggested by Jeremy). If everything was wrote fine and the intedenation respected there should be a new sub-menu (i.e. myapp) in advanced menu. Therefore, if this new sub-menu is selected a msgbox should appear showing the list of parameters contained in the specified file.
I hope that is clear enough. Otherwise, just point me the points that I may rewrite or go in more details.
Awesome Lorenzo!
The mods to confconsole that we're working on will make adding new menu entries really easy. The plan is that you just have to drop a new (specially formatted) file into confconsole's filesystem (sort of similar to the way that inithooks are automatically picked up when placed in the right part of the filesystem) which will automagically create a new menu entry. If you want to create a whole new menu tree then you just do that as sub-directories. I.e. the new sub-directory becomes a new menu item, which when clicked opens a new sub-menu. The files within the sub-directory auto populate the sub-menu (and can include more sub-directories/sub-menus).
That's great!
That is a great news!
If I may, then I would advice to publish a tutorial about that and to provide such pre-formatted files (i.e. templates?) with some comment in the key-points. In my experience, I had some hard hours while I was trying to figure it out how the whole thing was working and why it was not doing what I guessed it should do :-P.
I am looking forward to the new confconsole mods!
P.S. It is off-topic, but I was also trying to provide na alternative interface via an ASP.NET MVC interface that I developed in visual studio 2015, but I was not able to deploy it on the asp.net-mono-TKL appliance.. Do you have any suggestion about that Jeremy, please? Should I open another thread?
FWIW you can have a peak at work in progress
As for your asp.net development questions, I am no help at all. I have been involved with maintenance of our asp-net-apache (i.e. mono) appliance but only from a TKL/OS perspective and very basic testing. I have no experience with asp.net/mono/etc at all so am absolutely no help to you at all there...
It may be a limitation of Mono perhaps? Historically Mono was always a subset of dotNet, not a full implementation. I know MS have open sourced dotNet and AFAIK MS are working with Xamarin (the company behind Mono) but I'm not sure what their plan is regarding implementation of a complete dotNet.
It may be a bug in Mono? We install Mono from the Xamarin upstream. Perhaps there is a bug in it?
Or perhaps it is a misconfiguration and/or bug in the TurnKey appliance. I'd like to think that there isn't but TBH it's totally possible...
I suggest that you consult with the Mono community. If it does end up being anything to do with our appliance please let me know ASAP. Additional brownie points if you can tell us exactly what is wrong and how to fix it! Extra bonus brownie points if you fix the code and give us a GitHub pull request! :)
It seems that there is no
It seems that there is no rest for the wicked ;)
If I may give some help, let me know.. also for the doc, but as you probably already noticed, I am not a native speaker.
Alas! Do not worry.. I'll check Mono community and let you know.
BTW, the examples embedded within appliance are not working.. to let them work I had to install them on a "virgin" TKL appliance; then, I had to "scp" them to asp.net-mono appliance to let them work.
Infortunately, still no results for my web appliactions.. T.T
What do you mean by "brownie points"? :P
Started again over here...
Firstly I forgot to actually post the link to the work in progress, doh! Here it is: https://github.com/OnGle/confconsole/tree/plugin_system
Regarding the examples not working, that's not very good! We'll definitely need to fix that. If you have any ideas, I'd love to hear more about it. Even if you could document how to test them (I don't even know where to start).
In my vocab, "brownie points" are a fictional currency that is earned through good deeds. AFAIK it originally comes from the junior Girl Guides/Girl Scouts (who are called "Brownies") but I'm not sure of that...
Thank you for the link, I
Thank you for the link, I peeked in it already ;)
Sure, I 'll probably look at it with a friend at the end of the month; I hope to give some good news.
Aha! Good to know, thanks ;)
No problem! :)
Great!
As soon as I'll have some news, I'll post it ;)
Definitely! Looking forward to it.
a quick update..
Unfortunately, I did not manage with ASP.NET Mono yet.. If there is any update, I'll wrote it here :(
Nothing to update on my end either...
Thanks and equivalent exchange
Lorenzo,
Thanks for posting your findings here, they saved me the time to do some research myself. I was about to start a thread regarding how the examples are not working on 14.1, while they were working on 14.0. The way I fixed them was by creating an instance of 14.0, downloading them from /usr/share (the folder is asp.net-demos) and then uploading them to /usr/share on the 14.1 instance.
In the spirit of "equivalent exchange", let me save you some time with my own findings with the appliance. I have had some success with my own ASP .net web applications, so I can provide some guidance on how to set yours up. (Sorry if this is months late, I just saw your post).
So, what kind of problems are you having with your ASP .net applications? I will attempt to address a few concerns that perhaps might help you, if they are unrelated please let me know and give me more details to see if I can provide with some pointers or help.
Let's begin with adding applications to the default application as "children" of it:
# For more information about mod_mono:
# http://www.mono-project.com/docs/web/mod_mono/
# Instruct Apache to to map the virtual path "/samples" to the physical path of the examples ("/usr/share/asp.net-demos"):
Alias /samples "/usr/share/asp.net-demos"
# Create an ASP .net application in the virtual path "/samples" mapped to the physical path of the examples ("/usr/share/asp.net-demos")
MonoApplications "/samples:/usr/share/asp.net-demos"
# Instruct Apache that everything in the virtual path "/samples" should be handled by mod_mono:
<Location /samples>
SetHandler mono
Require all granted
</Location>
/etc/init.d/apache2 reload
Another way to accomplish adding a new application is the following:
<web-application>
<!-- Name of the Web Application (It can be empty): -->
<name>samples</name>
<!-- Virtual Path of the Web Application: -->
<vpath>/samples</vpath>
<!-- Physical Path of the Web Application: -->
<path>/usr/share/asp.net-demos</path>
</web-application>
/etc/init.d/apache2 reload
Now, let's replicate a common IIS behavior by having the default web application (the one that ships with the appliance) on port 80 and the examples on port 1080.
# Instruct Apache to listen to the following port:
Listen 1080
# Specify a virtual host to point to the Web Application:
<VirtualHost *:1080>
ServerAdmin webmaster@example.com
DocumentRoot "/usr/share/asp.net-demos"
MonoApplications default "/:/usr/share/asp.net-demos"
MonoServerPath default /usr/bin/mod-mono-server4
</VirtualHost>
# This part is not required if there is any other enabled site which specifies it:
<Location />
SetHandler mono
Require all granted
</Location>
a2ensite samples.conf
/etc/init.d/apache2 reload
Once you follow these steps, you will be able to navigate to http://<Appliance's IP> and https://<Appliance's IP> and have the default web application included with the appliance launched. If you navigate to http://<Appliance's IP>:1080 (or the port you configured) you will navigate directly to the web application which you configured (if you didn't change any bold value, this would be the asp.net examples web application).
Figuring this out was a headache, and I must admit I didn't get this to work by just modifying /etc/mono-server4/debian.webapp (No, if you follow the instructions above you don't need to modify this file). Another thing to take in account is that in the mod_mono page of the mono project site (http://www.mono-project.com/docs/web/mod_mono/), the team recommends to use reload instead of restart, which is why the command provided in the instructions to restart Apache is reload and not restart.
If you desire to replace the default web application provided in the appliance, you have a few choices:
a2dissite 000-default.conf
A few considerations:
# Grant access to the www-data to the web application's directory
sudo chown -R www-data:www-data /usr/share/asp.net-examples
# Grant access to the "root" directory (the one containing your web application) to everyone so they can read it:
sudo chmod -R 755 /usr/share
I hope that this helps you, please let me know if it does.
Regards!
Lone Wolf, I am really glad
Lone Wolf,
I am really glad that you found my findings helpful.
Thanks a lot for your help and suggestions!
Currently, I had to move on with other topics after my previous post. So, I would not use your suggestion immediatly. However, I have to come back to my asp .net web applications in next months!
I will update you as soon as possible, hopefully, with good news ;-)
All the best!
You are welcome
Lorenzo,
You are welcome, don't worry about having to take some time to check my suggestions. Hopefully they will help, let me know a few months from now to see how everything went, I wish you good luck!
Regards!
Lone Wolf, sure! Thank you
Lone Wolf,
sure! Thank you once again ;)
Regards
Add new comment