my notes

Deploying with Capistrano 3

gem install capistrano

mkdir ~/project
cd ~/project
cap install

edit

config/deploy.rb

Add stage info to file

For production - config/deploy/production.rb 
For development - config/deploy/develop.rb 


server 'hostname', user: 'username', roles: %w{web app}, port: 22

To deploy, must be in root of project

cd ~/project

cap develop deploy

Notes

- key based ssh logins need to be setup
- deploy key needs to be setup for git

Tags

Zimbra cheatsheat

Relay/Route emails to external smtp server

zmprov ma user@domain.com zimbraMailTransport smtp:mail.example.com:25

Relay/Route all mail destined for a particular domain


zmprov
md example.com zimbraMailCatchAllAddress @example.com
md example.com zimbraMailCatchAllForwardingAddress @example.com
md example.com zimbraMailTransport smtp:other-mta.domain.com

Import user's encrypted password


zmprov ma user@domain.com userPassword '{crypt}$1$rV85sAyx$NGKPhhzAVJ/n7tKnxI4g4.'

Tags

puppet custom fact

We will ad custom puppet fact that will show ruby path.

create file

/etc/puppet/modules/YOU_MODULE_NAME/lib/facter/rubypath.rb

add following ruby code


Facter.add(:rubypath) do
setcode 'which ruby'
end

run on puppet gent

facter --puppet rubypath

Custom facts from modules are only used on puppet runs.

Tags

puppet cheatsheet


puppet config print
puppet config print runinterval
/usr/bin/puppet config set runinterval 1200
puppet parser validate init.pp

Regenerating a Puppet Agent Certificate


puppet resource service puppet ensure=stopped
rm -rf /var/lib/puppet/ssl/
puppet resource service puppet ensure=running

Tags

Setup lvm2

Create physical volume

pvcreate /dev/sda4

Physical volume "/dev/sda4" successfully created

Create a logical volume group called pve

vgcreate pve /dev/sda4

Volume group "pve" successfully created

Create volume group

If you really need to assign all space on partition this is the way to do it. This is not a good idea as snapshots will not work.

lvcreate -l 100%VG -n storage pve

to use 90%
lvcreate -l 90%VG -n storage pve

Tags

Shrink ext4 partition

We want a 10G partition therefore we need to resize the filesystem to a smaller size to something like 9G.


# e2fsck -f /dev/sda2
# resize2fs /dev/sda2 9G

Delete the partition and create a new one with 10 G size.


# cfdisk /dev/sda

Run resize2fs without size parameter


# resize2fs /dev/sda2

Done

Tags