www.nico.schottelius.org/docs/rails_hints.mdwn
Nico Schottelius 4df64c5c23 update static image galler generator site
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2010-10-19 13:50:50 +02:00

323 lines
15 KiB
Markdown

- webserver aufsetzen
- datenbankserver aufsetzen
- applikation hochladen
- datenbank erzeugen
- ...
http://www.turnkeylinux.org/rails
23:55 < simplyb> telmich: I'm not sure if slicehost lets you clone via the API
rvm einbinden?
- rvm vorhanden
- rvm 1.8.7
- gem install bundler
- bundle install
--------------------------------------------------------------------------------
PKG=libsqlite3-dev sqlite3 zlib1g-dev libssl-dev
apt-get install $PKG
su - railsuser
export http_proxy=http://proxy.ethz.ch:3128
rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create rails && rvm 1.8.7@rails && gem install bundler && cd rails/ && bundle install && gem install unicorn && unicorn_rails -l /home/mbs/rails/unicorn.sock
Danach:
mbs@sgv-rails-01:~$ cd ~/rails && rvm 1.8.7@rails && unicorn_rails -l /home/mbs/rails/unicorn
Opitimiert:
--------------------------------------------------------------------------------
[21:38] kr:wollmilchsau% rsync -av ./ rvm7@sgv-nicosc-06.ethz.ch:
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.8.7
rvm7@sgv-nicosc-06:~$ rvm install 1.9.2
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.9.1
rvm7@sgv-nicosc-06:~$ rvm gemset create mbs
'gem' was not found, cannot perform gem actions (Do you have an RVM ruby selected?)
rvm7@sgv-nicosc-06:~$ rvm ruby-1.8.7-p302
rvm7@sgv-nicosc-06:~$ rvm gemset create mbs
'mbs' gemset created (/home/rvm7/.rvm/gems/ruby-1.8.7-p302@mbs).
rvm7@sgv-nicosc-06:~$ rvm ruby-1.8.7-p302@mbs
rvm7@sgv-nicosc-06:~$ gem install bundler
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
rvm7@sgv-nicosc-06:~$ rvm ruby-1.9.1-p378
Gemset 'mbs' does not exist, rvm gemset create 'mbs' first.
rvm7@sgv-nicosc-06:~$ rvm gemset create mbs
'mbs' gemset created (/home/rvm7/.rvm/gems/ruby-1.9.1-p378@mbs).
rvm7@sgv-nicosc-06:~$
rvm7@sgv-nicosc-06:~$ gem install bundler
/home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/package.rb:10:in `require': no such file to load -- zlib (LoadError)
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/package.rb:10:in `<top (required)>'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/format.rb:9:in `require'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/format.rb:9:in `<top (required)>'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/installer.rb:11:in `require'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/installer.rb:11:in `<top (required)>'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `require'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `<top (required)>'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `require'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `<top (required)>'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `require'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `rescue in load_and_instantiate'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:132:in `load_and_instantiate'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:65:in `[]'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:118:in `find_command'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:104:in `process_args'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/command_manager.rb:75:in `run'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems/gem_runner.rb:39:in `run'
from /home/rvm7/.rvm/rubies/ruby-1.9.1-p378/bin/gem:29:in `<main>'
rvm7@sgv-nicosc-06:~$
root@sgv-nicosc-06:~# apt-get install zlib1g-dev
rvm7@sgv-nicosc-06:~$ rvm uninstall ruby-1.8.7-p302 ruby-1.9.1-p378
Removing /home/rvm7/.rvm/rubies/ruby-1.9.1-p378...
rvm7@sgv-nicosc-06:~$ rvm uninstall ruby-1.8.7-p302
Removing /home/rvm7/.rvm/rubies/ruby-1.8.7-p302...
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.8.7
Installing Ruby from source to: /home/rvm7/.rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...
#fetching ruby-1.8.7-p302
#extracting ruby-1.8.7-p302 to /home/rvm7/.rvm/src/ruby-1.8.7-p302 (already extracted)
#configuring ruby-1.8.7-p302
#compiling ruby-1.8.7-p302
#installing ruby-1.8.7-p302
#rubygems installing to ruby-1.8.7-p302
#shebangs adjustment for ruby-1.8.7-p302 (gem irb erb ri rdoc testrb rake).
#importing initial gems
#complete install of ruby-1.8.7-p302
rvm7@sgv-nicosc-06:~$ rvm ruby-1.8.7-p302
rvm7@sgv-nicosc-06:~$ rm -rf .rvm
rvm7@sgv-nicosc-06:~$ rm -rf .rvm
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.8.7 && rvm ruby-1.8.7 && gem install bundler
Installing Ruby from source to: /home/rvm7/.rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...
#fetching ruby-1.8.7-p302
Downloading ruby-1.8.7-p302, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4086k 100 4086k 0 0 239k 0 0:00:17 0:00:17 --:--:-- 407k
#extracting ruby-1.8.7-p302 to /home/rvm7/.rvm/src/ruby-1.8.7-p302
#configuring ruby-1.8.7-p302
#compiling ruby-1.8.7-p302
#installing ruby-1.8.7-p302
#rubygems installing to ruby-1.8.7-p302
Retrieving rubygems-1.3.7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 284k 100 284k 0 0 351k 0 --:--:-- --:--:-- --:--:-- 351k
Extracting rubygems-1.3.7 ...
#shebangs adjustment for ruby-1.8.7-p302 (gem irb erb ri rdoc testrb rake).
#importing initial gems
#complete install of ruby-1.8.7-p302
Successfully installed bundler-1.0.0
1 gem installed
Installing ri documentation for bundler-1.0.0...
Installing RDoc documentation for bundler-1.0.0...
rvm7@sgv-nicosc-06:~$
rvm7@sgv-nicosc-06:~$ gem install bundler
rvm7@sgv-nicosc-06:~$ git clone git://git.sans.ethz.ch/mbs
Initialized empty Git repository in /home/rvm7/mbs/.git/
remote: Counting objects: 1648, done.
remote: Compressing objects: 100% (591/591), done.
remote: Total 1648 (delta 984), reused 1641 (delta 981)
Receiving objects: 100% (1648/1648), 233.86 KiB, done.
Resolving deltas: 100% (984/984), done.
rvm7@sgv-nicosc-06:~$
rvm7@sgv-nicosc-06:~$ cd mbs/
rvm7@sgv-nicosc-06:~/mbs$ bundle install
Detected Gemfile.lock generated by 0.9, deleting...
Fetching source index for http://rubygems.org/
root@sgv-nicosc-06:~# apt-get install libsqlite3-dev sqlite3
rvm7@sgv-nicosc-06:~/mbs$ rvm implode
Are you SURE you wish for rvm to implode? This will remove /home/rvm7/.rvm ? (type 'yes' or 'no')
yes
Hai! Removing /home/rvm7/.rvm
/home/rvm7/.rvm has been removed.
rvm7@sgv-nicosc-06:~/mbs$ cd
rvm7@sgv-nicosc-06:~$
--------------------------------------------------------------------------------
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create mbs && gem install bundler && cd mbs/ && bundle install
==> missing rvm ruby-1.8.7@mbs!
--------------------------------------------------------------------------------
rvm7@sgv-nicosc-06:~$ rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create mbs && rvm ruby-1.8.7@mbs && gem install bundler && cd mbs/ && bundle install
--------------------------------------------------------------------------------
Extracting rubygems-1.3.7 ...
#shebangs adjustment for ruby-1.8.7-p302 (gem irb erb ri rdoc testrb rake).
#importing initial gems
#complete install of ruby-1.8.7-p302
'mbs' gemset created (/home/rvm7/.rvm/gems/ruby-1.8.7-p302@mbs).
Successfully installed bundler-1.0.0
1 gem installed
Installing ri documentation for bundler-1.0.0...
Installing RDoc documentation for bundler-1.0.0...
Fetching source index for http://rubygems.org/
Installing rake (0.8.7)
Installing abstract (1.0.0)
Installing activesupport (3.0.0.beta4)
Installing builder (2.1.2)
Installing i18n (0.4.1)
Installing activemodel (3.0.0.beta4)
Installing erubis (2.6.6)
Installing rack (1.1.0)
Installing rack-mount (0.6.13)
Installing rack-test (0.5.4)
Installing tzinfo (0.3.23)
Installing actionpack (3.0.0.beta4)
Installing mime-types (1.16)
Installing polyglot (0.3.1)
Installing treetop (1.4.8)
Installing mail (2.2.5)
Installing actionmailer (3.0.0.beta4)
Installing arel (0.4.0)
Installing activerecord (3.0.0.beta4)
Installing activeresource (3.0.0.beta4)
Using bundler (1.0.0)
Installing thor (0.13.8)
Installing railties (3.0.0.beta4)
Installing rails (3.0.0.beta4)
Installing sqlite3-ruby (1.3.1) with native extensions
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Your bundle was installed to `/home/rvm7/.rvm/gems/ruby-1.8.7-p302@mbs`
rvm7@sgv-nicosc-06:~/mbs$ rails server
=> Booting WEBrick
=> Rails 3.0.0.beta4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-09-08 14:28:06] INFO WEBrick 1.3.1
[2010-09-08 14:28:06] INFO ruby 1.8.7 (2010-08-16) [x86_64-linux]
[2010-09-08 14:28:06] INFO WEBrick::HTTPServer#start: pid=15658 port=3000
--------------------------------------------------------------------------------
railsuser2@sgv-rails-01:~$ rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create rails && gem install bundler && cd rails/ && bundle install
railsuser2@sgv-rails-01:~$ export http_proxy=http://proxy.ethz.ch:3128 && rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create rails && gem install bundler && cd rails/ && bundle install
--------------------------------------------------------------------------------
export http_proxy=http://proxy.ethz.ch:3128 && rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create rails && gem install bundler && cd rails/ && bundle install && gem install unicorn && unicorn_rails -l /home/mbs/rails/unicorn.sock
mbs@sgv-rails-01:~$ export http_proxy=http://proxy.ethz.ch:3128 && rvm install ruby-1.8.7 && rvm ruby-1.8.7 && rvm gemset create rails && rvm rails@1.8.7 && gem install bundler && cd rails/ && bundle install && gem install unicorn && unicorn_rails -l /home/mbs/rails/unicorn.sock
mbs@sgv-rails-01:~/rails$ rvm 1.8.7
mbs@sgv-rails-01:~/rails$ un
unalias unexpand unlink unxz
uname unicode_start unlzma unzip
unattended-upgrade unicode_stop unset unzipsfx
unattended-upgrades uniq unshare
uncompress unix_chkpwd until
unconfined unix_update unwrapdiff
mbs@sgv-rails-01:~/rails$ un
mbs@sgv-rails-01:~/rails$ find /home/mbs/.rvm/ -name unicorn\*
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/bin/unicorn_rails
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/bin/unicorn
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/cache/unicorn-1.1.4.gem
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/bin/unicorn_rails
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/bin/unicorn
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http/unicorn_http.o
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http/unicorn_http.c
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http/unicorn_http.rl
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http/unicorn_http.so
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/ext/unicorn_http/unicorn_http_common.rl
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/unicorn.gemspec
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/Documentation/unicorn_rails.1.txt
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/Documentation/unicorn.1.txt
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/man/man1/unicorn_rails.1
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/man/man1/unicorn.1
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/lib/unicorn.rb
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/lib/unicorn_http.so
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/lib/unicorn
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/examples/unicorn.conf.rb
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/gems/unicorn-1.1.4/examples/unicorn.conf.minimal.rb
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/specifications/unicorn-1.1.4.gemspec
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/doc/unicorn-1.1.4
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/doc/unicorn-1.1.4/rdoc/files/ext/unicorn_http
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/doc/unicorn-1.1.4/rdoc/files/ext/unicorn_http/unicorn_http_c.html
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/doc/unicorn-1.1.4/rdoc/files/lib/unicorn_rb.html
/home/mbs/.rvm/gems/ruby-1.8.7-p302@1.8.7/doc/unicorn-1.1.4/rdoc/files/lib/unicorn
mbs@sgv-rails-01:~/rails$
mbs@sgv-rails-01:~/rails$ gem install bundler && cd rails/ && bundle install && gem install unicorn && unicorn_rails -l /home/mbs/rails/unicorn.sock2
- gem zu alt auf server
- capistrano:
- keine echten dependencies -> gems werden nicht installiert
- bundler nicht auf zielsystem vorhanden
- integration in unicorn schwierig (current wechselt)
- wann ist capistrano sinnvoll
- rvm im user als lösung?
--------------------------------------------------------------------------------
Notizen:
- hosting als "notwendiges übel"
- keine zeit für sysadmin-sachen
- vmware ->> squeeze ->> vserver
- puppetmaster auf vserver
- lxc?
- dateien im fs
- i: collectd >> munin
- dns nicht automatisiert
- vhost erzeugen und vernichten mit puppet !
- gems: als root besser: rake / bundler
- gem selber kompiliert im root!
- rvm: layer++;
- gem-update
- rails / passenger: suid als user
- shared/system
- vim: command t
- vim: vc über mehrere zeilen
- cijoe <=> webseite
- fatfree => crm
- highrise
- basecamp
- balanced scorecard
--- vserver
- "one click install" / cpanel
- vserver-hosting
- "heroku-konkurrenz"
- puppet consulting / 0900er
--------------------------------------------------------------------------------
config/application,rb:
config.generators do |g|
g.template_engine :haml
end
git submodule add git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml
- nginx
- unicorn
- restarts?
- cluster?