Create a group for a system user (daemnos and program users like www-data, mysql...)
# addgroup --system jboss
Create a user (system user, without home -> See below the command, to the jboss group and no login shell)
| <cluster-user>admin</cluster-user> | |
| <cluster-password>mypassword</cluster-password> |
| #!/bin/bash | |
| # | |
| # PostgreSQL Backup Script Ver 1.0 | |
| # http://autopgsqlbackup.frozenpc.net | |
| # Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
| # | |
| # This script is based of the AutoMySQLBackup Script Ver 2.2 | |
| # It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
| # | |
| # The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/usr/bin/ruby | |
| # Implementation of a bit set which stores membershio in binary | |
| # Strings managed in chunks. | |
| class BitSet | |
| ZERO = "\000".encode(Encoding::BINARY).freeze | |
| DEFAULT_SEGMENT_SIZE = 1024 * 1024 | |
| # Create the BitSet instance. If max_num is given, we preallocate | |
| # as much memory as needed. |
| GEM_HOME=/usr/local/rvm/gems/jruby-1.6.7 | |
| TERM=xterm-256color | |
| JBOSS_HOME=/usr/local/rvm/gems/jruby-1.6.7@global/gems/torquebox-server-2.0.0.cr1-java/jboss | |
| PATH=/usr/local/rvm/gems/jruby-1.6.7/bin:/usr/local/rvm/gems/jruby-1.6.7@global/bin:/usr/local/rvm/rubies/jruby-1.6.7/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games | |
| JRUBY_HOME=/usr/local/rvm/rubies/jruby-1.6.7 | |
| LANG=en_US.UTF-8 | |
| TORQUEBOX_HOME=/usr/local/rvm/gems/jruby-1.6.7@global/gems/torquebox-server-2.0.0.cr1-java | |
| GEM_PATH=/usr/local/rvm/gems/jruby-1.6.7:/usr/local/rvm/gems/jruby-1.6.7@global | |
| JRUBY_OPTS=--1.9 | |
| SHELL=/bin/bash |
| 15:39:06,062 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "current-knob.yml" | |
| 15:39:06,639 INFO [org.torquebox.core.runtime] (Thread-109) Initialize? true | |
| 15:39:06,639 INFO [org.torquebox.core.runtime] (Thread-109) Initializer=org.torquebox.web.rack.RackRuntimeInitializer@7df86f75 | |
| 15:39:06,979 INFO [org.torquebox.core.runtime] (Thread-109) Setting up Bundler | |
| 15:39:08,138 INFO [stdout] (Thread-109) Could not find rake-0.8.7 in any of the sources | |
| 15:39:08,138 INFO [stdout] (Thread-109) Run `bundle install` to install missing gems. | |
| 15:39:08,139 ERROR [org.torquebox.core.runtime] (Thread-109) Error during evaluation: require %q(bundler/setup): org.jruby.exceptions.RaiseException: (SystemExit) exit | |
| at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:856) [jruby.jar:] | |
| at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:825) [jruby.jar:] | |
| at (Anonymous).(root)(/opt/torquebox-current/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/setup.rb:14) at org.jruby.RubyK |
| ## Prepare ################################################################### | |
| # Remove RVM | |
| rvm implode | |
| # Ensure your homebrew is working properly and up to date | |
| brew doctor | |
| brew update | |
| ## Install ################################################################### |
| require 'net/ftp' | |
| CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk" | |
| CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login" | |
| CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password" | |
| # LOGIN and LIST available files at default home directory | |
| Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp| | |
| files = ftp.list |
| include_recipe "postgresql::server90" | |
| # inspiration from | |
| # https://gist.github.com/637579 | |
| execute "create-root-user" do | |
| code = <<-EOH | |
| psql -U postgres -c "select * from pg_user where usename='root'" | grep -c root | |
| EOH | |
| command "createuser -U postgres -s root" |