How to add multiple bases in /etc/default/jetty - jetty

I am trying to add multiple jetty bases to jetty server. Documentation says it is possible without providing the information on how to do it.
So in /etc/default/jetty file with single jetty base is which works is
JETTY_HOME=/opt/jetty
JETTY_BASE=/opt/jetty/my_base
JETTY_USER=jetty
JETTY_HOST=jetty
JETTY_ARGS=jetty.http.port=8989
JETTY_LOGS=/opt/jetty/logs/
i have tried combinations
JETTY_HOME=/opt/jetty
JETTY_BASE=/opt/jetty/my_base
JETTY_BASE=/var/www/domain1
JETTY_BASE=/var/www/domain2
...
i have also tried ',' comma separated does not work
JETTY_HOME=/opt/jetty
JETTY_BASE=/opt/jetty/my_base, /var/www/domain1, /var/www/domain2
....
Has anyone managed to get this working, can you let know how to achieve this. Thanks

Create more /etc/default/<name> entries.
Say you want 3 bases.
Lets call them tau, upsilon, and phi.
You'll create ...
/etc/default/tau
/etc/default/upsilon
/etc/default/phi
each of which is a standalone instance of Jetty, with their own ${jetty.base} directory and a common ${jetty.home} directory.
The jetty.sh you (likely) copied into place for your service entry also needs the same name.
So, cp jetty.sh /path/to/service.d/tau.sh becomes how /etc/default/tau is used/searched for.
(Note: depending on your chosen shell, a symlink will probably work too)

Related

Understanding "create a virtual filesystem which allows mapping of arbitrary directories" for FTP server project

Disclaimer: This is homework; I don't want a solution.
Also, no libraries outside c/c++ standard libraries are available.
I'm looking for a push in the right direction to understand what this portion of work from my assigned semester project (create a virtual FTP server) is even asking me to do:
The server allows to create a virtual filesystem. By a virtual filesystem, we mean a mapping of a served directory to the real directory on the filesystem. For example, the client tree will look like: /home/user1 maps to /mnt/x/home/user1 /www maps to /var/cache/www /home/user_list.txt maps to /var/ftpclient/user_list.txt The user will see /home/user1 directory and /www directory and the file /home/user_list.txt
I followed up with this question to my lecturer:
Are /home/user1 -> /mnt/x/home/user1 , /www -> /var/cache/www , and /var/cache/www/home/user_list.txt -> /var/ftpclient/user_list.txt the only directory mappings which need to be supported (so each user will have 2 directories and 1 file as shown automatically created for them)?
to which the following reply was given:
These mappings are just example settings. Your solution should be able
map anything to anything it similar way.
From my current understanding, I need to only allow users of my FTP server to access directories and files which are explicitly mapped (specified via the configuration file). This will probably mean a mapping of something like /home -> /home/users (so all users will see that they're in a pseudo root directory for FTP-ing stuff, e.g. user Bob sees /home/bob/.
Also, with which API do I need to work to support FTP commands like ls, cd, etc. which work with the real unerlying file system?
You are creating your own FTP server (or at least a portion thereof). It will need to solve the problem of /home/bob translates to /home/users/bob. I believe the way you are meant to do this is that if someone types cd /home/bob, you simply translate the passed in file-location to a function that takes the user-provided pat (in this case/home/bob) to it's "real" form (/home/users/bob) before it's passed to the chdir function that actually changes the directory. To make things like pwd and ls show the correct path, you will either need to "remember where you are" (bearing in mind that someone may want to do cd ../joe, cd ../tom/.././mats/../joe, or cd ..; cd joe to move to /home/joe, which should all [modulo my typos] translate to /home/users/joe but display as /home/joe - in other words, your cd will need to understand the current directory . and parent directory .. to move around), or have a "reverse translation" that takes /home/users/joe and comes up with /home/joe. It's my current thought that the latter is simpler, but I haven't solved EXACTLY this problem.
There are probably several solutions that you can follow, but a "match start of string" and working in absolute paths would work unless you want to do very complicated things and allow you don't need users to do REALLY complicated things, for example, if we have this mapping:
/home -> /mnt/x/home (e.g /home/bob becomes /mnt/x/home/bob)
/www -> /var/cache/www (e.g /www/index.html becomes /var/cache/www/index.html)
Now, if a user were to do:
cd /home/bob/../../www/ (could be worse with more . and .. mixed in)
then you need to actually understand where you are, and translate fix up ../.. into / again. [Of course, similar problems using a cd /home/bob then cd .. and cd www may pose similar problems].
I would clarify if that is actually required by your lecturer.
If it is not required, then match the start of anything starting with / (everything else, just pass to chdir without change)
The last question is the easiest: use the Boost Filesystem library, it has the types you'll need such as file paths.
For the first question, the idea is that GET /home/user_list.txt returns the contents of /var/ftpclient/user_list.txt. That means you first need to translate the virtual name into a real name (Some fanciness is possible here, but basically you want to check if any prefix of the virtual name appears in the translation table. Fanciness includes dealing with the case of names not found). Secondly, with the real name you want to open that file, read its contents, and return those to the client.

Coldfusion CFC Mapping to external directories with CFCs that reference other folders

I've done some poking around and trial and error but I'm not coming up for a solution to this problem I have.
I have a folder structure like this (example)
Application.cfc
Objects\
Object.cfc
Utilities\
Util.cfc
API\
Resources\
index.cfm
Application.cfc
I have one site that points to the API folder (http://api.site.com) and another that points to the overall root (http://site.com)
From Api\Resource\index.cfm. I'm trying to createObject() on Objects\Object.cfc. I set up a mapping, either in CF Admin, or API\Application.cfc with this.mappings["/SiteRoot"] = "C:\wwwroot". Inside the index.cfm I do createObject("component","SiteRoot.Objects.Object"). This correctly access the Object.cfc.
The issue I'm having is that it fails because Object.cfc instantiates the Utilities\Util.cfc just by createObject("component","Utilities.Util"). The error is that Utilities.Util cannot be found.
There are other files in the very bottom root that can obviously call Object.cfc with no problems since it just goes into the Utilities folder naturally.
Any suggestions Or do I really need to just break the API Folder out of this root entirely?
Thanks!
UPDATE
It's not letting me answer my own question just yet but I wanted to post here before others chimed in.
Despite reiniting the application and restarting the application server, once or twice it wasn't working. Then suddenly, it just went and worked as I would have expected. Object.cfc could find Util.cfc correctly based on it's relative path.
I gave upvotes to those who responded as they were perfectly viable alternatives and solutions and would have gone with one of them had this not just started working. Demons, I tell you. Demons.
Thanks!
I think I would change your second create object call (the utilities one) to createObject("SiteRoot.Utilities.Util") ? Making sure that one mapping "governs" the starting point for all the objects no matter where instantiated.
If you really cannot change your code then just create a ColdFusion mapping called Utilities pointed at the Utilities folder.

Why don't any functions run from the Doctrine 2.0 Command Line Interface (CLI)?

I've recently managed to get the betas of Codeigniter 2.0 and Doctrine 2.0 working together, thanks to the help from this guide: http://eryr.wordpress.com/2010/09/26/integrating-doctrine-2-with-codeigniter-2/
I have set up the CLI as set out in that guide, but I can't run any commands - I type doctrine and get the menu and list of commands, but then when I type a command like doctrine orm:schema-tool:create it just loads the same screen again with the list of commands. I don't get any error messages or anything.
My application/doctrine.php: http://pastebin.com/P0CtefhF
My application/cli-config.php: http://pastebin.com/KCVfZFct
If anyone can even give me a clue or point me in the right direction I would be most grateful. I have been trying to get my head around this for a day and a half now :S
Hey, I just got this all working together myself.
One thing, it depends on how you DL'd doctrine to begin with. I DL'd directly, no SVN or GIT in other words.
I ended putting my cli-config.php, doctrine.php and Doctrine.php in "application/tools" dir. "tools" is a dir I just created. It did not exist before.
The current way it's set up with the examples from that link you gave, I think they all need to be in "application/libraries", so if you want to move them to "application/tools" you need to update those paths.
So for example:
require_once CURPATH.'/../config/database.php';
This is saying to go up from 'application\tools' to 'application\config' and get that 'database.php' file.
require_once CURPATH.'/../libraries/Doctrine/Common/ClassLoader.php';
And This is doing the same, except that it is going into "application\libraries\Doctrine\Common" and looking for "ClassLoader.php"
Does that help?
Anyone having this trouble should try two things:
First of all instead of just typing doctrine command make sure you type php doctrine.php command.
Also make sure you have adjusted your system path correctly instead of your user account path.
Once I did both of those things it worked for me fine. Bit confusing though as the first command does work to bring up the list of possibilities, but not when you run any actual command.

Cannot find CFML template for custom tag

I am not a ColdFusion coder. Doing a favor for a friend who ported his CF site from a Windows server to Unix on GoDaddy.
Site is displaying error:
Cannot find CFML template for custom tag jstk. ColdFusion
attempted looking in the tree of installed custom tags but did not
find a custom tag with this name.
The site as I found it has at document root /CustomTags with the jstk.cfm file and a set of files in cf_jstk
My Googling located this:
You must store custom tag pages in any one of the following:
The same directory as the calling page;
The cfusion\CustomTags directory;
A subdirectory of the cfusion\CustomTags directory;
A directory that you specify in the ColdFusion Administrator
So I have:
Tried creating placing /CustomTags in /cfusion/CustomTags
Tried copying /cfusion/CustomTags to above document root
Tried copying jstk.cfm and subfolders into same directory as calling file(index.cfm)
Update: Per GoDaddy support I have also tried adding the following to no effect: <cfmodule template="CustomTags/jstk.cfm">
Can any one give me some tips on this or should I just tell my guy to look for a CF coder?
Thanks!
I don't know how GoDaddy is setup, so as a quick test, please do the following:
Create file test.cfm in the webroot with contents:
<cf_testtag/>
<cfoutput>test</cfoutput><cfabort/>
Create file testtag.cfm in the webroot with contents:
<cfdump var=#ThisTag# />
Then in a browser visit the test.cfm page.
You should get two debug dumps, followed by the 'test'; this will confirm that custom tags in general are working.
If that works move the testtag.cfm to the CustomTags directory, and see if you get the same behaviour or an error.
If this produces an error, for CF8 and above, you can add <cfset This.CustomTagPaths = "/CustomTags" /> inside the Application.cfc file (assuming there is a App cfc and not an Application.cfm) to ensure that directory is checked for tags.
It is possible to convert Application.cfm to Application.cfc - how easy this is depends on how complex the code is in there - might be something you could figure out, or might need an experienced CF dev, it depends.
Depending on the outcome of this, we can attempt to debug why the jstk tag isn't working (unless one of the above solves it).
In an effort to check the simple things before worrying about complex things:
Remember that filenames on *nix systems are case sensitive, but on windows are not.
For example, a windows server will pick up "application.cfm" but a linux server won't. It requires "Application.cfm".
Check to make sure all filenames/paths are the correct case.
Normally, CFML check every custom tags in current directory first, if not found, second is in CFMX8/customtags/.

Magento - locate specific core files

I am familiar with theming and using template hints in the Magento back office to locate .phtml files.
What I am not really familiar with are the core files such as app/code/core/Mage/Catalog/Model
What I need to do is override a core file like I would a core phtml file by copying it to 'my theme'.
I basically want to amend some labels which appear on the order summary page of the Magento checkout process - domain.com/checkout/cart/
I followed the trail to the phtml files using template hints. Within the app/design/frontend/default/mytheme/template/checkout/cart I found the code
renderTotals(); ?>
Now I managed, by accident, to stumble upon two of the files I wanted to change:
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Grand.php
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Shipping.php
I made local copies of these files (http://www.magentocommerce.com/wiki/how_to/how_to_create_a_local_copy_of_app_code_core_mage) to override the default labels, like I would if I was overriding a template file.
My question is, how can you locate core files which pertain to the 'stuff' you want to change, located in function calls such as renderTotals(); ?> in the phtml files?
Not being able to pinpoint stuff like I can with template hints is slowing me down, and I am struggling to find a solution as I am not up on all the vocab surrounding Magento yet.
Hope this makes sense and thanks in advance!
From the same settings page where you turn on Template Path Hints, also turn on the "Add Block Names to Hints" setting. This will show you PHP class names such as: Mage_Sales_Model_Quote_Address_Total_Grand to which you can deduce the folder path (underscores represent a subfolder, and the last piece represents the file name).
If you're getting a block such as Mage_Sales_Model_Quote_Address_Total_Default then sometimes it just takes a little common sense to see that it's pulling in other files from the same folder (such as Grand.php and Shipping.php). But there are generally only a couple files in the same folder, so this is pretty easy to see.
As Sid Vel said, a good Search Project functionality is helpful. But if you find yourself looking at Abstract.php of some class, often you need to look in a subfolder in that directory with the proper name to find the concrete implementations. But still, it gets you very close to where you need to be.
I always use Dreamweaver's site / directory search function. It will scan through all the files in the Core folder and tell you where the function is from. In your case, I would search for "renderTotals". You need to enable PHTML editing in Dreamweaver.
Most IDE's will allow this kind of search option. In Aptana you can Ctrl + Click on the function to open the file it is coming from. Magento takes ages to index itself on Aptana, due to its sheer size.