вівторок, 30 липня 2013 р.

Redis не запускается в Fedora

По порядку в общем-то.
http://redis.io/topics/quickstart
И как хорошие котики, мы хотим запустить make test. И получаем ошибку, что tcl8.5 not found

You need 'tclsh8.5' in order to run the Redis test

ВТФ? (спойлер: на этом приключения не заканчиваются)
Ок, ставим эту приблуду.
wget http://prdownloads.sourceforge.net/tcl/tcl8.5.11-src.tar.gz
tar xvfz tcl8.5.11-src.tar.gz
cd tcl8.5.11/
cd unix/
./configure
make -j3
removepkg tcl-8.4.15-i486-1
make install
ldconfig
(стырено http://dragkh.wordpress.com/2012/05/15/install-redis-stable-2-4-13-on-centos-release-6-2-x86_64-and-slackware-12-0-0-i686/)

Теперь make test запускается.
Ок, следуем дальше.
make install
cd utils
./install_server.sh

Пыщщщщ! Инсталл-сервер внезапно выдает следующий лулз:
 Installing service...
./install_server.sh: line 178: update-rc.d: command not found

Но мы же умные котики! Открываем файл, находим строку 178, и что мы там видим: проверка на существование команды chkconfig  if [ !`which chkconfig` ] ; then

В общем, гениальный скрипт ВНЕЗАПНО? заходит в этот if блок и пытается выполнить update-rc.d в RHEL системе :D
Включаем покерфейс и, к примеру, меняем содержимое этого места на

#Install the service
echo "Installing service..."
if [ !`which chkconfig` ] ; then
#if we're not a chkconfig box assume we're able to use update-rc.d
        chkconfig --add redis_$REDIS_PORT && echo "Successfully added to chkconfig!"
        chkconfig --level 345 redis_$REDIS_PORT on && echo "Successfully added to runlevels 345!"

else
    # we're chkconfig, so lets add to chkconfig and put in runlevel 345
        chkconfig --add redis_$REDIS_PORT && echo "Successfully added to chkconfig!"
        chkconfig --level 345 redis_$REDIS_PORT on && echo "Successfully added to runlevels 345!"
fi

(или пишем правильный if блок, но мы же хотим послужить богу Ганеше?)
Ругается на service redis_6379 does not support chkconfig, чуть позже фиксим)


ок, теперь инсталл скрипты запускаются.
Осталось запустить собсна redis.
ТАДААА!

[root@localhost utils]# /etc/init.d/redis_6379 start
 exists, process is already running or crashed

Процесс не запущен нифига.
Ок, открываем редактором и дебажим. Вуаля - переменная $PIDFILE не задается.
Лечится подменой содержимого файла конфигом доброго человека https://github.com/antirez/redis/blob/unstable/utils/redis_init_script

На случай выпила репозитория - оставлю это здеся.

REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf"
case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
echo "$PIDFILE exists, process is already running or crashed"
        else
echo "Starting Redis server..."
                $EXEC $CONF
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
echo "$PIDFILE does not exist, process is not running"
        else
PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $CLIEXEC -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
echo "Redis stopped"
        fi
        ;;
    *)
        echo "Please use start or stop as first argument"
        ;;
esac
Теперь можем запустить ps aux | grep redis, и убедиться, что это творение сумрачного гения РАБОТАЕТ.
[root@localhost utils]# ps aux | grep redis
root 13452 0.3 0.0 28080 1584 ? Ssl 23:33 0:00 /usr/local/bin/redis-server /etc/redis/6379.conf root 13474 0.0 0.0 4940 848 pts/0 S+ 23:33 0:00 grep --color=auto redis
(да, от рута. Позже разберусь.)



середа, 24 липня 2013 р.

Scala Could not reserve enough space for object heap

 [elena@localhost my-scalatra-web-app]$ ./sbt
Detected sbt version 0.12.3
Starting sbt: invoke with -help for other options
Downloading sbt launcher 0.12.3:
  From  http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.12.3/sbt-launch.jar
    To  ./.lib/0.12.3/sbt-launch.jar
Using /home/elena/.sbt/0.12.3 as sbt dir, -sbt-dir to override.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Бла бла бла. Имеецца scala, но такая вот херня происходит при выполнении ./sbt


_JAVA_OPTIONS="-Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled" sbt 

Kernel headers, fedora


cp /usr/include/linux/version.h /lib/modules/kernel-version/build/include/linux/

неділя, 21 липня 2013 р.

rspec + spork + rubymine

Если подрубить Spork, кнопка спеков в рубимайне перестает определять форматтер.
no such file to load — teamcity/spec/runner/formatter/teamcity/formatter

Как лечить: в spec_helper.rb


Spork.prefork do
.
.
.
if ENV["RUBYMINE_HOME"]
    $:.unshift(File.expand_path("rb/testing/patch/common", ENV["RUBYMINE_HOME"]))
    $:.unshift(File.expand_path("rb/testing/patch/bdd", ENV["RUBYMINE_HOME"]))
end
.
.
.
end

(c)пижжено http://devblog.avdi.org/2011/04/17/rubymine-spork-rspec-cucumber/

Уродливый шрифт RubyMine

"Внезапно" шрифты в Java апплихуках в кедах выглядят, как кусок г-на. Установлена Sun Java.
Как лечицца:

1. export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
Типо, по дефолту антиалиасинг обрублен

2 - шикардос. http://forums.debian.net/viewtopic.php?f=10&t=39790

The default fontconfig configuration on debian does not define if
anti-aliasing should be used by default or not. If you want your fonts
to be anti-aliased system wide, create a file
/etc/fonts/conf.avail/10-antialias.conf with the following contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Use anti-aliasing -->
<match target="font">
<edit name="antialias" mode="assign"><bool>true</bool></edit>
</match>
</fontconfig>

Then link it to /etc/fonts/conf.d/ and everything is fine. 


субота, 20 липня 2013 р.

RVM c compiler cannot create executables

[elena@localhost ~]$ rvm install ruby-2.0.0
Searching for binary rubies, this might take some time.
No binary rubies available for: fedora/19/x86_64/ruby-2.0.0-p247.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for fedora, might require sudo password.
Requirements installation successful.
Installing Ruby from source to: /home/elena/.rvm/rubies/ruby-2.0.0-p247, this may take a while depending on your cpu(s)...
ruby-2.0.0-p247 - #downloading ruby-2.0.0-p247, this may take a while depending on your connection...
ruby-2.0.0-p247 - #extracted to /home/elena/.rvm/src/ruby-2.0.0-p247 (already extracted)
ruby-2.0.0-p247 - #configuring.......
Error running './configure --prefix=/home/elena/.rvm/rubies/ruby-2.0.0-p247 --disable-install-doc --enable-shared',
please read /home/elena/.rvm/log/ruby-2.0.0-p247/1374331881_configure.log
There has been an error while running configure. Halting the installation.

Вот такая фигня - на свежую федору не ставились ruby.
gcc, gcc-c++ установлено

Содержимое лога при этом: 
[elena@localhost ~]$ cat /home/elena/.rvm/log/ruby-2.0.0-p247/1374331593_configure.log
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/elena/.rvm/src/ruby-2.0.0-p247':
configure: error: C compiler cannot create executables
See `config.log' for more details

Фиг с ним unknown linux - c compiller не пашет оО

Как решилось:
$ sudo yum install clang glibc-devel

Что-то из этого помогло.