| 1 |
== Installation and initial setup for deprec2 |
|---|
| 2 |
|
|---|
| 3 |
Install deprec with the following command (requires ruby and rubygems installed) |
|---|
| 4 |
|
|---|
| 5 |
sudo gem install deprec |
|---|
| 6 |
|
|---|
| 7 |
Let's create a directory to manage all our host config details |
|---|
| 8 |
This supports as many hosts as you need to manage and will be the dir |
|---|
| 9 |
you run your deprec commands from when managing the servers. Note that |
|---|
| 10 |
you don't need to do this if you just want to deploy a single Ruby on |
|---|
| 11 |
Rails application. In this case the config/ dir in your project can |
|---|
| 12 |
serve the same purpose. For those who aren't interested in Ruby on Rails |
|---|
| 13 |
or want to use deprec for more than just deploying one rails app, the |
|---|
| 14 |
following may come in handy. |
|---|
| 15 |
|
|---|
| 16 |
mkdir -p sys/config # change 'sys' to whatever you want |
|---|
| 17 |
cd sys # |
|---|
| 18 |
depify . # create Capfile and config/deploy.rb |
|---|
| 19 |
cap deprec:ssh:config_gen # generates ssh server configs |
|---|
| 20 |
|
|---|
| 21 |
If you have an authorized_keys file, copy it to a location where deprec |
|---|
| 22 |
can find it. Deprec will then offer to copy it out to remote hosts when |
|---|
| 23 |
you setup new accounts for yourself. If you don't have authorized_keys, |
|---|
| 24 |
copy out your id_rsa.pub or id_dsa.pub. |
|---|
| 25 |
|
|---|
| 26 |
You can also put the authorized_keys of colleagues in this dir and deprec |
|---|
| 27 |
will offer to copy them out when creating accounts for them too. |
|---|
| 28 |
|
|---|
| 29 |
We name these files using the username of their owner. |
|---|
| 30 |
|
|---|
| 31 |
cp ~/.ssh/authorized_keys config/ssh/authorized_keys/${USER} |
|---|
| 32 |
|
|---|
| 33 |
Define an environment variable for the server we'll be working on |
|---|
| 34 |
|
|---|
| 35 |
export HOSTS=<your.slice.address> |
|---|
| 36 |
|
|---|
| 37 |
Change the root password you received for your new slice. |
|---|
| 38 |
|
|---|
| 39 |
cap deprec:users:passwd USER=root |
|---|
| 40 |
|
|---|
| 41 |
Enter user to change password for |root| |
|---|
| 42 |
Password: |
|---|
| 43 |
Enter new UNIX password: |
|---|
| 44 |
Retype new UNIX password: |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
Create an account with sudo access for mysql^H^Hself |
|---|
| 48 |
|
|---|
| 49 |
cap deprec:users:add USER=root |
|---|
| 50 |
|
|---|
| 51 |
Enter userid for new user |root| |
|---|
| 52 |
mbailey |
|---|
| 53 |
Should this be an admin account? |no| |
|---|
| 54 |
yes |
|---|
| 55 |
I've found an authorized_keys file for mbailey. Should I copy it out? |yes| |
|---|
| 56 |
Password: |
|---|
| 57 |
Setting pasword for new account |
|---|
| 58 |
Enter new UNIX password: |
|---|
| 59 |
Retype new UNIX password: |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
Create another account without sudo access for a colleague. |
|---|
| 63 |
Notice how I longer need to specify USER=root? That's because I'm using the |
|---|
| 64 |
account I just created. |
|---|
| 65 |
|
|---|
| 66 |
cap deprec:users:add |
|---|
| 67 |
|
|---|
| 68 |
Enter userid for new user |mbailey| |
|---|
| 69 |
ben |
|---|
| 70 |
Should this be an admin account? |no| |
|---|
| 71 |
Password: |
|---|
| 72 |
Setting pasword for new account |
|---|
| 73 |
Enter new UNIX password: |
|---|
| 74 |
Retype new UNIX password: |
|---|
| 75 |
|
|---|
| 76 |
I prefer to disallow ssh password based login for security reasons. I also |
|---|
| 77 |
turn off DNS lookups by sshd as they are often responsible for a 2 second |
|---|
| 78 |
lag on login. Be warned that turning off ssh passwords will prevent someone |
|---|
| 79 |
without an ssh key setup from logging in so use this with caution. Deprec |
|---|
| 80 |
makes it painless to upload their key when you create their account though |
|---|
| 81 |
so you've got no excuse to leave passwords turned on. |
|---|
| 82 |
|
|---|
| 83 |
You can upload the ssh configs currently residing in config/ssh/etc/ssh by |
|---|
| 84 |
running this: |
|---|
| 85 |
|
|---|
| 86 |
cap deprec:ssh:config |
|---|
| 87 |
|
|---|
| 88 |
You can now continue to the other READMEs |
|---|