Assuming that we have a bigger Microsoft .NET project that has a structure like this:
we can build it at once using MSBuild. Lets create a builder.proj file
and then we can execute
Assuming that we have a bigger Microsoft .NET project that has a structure like this:
we can build it at once using MSBuild. Lets create a builder.proj file
and then we can execute
Sometime we face the situation that we need to copy the deployment results (or Artifacts) to some central repository where all deployments are stored. This is not a problem for Linux-to-Linux copy as we can use SCP, RSYNC or any other task. What if the target is a Windows machine though and if we want to customize the directory naming to be dependent on e.g. version of the product hidden in the exe file? PowerShell to the rescue! We need two pieces:
We need a Bamboo Remote Agent that is running on a Windows box - this will be doing the deployment itself and executing the PowerShell script.
A powershell script Task (normal Script task with the Powershell type selected) and a script that will do the actual copy
What this script does is:
It sets current date to $TODAY variable It takes setup.full.exe and pulls out version information from inside It create a new directory in $DIR path Copies all files from the current deployment bamboo agent directory to the target $DIR
There is no template for Debian Wheezy while creating new VMs in XenServer. However, it is easy to clone it from the 6.0 version. Firstly we clone the template, then we change the parameters to use Wheezy.
If you ever try to talk from a script with Web Service that via WSDL definition, you may end up with a script like this:
This will work with some web services, but with others it will not, especially when the method invoked on the service is parameter-less. The resulted XML code will show xsi:nil=”true” in the method invocation, what will effectively break the query. To overcome this, I just switched to Python and came up with this simple script:
Puppet is great for centralised management of SSH keys on Linux boxes. The SSH module described in the project pages does its job really well for creating a new key pair and distributing it for clients (using the keys) and servers (authorized_keys file management).
The key generation mechanism provides several options to set up how the keys should be generated. One of them, is the maxdays options, defining how long the keys are valid. Because of that, I needed some mechanism to notify the users when their key has changed and they need to fetch new one. Normally, ssh::auth::server can be used for private key distribution, sometimes however this is not possible and that’s why this need floated.
To solve that, I thought that the simplest way will be to send an email that is set in the account properties. Basically the most crucial code needed is this one:
The command for user notification is in the exec clause and it is using a simple mail command.
The full diff of modules/ssh/manifests/auth.pp is below:
An idea to solve that is to use ClientScript and disable the scripts that you want to avoid. To do that automatically and globally, you can use a custom controller like this:
In the HOST logs you can see probably:
The problem is that 3.0 kernels are not using barriers anymore and there is a bug connected to that with the host kernel. If you are interested in details, check out Debian bug #637234.
The workaround is to use ‘barriers=0’ while mounting the disks in the guest system, so you correct your /etc/fstab to have:
This post explains how to set up Redmine - the packaged version in Debian, to be hosted by Unicorn server and to use apache load balancing module. This is a faster alternative to running Redmine with mod_passenger.
The idea is as follows: unicorn is starting X servers running Redmine, and Apache is load-balancing the requests between those servers. We have to start with installation of unicorn gem
Now, we have to creation Unicorn configuration file:
Before we try to start Redmine, we have to create a symlink to the logs directory:
Now, we can start Redmine and test if it works:
Note: Change the /redmine path to the path you want your Redmine should be visible at. This is needed for correct URL operations. If everything is running smoothly, you can start the server with su and add the line to /etc/rc.local:
This is starting Unicorn initially as www-data user. Apache 2 Balancer configuration In this step, we tell Apache how to route requests to Redmine between the workers. Firstly, let’s enable the appropriate modules:
Next, edit an appropriate VirtualHost configuration file. In the default configuration it would be /etc/apache2/sites-available/default and add the corresponding lines:
A little bit of description:
The SetEnv part is needed for Redmine Debianized configuration to choose the instance of Redmine Proxy section defines the balancing workers to be used, be sure to adjust this if you are starting less/more worker threads The Alias line is needed for some static files used by Redmine The Rewrite section eventually tells Apache to route all Redmine requests to the load balance by matching /redmine/ against $REQUEST_URI variable. The Location part is for the Redmine Web Service security. Adjust this to limit the access to the /redmine/sys/ only for the trusted servers.
Sometimes you have multiple records where the same data spans across multiple columns in the table and you’d like to clean up that mess by leaving only one copy per unique set of records.
Let’s consider the following recordset:
Now we want to clean it up to have the result as following:
This is quite simple. Firstly we will create a table containing only the records we want to create the pristine
This is our table that contains the clean record set. Now, if you have unique ID field in the original table you can remove the unwanted records with the following query:
Otherwise, if you don’t have the ID field, you can just truncate the original table and insert the records from the clean table with:
Hope that helps somebody :-)
layout: post title: RVM, Passenger 3, REE, Rails3 in a Debian date: 2011-01-03 03:16:23.000000000 +00:00 categories:
This post explains how to install a global RVM (Ruby Version Manager) with Passenger 3 gem, Ruby Enterprise Edition in a Debian server machine for all users.
I have chosen /opt/rvm/ for the installation.
Be sure to modify the path /opt/rvm if you have installed rvm elsewhere.
Next enable the module with a2enmod passenger and restart apache. You can verify if Passenger started with grep:
If you want normal users to be able to create gemsets and install additional gems, you have to change permissions of /opt/rvm/gems/. This is not very elegant and super-safe solution, but for development machines is ok.
Using RVM in CRON If you try to use RVM in cron the normal way, like:
You will end up with one of the following errors:
command rvm is not found command rake is not found gem XXX is not found
This is due to the fact, that cron commands are run in a very limited environment whereas RVM heavily relies on the environment variables. As a remedy for that situation, you have to invoke bash as if it was invoked by a login shell:
-l is invoking bash with full environment for RVM to work properly. Remember to put the appropriate RVM loading line in the .bashrc ! -c says read the command from the parameter next in the command, you cd to the project directory; this is needed to set up proper RVM environment from the .rvmrc file - so yes, I am assuming you have a file named .rvmrc in your project directory inside which you are selecting the proper gemset
To set up this software under your Applebook, you have to download MySQL first. Go to http://dev.mysql.com/downloads/mysql/ and fetch an appropriate version for your system, depending if it 32 or 64 bits. I’m having MacBook Pro with Intel Core 2 Duo. Ergo, this is 64-bit architecture, ergo, I’ve chosen to download Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive.
Now, launch the package and install all three things:
Now, after you have done that, we can install the gem. If you try to do this the standard way with sudo gem install mysql, then you’ll probably end up with the result similar to this:
mac:dir mac$ sudo gem install mysql Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for mysql_query() in -l/usr/local/mysql/lib... no checking for main() in -lm... yes checking for mysql_query() in -l/usr/local/mysql/lib... no checking for main() in -lz... yes checking for mysql_query() in -l/usr/local/mysql/lib... no checking for main() in -lsocket... no checking for mysql_query() in -l/usr/local/mysql/lib... no checking for main() in -lnsl... no checking for mysql_query() in -l/usr/local/mysql/lib... no checking for main() in -lmygcc... yes checking for mysql_query() in -l/usr/local/mysql/lib... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
This is due to the fact that the compiler couldn’t find our custom mysql installation. To fix this error, try running the command below, supplying the paths:
warden-mac:pirate mac15$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr /local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config Building native extensions. This could take a while... Successfully installed mysql-2.8.1 1 gem installed Installing ri documentation for mysql-2.8.1... (...)
Be sure to put the correct architecture name in the ARCHFLAGS environment variable. Otherwise, the gem will install correctly, but you’ll get some errors like this from your rake: uninitialized constant Mysql::Error The correct values are:
of course, for Intel architecture…. :-) This should do the trick, now you have your gem installed:
mac:dir mac$ gem list | grep mysql mysql (2.8.1)
Good luck :)
You probably see this error when you are trying to start apache with /etc/init.d/apache2 start and there is no effect.
This error is caused by not clearing semaphores by apache and/or mod_fcgid and/or mod_passenger.
You can see the list of semaphores with the command ipcs -s.
If you are using Ruby on Rails with Apache (or Apache ITK) and mod_passenger and you get an error while you are trying to upload a file through Rails application, you are probably facing the problem of wrong permissions set in the webserver_private directory of passenger.
Passenger is not currently supporting ITK and is not changing the ownership of the files/dirs correctly.
[ pid=32497 file=ext/apache2/Hooks.cpp:727 time=2010-10-27 13:47:50.44 ]:
If you run
rake db:migrate and experience that error:
rake aborted! Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `rescue in log' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:194:in `log' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb:289:in `execute' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:167:in `create_table' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb:445:in `create_table' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:430:in `initialize_schema_migrations_table' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/migration.rb:487:in `initialize' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `new' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `up' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/migration.rb:415:in `migrate' C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:142:in `block (2 levels) in ' C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call' C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute' C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each' C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute' C:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain' C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' C:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' C:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run' C:/Ruby192/bin/rake:31:in `'
then try to do this to solve the problem:
I am working a lot with screen, especially to get to remote hosts and do many operations at once. The thing that was irritating me a lot, was the fact that I had to set the titles of windows manually after logging in via ssh.
I have found a method to overcome this problem though. Firstly, you have to put this line in your ~/.bashrc file.
Secondly, to get a nice status bottomline when you start screen, you have to set it in ~/.screenrc. I am using this set of customizations:
Nothing better than a screenshot huh? Ok, here you are, THE RESULT:
This is quick example of how to do a very simple authentication in Zend Framework. It doesn't user external database for getting the credentials, although you can make it very easily to read data in the Auth adapter from an external file or MySQL database.
Quite common usage scenario is a Postfix mail server with a Mailman instance for groups. Even more often the accounts for the mail are stored in an LDAP tree. And in this case a problem appears, because Mailman doesn’t have a native connection to LDAP. That’s why I needed to have an LDAP 2 Mailman script that would synchronise mailman groups with the LDAP tree. This Perl script is meant to be run from cron.
What this script does is the following:
If the list does not exist, and $create_nonexistent is true, then a new list will be automatically created with the admin/password defined in the variables at the beginning of the script. Note: For security reasons, this version of the script DOES NOT delete lists, so if you delete a mailGroup from LDAP, you have to do a rmlist -a by yourself. On request, I can give somebody the version which deletes the lists also.
The script relies on a mailGroup objectClass which is defined in the schema that you can download from here.
Hints for Postfix 2.6 or higher that are commonly mentioned problems or scenarios.
Enforcing From: header to match SASL login username There are many situations where we have to make sure that the user that is trying to send e-mail is the rightful person. In practice, this means that a user that is logging in via username via SASL mechanism has to own the e-mail address that she is trying to send as. To accomplish that, firstly we want to put an additional header to the mails being sent. This is done by putting into main.cf:
This results in an additional header in mails, that are sent by SASL authenticated users:
Note: this is NOT required and this is potentially exposing your existing usernames to the world, making them easier to bruteforce or to spam. In this scenario however, this is anyway meaningless because from address == SASL username. Next, we want to make sure that if the user is trying to send mail as email@example.com, then he has to be authenticated as name.surname via SASL. For that, we have to put:
In my case, I am authorising the SASL users against LDAP directory, thus the login-maps.cf contains:
What this map does, is it looks up in LDAP directory the SASL username (uid=%u) looking in objects of class InetOrgPerson. For success, the lookup must return:
where firstname.lastname@example.org is the email that the user is trying to send as (from From: header).
It appears that jqModal and datePicker have z-index problems. My datepicker appeared below the form inside jqModal. The fix for this is very simple. We have to modify CSS for UI and jqmodal.
This is because they don't set z-index property properly. But we can change it on our own...
Recently I have been doing an XP preinstallation for a remote software deployment project. In this post i'm putting all the interesting links I have found and the problems I had during the software preparation.
This is NOT a howto or instruction, this is just intended to help. If you want to have a full howto, don't hesitate to comment/fund a coffee for me :)
This is a short article on how to get the above Mantis version to work with Microsoft Windows Active Directory LDAP. Used Mantis version: 1.1.1 and PHP Version 5
Mantis currently supports only login via LDAP directory by the following scheme:
Connect to LDAP server Bind with anonymous DNS or with a user specified DN (but in a config file permanently) If the bind succeeds then do an ldap_search If the search succeeds then login is successful.
When using Microsoft AD LDAP the situation is a bit different, we want to:
Create a DN basing on the config file and username field that the user entered in the login form Try Bind with the above DN and password that the user entered in the login form If the bind succeeds then the login is successful (we don’t need to run the search)
To achieve that, there are some minor changes to do in the Mantis core API.
Log in to a fresh mantis installation, and create a user with admin privileges with a username matching your LDAP username (in this example xy2093)
First, add to your config_inc.php configuration file the following options:
Next, you have to modify the core LDAP authentication ldap_authenticate function. Go to core/ldap_api.php, find the above function and replace it with:
In the function notice the $bind_dn variable. This is the variable being used to prepare the bind DN for LDAP connection. Feel free to modify it to suit your authentication scheme, however you should not have to. It defaults to:
CN=Firstname Lastname (username),ou=staff,ou=company,dc=domain,dc=com
i.e. CN=John Doe (xy2093),ou=staff,ou=company,dc=domain,dc=com.
You won’t believe it but that’s it! Now you can try to log in to Mantis with your LDAP password and it should work like a charm.
The next issue to solve here is that you have to have the users from LDAP in your $mantis_user_table, for instance to manage Mantis privileges. There are many ways to achieve that, you can import them every night. Or you can use Mantis SOAP API to check if the user exists in LDAP when they try to log in as I did. But how to do that is another article ;)
Recently I've heard that some people tend to see domain levelling quite different than the others.
I found it quite an interesting thing to check, that's why I'm writing this article.
Everybody knows that com, net, org are so called TLDs (Top-Level-Domains) and that they are part of the . (root) tree.
Not everybody knows that actually in the very prehistoric times, the notation was com. net. org. as to indicate that they have the root parent.
But that's only for curiosity.
Ok, so let's elaborate a bit...
Ever wondered how to set up a more secure FTP server?
I did. And the first thing that came to my mind was getting those username/password things encrypted.
Who did invent a plaintext login mechanism!?
So, let's get started.
This howto will tell you how to set up an Proftpd based FTP server with TLS encryption for data&control channels.
Quick How to set up a XEN installation . The following howto describes a way to: