bundle install --without=test development
bundle will remember these settings so next time if you run "bundle install" it will set only production
haim lankry
Wednesday, July 31, 2013
Friday, July 26, 2013
Manage a fork of git repository - Redmine
Manage a fork of git repository - Redmine
Using redmine I want to maintain my own custom redmine , and still be able to update with latest changes from newer version.
I have forked the redmine repo , and created 2 local branches:
my_work - dvelopment branch with my changes
my_deploy - the version that is on production
>git remote -v
origin git@github.com:haimlankry/redmine-1.git (fetch)
origin git@github.com:haimlankry/redmine-1.git (push)
upstream git://github.com/redmine/redmine.git (fetch)
upstream git://github.com/redmine/redmine.git (push)
The "origin" is my fork of the original git, located on the "upstream" remote.
first we will update from upstream to get the latest updates:
>git fetch upstream
Re-basing
We had before 2 branches, my_work and my_deploy, in my_work, we have some changes relative to an old version in the upstream (2.2-stable), we will take only our changes and rebase them on a newer version.we should be in the my_work branch .
we can check before rebasing to see our changes only using:
>git log upstream/2.3-stable..HEAD
we should see only our changes listed
Then we do the rebase:
>git rebase upstream/2.3-stable
Now our my_work branch , has the new version (2.3-stable) and our changes applied as the last commits.
Deploy
We will override the my_deploy branch with the my_work version.
We first move to the my_deploy branch>git co my_deploy
Switched to branch 'my_deploy'
>git reset --hard my_work
Now we have the my_deploy branch with the latest version.
now we should updated the origin remote branch, with both branches changes.
we have to force push cause we changed the commit history.
>git push origin -f
...
To git@github.com:haimlankry/redmine-1.git
+ 60d222b...2ea745b my_deploy -> my_deploy (forced update)
+ 7ccf04b...2ea745b my_work -> my_work (forced update)
...
last step is to update the version on the remote server by pulling
production server
stop the web server (sudo service apache2 stop)
git fetch origin my_deploy
git reset origin/my_deploy --hard
start the apache http
Monday, June 18, 2012
capistrano deploy and multistage
Just a check list :
cap deploy:setup - use for the first time
cap deploy:check - check that the system is ok and ready for deploy
multi stage example deploy.rb :
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# since :domain is defined in another file (staging.rb and production.rb),
# we need to delay its assignment until they're loaded
set(:domain) { "#{domain}" }
role(:web) { domain }
And in deploy/staging.rb
set :domain, '111.111.210.211'
set :user, "username"
set :deploy_to, "/home/rubyapps/#{application}"
set :rails_env, "staging"
cap deploy:setup - use for the first time
cap deploy:check - check that the system is ok and ready for deploy
multi stage example deploy.rb :
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# since :domain is defined in another file (staging.rb and production.rb),
# we need to delay its assignment until they're loaded
set(:domain) { "#{domain}" }
role(:web) { domain }
And in deploy/staging.rb
set :domain, '111.111.210.211'
set :user, "username"
set :deploy_to, "/home/rubyapps/#{application}"
set :rails_env, "staging"
Use Bitnami Redmine for deploy of my redmine version
I need to deploy Redmine on windows ,to minimize work and issues, I use Bitnami Redmine for windows installer.
I will update the installtion to use my own custom version of redmine , that will be stored on a remote git branch (currently github).
2. Goto BitNami\RedmineStack\apps\redmine folder , rename the "htdocs" folder to "htdocs_org" and create a new blank "htdocs" folder.
3. In the blank "htdocs" folder , we will init a new git repo and link it to our remote branch by doing :
cd htdocs
git init
git remote add -t my_work -f origin git://github.com/haimlankry/redmine-1.git
git checkout my_work
At this stage you should have a full redmine project from your git, now will copy some data from the original folder.
4. Copy the folowing folders and files from "htdocs_org" to "htdocs" in the relevant location
root: .bundle, bin , Gemfile.lock
config/database.yml configuration.rb and additional_environment.rb
tmp/ cache sessions and sockets folder
config\initializers\secret_token.rb
5. Add to the Gemfile the line: gem 'thin' #(if it is not allready in the gemfile)
Test your settings buy starting the thin server, (takes a while on windows) :
start mysql using the service manager utility (or any other way) then type:
bundle exec thin start -e production -p 3001 --prefix /redmine
This should start a thin webserver listens on port 3001 , you can check on the browser for :
http://localhost:3001/redmine
This should result in the redmine home page.
Thats it , now you can develop on your machine , push to git hub, then "git clone" on deploy to get latest update.
I will update the installtion to use my own custom version of redmine , that will be stored on a remote git branch (currently github).
The steps
1. Install redmine stack from bitnami , make sure that every thing is working (browser), then stop all services of Redmine stack.2. Goto BitNami\RedmineStack\apps\redmine folder , rename the "htdocs" folder to "htdocs_org" and create a new blank "htdocs" folder.
3. In the blank "htdocs" folder , we will init a new git repo and link it to our remote branch by doing :
cd htdocs
git init
git remote add -t my_work -f origin git://github.com/haimlankry/redmine-1.git
git checkout my_work
At this stage you should have a full redmine project from your git, now will copy some data from the original folder.
4. Copy the folowing folders and files from "htdocs_org" to "htdocs" in the relevant location
root: .bundle, bin , Gemfile.lock
config/database.yml configuration.rb and additional_environment.rb
tmp/ cache sessions and sockets folder
config\initializers\secret_token.rb
5. Add to the Gemfile the line: gem 'thin' #(if it is not allready in the gemfile)
Test your settings buy starting the thin server, (takes a while on windows) :
start mysql using the service manager utility (or any other way) then type:
bundle exec thin start -e production -p 3001 --prefix /redmine
This should start a thin webserver listens on port 3001 , you can check on the browser for :
http://localhost:3001/redmine
This should result in the redmine home page.
Thats it , now you can develop on your machine , push to git hub, then "git clone" on deploy to get latest update.
Thursday, June 7, 2012
Git And ssh on server
Adding a user to existing server to have git access sup
connect users toserver withut pssword , using public key that is in the .ssh/authorized_keys ander the home user folder
Verify that user is owner of /home/username and .ssh and authrization_keys
$ sudo groupadd developers $ sudo useradd -G developers -d /home/john -m -s /bin/bash john $ sudo useradd -G developers -d /home/andrew -m -s /bin/bash andrew
$ sudo passwd john $ sudo passwd andrew
connect users toserver withut pssword , using public key that is in the .ssh/authorized_keys ander the home user folder
Verify that user is owner of /home/username and .ssh and authrization_keys
cd .ssh
chmod og-rw authorized_keys
chmod a-x authorized_keys
cd ~
chmod 700 .ssh
the user public key should have strict access so we need to :
chmod u+rwx /home/ec2-user/.ssh/ -R
chmod a-rwx /home/ec2-user/.ssh/ -R ??? not sure
Tuesday, June 5, 2012
Install apache & passenger for rails on amazon linux
First we need to have apache and curl-dev installed using root..
sudo -s
yum install httpd httpd-devel
yum install libcurl-devel
exit
# now install passenger , if you have problems with gemfiles , fix them first. (check bundle )
gem install passenger
passenger-install-apache2-module
if all goes good you should get instructions like this :
---------------------------------------------------------------
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-head@smifr/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
/usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
------------------------------
follow the instractions and update the httpd.conf file , to find it use the command :
apachectl -V
then restart apache using
apachectl -k restart
# After configuring httpd.conf the restart has an error, you need to provide more rights I did:
sudo -s
yum install httpd httpd-devel
yum install libcurl-devel
exit
# now install passenger , if you have problems with gemfiles , fix them first. (check bundle )
gem install passenger
passenger-install-apache2-module
if all goes good you should get instructions like this :
---------------------------------------------------------------
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-head@smifr/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
/usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
------------------------------
follow the instractions and update the httpd.conf file , to find it use the command :
apachectl -V
then restart apache using
apachectl -k restart
# After configuring httpd.conf the restart has an error, you need to provide more rights I did:
passenger-config --root
#Returns path_to_root
chcon -R -h -t httpd_sys_content_t /path_to_root
403 error :
You should set permissions for the rails app , so apache can access these files
I am runing:
chmod 755 /home/ec2-user/ -R
If still not working ..
in file: /etc/sysconfig/selinux
change to SELinux=enforced to SELinux=disabled
#Returns path_to_root
chcon -R -h -t httpd_sys_content_t /path_to_root
403 error :
You should set permissions for the rails app , so apache can access these files
I am runing:
chmod 755 /home/ec2-user/ -R
If still not working ..
in file: /etc/sysconfig/selinux
change to SELinux=enforced to SELinux=disabled
Monday, June 4, 2012
install sphinx from source on ec2 linux
sphinx install needs my sql location .
download the sources and extract to folder then installed using :
./configure --prefix=/usr/local/sphinx --with-mysql-includes=/usr/include/mysql51/
make
make install
download the sources and extract to folder then installed using :
./configure --prefix=/usr/local/sphinx --with-mysql-includes=/usr/include/mysql51/
make
make install
Subscribe to:
Posts (Atom)