mafflog

random stuff for teh interwebs

  • About
  • Projects
  • Archives

Authenticate Apache against Redmine with AuthMySQL

March 28, 2009 · in Development, How-Tos, Server

For a student project we needed to authenticate an apache host against a MySQL database, in this a case we wanted to handle authentication for a Subversion repository with a Redmine database. I know that Redmine has its own solution for this problem using Redmine.pm, but for some reason that approach didn’t work and we didn’t have the time to bug around with it. This howto is written for the use with Redmine (especially the database view), but you should get the point how to set it up on other environments. The howto was done on an Ubuntu 8.10 box but should work on any other distro as well (except for the module installation). I assume that you got all the other stuff (apache, mysql, …) up and running.

(more…)

gitosis-create-repo

March 22, 2009 · in Development, Server

A simple script to create a new gitosis-repository on the fly. I’m not really familiar with bash scripting so don’t expect too much ;)

#!/bin/bash
if [ -z $1 ]; then
    echo "Please specify a repository."
    exit 1
fi

if [ -z $2 ]; then
    echo "Please specify a remote url."
    exit 1
fi

if [ -d $1 ]; then
    echo "Repository already exists."
    exit 1
fi

mkdir $1
cd $1
git init
touch .gitignore
git add .gitignore
git commit -a -m "Initial commit."
git remote add origin $2:$1.git
git push origin master:refs/heads/master

Please make sure you set the correct permissions in gitosis.conf. Example:

[group me]
members = me@example.com
writable = test</pre>

Then you can run the script to create a new repository test on myhost.example.org:

$ gitosis-create-repo test git@myhost.example.org

Set up symfony 1.2 on Debian/Ubuntu

March 4, 2009 · in Development, How-Tos, Linux, Server

Just wanted to give symfony a try and ran into some issues to set it up the way I wanted. Therefore I’d like to note the required steps.

First, install symfony via PEAR.

pear channel-discover pear.symfony-project.com
pear install symfony/symfony-1.2.4

This sould install symfony and make the symfony executable available in your PATH.

~$ symfony -V
symfony version 1.2.4 (/usr/share/php/symfony)

Create a directory for your vhost and create a new project.

mkdir /var/www/myproject
cd /var/www/myproject
symfony generate:project myproject

Create an example application in your project.

symfony generate:app frontend

Link the symfony resources to the project’s document root.

cd web
ln -s /usr/share/php/data/symfony/web/sf/

This should get you up and running with symfony. You just need to configure your server for the vhost. For personal preference, I’d like to have my document root directory named public instead of web. The following steps are needed to achive this.

Rename the document root directory.

mv web public

Add this line to config/ProjectConfiguration.class.php:

<?php
public function setup()
{
    $this->setWebDir($this->getRootDir() . '/public');

    // for compatibility / remove and enable only the plugins you want
    $this->enableAllPluginsExcept(array('sfDoctrinePlugin', 'sfCompat10Plugin')$
}

Linux Software RAID1 defekte Platte tauschen

January 5, 2009 · in How-Tos, Linux, Server

Da auf meinem Rootserver zum wiederholten Mal Probleme mit der zweiten Festplatte (/dev/sdb) auftraten, wurde diese soeben im Rechenzentrum getauscht (ein Lob an Hetzner für den schnellen Support). Da die Platte Bestandteil eines Software RAID1-Verbunds ist, kurz die Schritte zum Entfernen und anschließenden Reaktivieren der Platte.

Zuerst alle Partitionen der Platte auf faulty setzen und anschließend aus dem jeweiligen Array entfernen:

mdadm /dev/md0 --set-faulty /dev/sdb1
mdadm /dev/md0 --remove /dev/sdb1
mdadm /dev/md1 --set-faulty /dev/sdb2
mdadm /dev/md1 --remove /dev/sdb2
mdadm /dev/md2 --set-faulty /dev/sdb6
mdadm /dev/md2 --remove /dev/sdb6

Nach dem Tausch der Platte muss zuerst die Partitionstabelle auf die neue Platte kopiert werden:

sfdisk -d /dev/sda | sfdisk /dev/sdb 

Anschließend können die Partitionen wieder zu den jeweiligen Arrays hinzugefügt werden:

mdadm /dev/md0 --add /dev/sdb1
mdadm /dev/md1 --add /dev/sdb2
mdadm /dev/md2 --add /dev/sdb6

Über folgende Ausgaben kann der Resync der Arrays dann überprüft werden:

mdadm --detail /dev/md2
cat /proc/mdstat

Debian logcheck ignore file for sSMTP

December 20, 2008 · in Linux, Server

On a server, I use logcheck to get an email based on logfile analysis if anything goes wrong and doesn’t fit the usual patterns. In addition, I use sSMTP to forward all sent mails to my mailserver. Unfortunately, this solution ends up in sending a mail like the following every hour because of a bug in logcheck’s ignorefile for sSMTP.

Dec 12 22:02:06 hostname sSMTP[22391]: Sent mail for logcheck@hostname (221 2.0.0 Bye) uid=101 username=logcheck outbytes=639

To fix this, I replaced the contents of the file /etc/logcheck/ignore.d.server/ssmtp with the following lines:

^w{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [a-zA-Z0-9]+ sSMTP[[0-9]+]: Sent mail for logcheck@.*$
^w{3}  [0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [a-zA-Z0-9]+ sSMTP[[0-9]+]: Sent mail for logcheck@.*$

I removed the other lines, because sSMTP shouldn’t do anything else on the system and if it would, I’d like to be informed. If you need more ignore patterns you might have to keep/edit some of the original lines.

Magento: access a dropdown attribute value

October 10, 2008 · in Development, How-Tos

In Magento it is possible to access a product’s attributes with a simple getter method. Let’s get the attribute test:

<?= $_product->getTest() ?>

This works as long as test is an attribute of type ‘text’. If the attribute is a dropdown, the method will just return the id of the selected option. To get the dropdown text, you need to call another method:

<?= $_product->getAttributeText('test') ?>

Debootstrap a Ubuntu Hardy DomU on a Debian Etch Xen Dom0

October 3, 2008 · in How-Tos, Linux, Server

Lately, I wanted set up a Ubuntu Hardy DomU on an existing Debian Etch Dom0 box. Usually, setting up Debian-based DomUs is very simple with xen-create-image and debootstrap (there are tons of tutorials out there dealing with this topic), but unfortunately Etch’s version of debootstrap doesn’t support Ubuntu Hardy. I spent a surprisingly long time on searching the net until I found a solution for this problem on a french site: Installer et configurer Xen sur Debian 4.0 Etch (it’s a complete howto for Xen on Debian Etch, but it deals with the Hardy part too). The author created a backport of the debootstrap package, which enables you to debootstrap Hardy.

First, you have to create the hardy.d directory (symlink) for xen-tools.

$ cd /usr/lib/xen-tools
$ ln -s ubuntu.d hardy.d

There’s a debian repository holding the backport package, however I got problems to use that repository on an amd64 box, so I downloaded and installed the package manually.

$ wget http://falcon.landure.fr/pool/etch/debootstrap/debootstrap_1.0.10_all.deb
$ dpkg -i debootstrap_1.0.10_all.deb

Now you should be able to debootstrap a Hardy DomU.

$ xen-create-image 
--hostname=hardy 
--ip=xxx.xxx.xxx.xxx 
--size=5Gb 
--memory=256Mb 
--dist=hardy 
--mirror=http://archive.ubuntu.com/ubuntu/
Use PuTTY as Cygwin terminal

Use PuTTY as Cygwin terminal

September 29, 2008 · in Development, How-Tos

“Cygwin is a Linux-like environment for Windows.” This means, you can use linux/unix commandline tools like ls, grep and find on your Windows system. However, the default installation of Cygwin uses Windows’ default commandline terminal cmd.exe, which is not really handy. Fortunately, there’s a solution to use PuTTY as Cygwin terminal.

  1. Download and install Cygwin. The setup will download all needed packages, so make sure you check what you need (my main reason to install Cygwin was to have a Git client on Windows)
  2. Download PuTTYcyg and extract the contents of the archive anywhere on you hard drive
  3. Start putty.exe, select Cygterm as connection type and enter - (dash) as command. Enter a session name (e.g. cygwin) in the text field below Saved Sessions and click on Save.
  4. Create a shortcut to putty.exe. Right click the shortcut, select Properties and append the following string to the target field: -load "cygwin". Of course you have to replace cygwin with the name of the session you saved in PuTTYcyg.
  5. Open the shortcut and you should directly get into your Cygwin shell

Magento design resources

September 17, 2008 · in Development, Web

As the documentation on Magento is a bit…spread around the web: here’s a collection of links to guides and hints how to deal with magento’s templating system (partially german). I will add more as I find them.

  • Designer’s Guide to Magento
  • Designer’s Guide to Magento (PDF)
  • Theming Magento Commerce (many links are from there)
  • Designing for Magento
  • Magento folder structure
  • How to build a template with blocks
  • Add a new layout template
  • Change texts in locale file
  • List of available XML handles
  • Terminologie im Online-Shop Magento

Screencasts

  • Designing for Magento Webinar
  • Designer’s Guide: Creating Themes
  • Static Blocks
  • Layered Navigation
  • Landing Pages

Use VPN connections in network-manager-pptp without rebooting

September 17, 2008 · in How-Tos, Linux

When configuring VPN connections in Ubuntu through network-manager-pptp the connections don’t get displayed until a reboot due to a bug. In the bugtracker I found a solution which makes the connections available without a reboot.

First, restart dbus

sudo /etc/init.d/dbus restart

Then run the NetworkManager applet by opening a command window with ALT+F2 and typing in nm-applet.

← Previous 1 … 3 4 5 … 10 Next →
github github github

Search

Categories

  • Android
  • Development
  • Fun
  • General
  • Hardware
  • How-Tos
  • Kitchen
  • Linux
  • No Comment
  • Projects
  • Server
  • Snippets
  • Software
  • Video
  • Web
  • Windows
  • Wordpress

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Copyright © 2008-2013 mafflog