Skip to content

Instantly share code, notes, and snippets.

@jeffrafter
Created September 13, 2008 13:18
Show Gist options
  • Select an option

  • Save jeffrafter/10598 to your computer and use it in GitHub Desktop.

Select an option

Save jeffrafter/10598 to your computer and use it in GitHub Desktop.

Revisions

  1. jeffrafter revised this gist Mar 1, 2009. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions SERVER_INSTALLS
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@ For baobab we name our computers after trees so I called this one Sapele
    I added the default user as baobab

    ## Reboot and login
    hostname datadyne

    ## Get the stuff you will need (you may want to combine these steps so you can leave the download running)
    sudo apt-get update
  2. jeffrafter revised this gist Feb 17, 2009. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions SERVER_INSTALLS
    Original file line number Diff line number Diff line change
    @@ -88,6 +88,11 @@ mysql -u root -p
    > CREATE DATABASE openmrs;
    > GRANT ALL on openmrs.* to 'openmrs' IDENTIFIED BY 'YOURPASS'

    ## On the server, you need to install RubyEE.
    wget http://rubyforge.org/frs/download.php/51101/ruby-enterprise_1.8.6-20090201_i386.deb
    sudo dpkg -i ruby-enterprise_1.8.6-20090201_i386.deb
    /opt/ruby-enterprise/bin/passenger-install-apache2-module


    ## On your local, cross your fingers and deploy (cap -T if you want to see all tasks)
    ## I have noticed that the deploy and deploy:setup tasks rely on each other
  3. jeffrafter revised this gist Feb 9, 2009. 1 changed file with 24 additions and 3 deletions.
    27 changes: 24 additions & 3 deletions SERVER_INSTALLS
    Original file line number Diff line number Diff line change
    @@ -76,22 +76,43 @@ exit
    sudo mkdir /var/www/mateme
    sudo chown deploy:deploy /var/www/mateme

    sudo mkdir /var/www/staging
    sudo chown deploy:deploy /var/www/staging

    ## On the server, setup the database
    ## We should be calling the database openmrs, with the user openmrs
    ## The password should be common probably

    ## ***** IF YOU ARE WORKING WITH AN EXISTING INSTALLATION DO NOT CHANGE THE OPENMRS DATABASE *******
    mysql -u root -p
    > CREATE DATABASE openmrs;
    > GRANT ALL on openmrs.* to 'openmrs' IDENTIFIED BY 'YOURPASS'

    ## You may have alternate database setup steps here. See
    ##


    ## On your local, cross your fingers and deploy (cap -T if you want to see all tasks)
    ## I have noticed that the deploy and deploy:setup tasks rely on each other
    ## So you have to run cap deploy first and let it fail...
    ## then run setup, then run deploy again
    cap deploy

    ## Everytime you will be asked a series of questions:

    $ cap deploy
    Do you want to stage this deployment? (y/n): y ## changes the target folder (either /var/www/mateme or /var/www/staging)
    Domain you are deploying to (IP Address or Hostname): neno ## I have "neno" in my /etc/hosts point to the server. If you can use an internal address it will save the round trip to the internet
    Pull from current machine (192.168.1.111)? (y/n): n ## If the server can see your machine on the network (at the address shown) then do it, this will also save a round trip to the internet
    Pull from distributed git repository? (y/n): n ## generally just say no here
    Pull from shared github.com (public)? (y/n): n ## This pulls from baobab/mateme on github... not currently in sync with neno
    Pull from alternate github.com (public)? (y/n): y ## if you said no to everything else, you need to say yes here
    Github Repository (jeffrafter/mateme): cherodney/mateme ## pulls from master on a specific fork... specify the fork as shown

    ##






    cap deploy:setup
    cap deploy

  4. jeffrafter revised this gist Feb 9, 2009. 1 changed file with 4 additions and 15 deletions.
    19 changes: 4 additions & 15 deletions SERVER_INSTALLS
    Original file line number Diff line number Diff line change
    @@ -50,6 +50,7 @@ Defaults env_reset, insults

    ## Back on your local create your public key if you have not done so already
    ## Read the earlier note on Ubuntu <= 8.04 and openssh-client
    ## ****** If you have already generated your key ** DO NOT REGENERATE ************
    cd
    ssh-keygen -t rsa
    Enter file in which to save the key (/home/YOURLOCALUSER/.ssh/id_rsa): <Enter>
    @@ -74,7 +75,6 @@ exit
    ## On the server, create the root project folder (our project is called "mateme")
    sudo mkdir /var/www/mateme
    sudo chown deploy:deploy /var/www/mateme
    sudo mkdir /etc/mongrel_cluster

    ## On the server, setup the database
    ## We should be calling the database openmrs, with the user openmrs
    @@ -83,6 +83,9 @@ mysql -u root -p
    > CREATE DATABASE openmrs;
    > GRANT ALL on openmrs.* to 'openmrs' IDENTIFIED BY 'YOURPASS'

    ## You may have alternate database setup steps here. See
    ##


    ## On your local, cross your fingers and deploy (cap -T if you want to see all tasks)
    ## I have noticed that the deploy and deploy:setup tasks rely on each other
    @@ -92,21 +95,7 @@ cap deploy
    cap deploy:setup
    cap deploy

    cap nginx:setup
    cap nginx:start

    * run the db/migrate scripts
    * run the bootstrap

    cap deploy:restart

    # ------------- Firefox
    # READ the firefox README
    # If you don't have the firefox daemon it is here https://github.com/baobab/firefox-daemon


    ## We need to add something here about temp
    ## We need to add something here about setting up the success tasks
    ## We need to add something here about making sure the machine can run headless
    ## We need to add something here about making sure the machine auto-reboots on power cut
    #
  5. jeffrafter renamed this gist Jan 20, 2009. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. jeffrafter revised this gist Jan 20, 2009. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions SERVER_INSTALL
    Original file line number Diff line number Diff line change
    @@ -109,3 +109,4 @@ cap deploy:restart
    ## We need to add something here about setting up the success tasks
    ## We need to add something here about making sure the machine can run headless
    ## We need to add something here about making sure the machine auto-reboots on power cut
    #
  7. jeffrafter revised this gist Sep 13, 2008. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions SERVER_INSTALL
    Original file line number Diff line number Diff line change
    @@ -103,3 +103,9 @@ cap deploy:restart
    # ------------- Firefox
    # READ the firefox README
    # If you don't have the firefox daemon it is here https://github.com/baobab/firefox-daemon


    ## We need to add something here about temp
    ## We need to add something here about setting up the success tasks
    ## We need to add something here about making sure the machine can run headless
    ## We need to add something here about making sure the machine auto-reboots on power cut
  8. jeffrafter revised this gist Sep 13, 2008. 1 changed file with 17 additions and 1 deletion.
    18 changes: 17 additions & 1 deletion SERVER_INSTALL
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    ## Install
    ## See also (http://codeplot.com/documents/3186/edit)
    I Installed Ubuntu 8.04 Server
    US Keyboard Layout
    Zimbabwe region
    @@ -75,14 +76,29 @@ sudo mkdir /var/www/mateme
    sudo chown deploy:deploy /var/www/mateme
    sudo mkdir /etc/mongrel_cluster

    ## On your local, cross your fingers and deploy
    ## On the server, setup the database
    ## We should be calling the database openmrs, with the user openmrs
    ## The password should be common probably
    mysql -u root -p
    > CREATE DATABASE openmrs;
    > GRANT ALL on openmrs.* to 'openmrs' IDENTIFIED BY 'YOURPASS'


    ## On your local, cross your fingers and deploy (cap -T if you want to see all tasks)
    ## I have noticed that the deploy and deploy:setup tasks rely on each other
    ## So you have to run cap deploy first and let it fail...
    ## then run setup, then run deploy again
    cap deploy
    cap deploy:setup
    cap deploy

    cap nginx:setup
    cap nginx:start

    * run the db/migrate scripts
    * run the bootstrap

    cap deploy:restart

    # ------------- Firefox
    # READ the firefox README
  9. jeffrafter renamed this gist Sep 13, 2008. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. jeffrafter revised this gist Sep 13, 2008. 1 changed file with 13 additions and 12 deletions.
    25 changes: 13 additions & 12 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -70,19 +70,20 @@ chmod 600 /home/deploy/.ssh/authorized_keys
    chown -R deploy:deploy /home/deploy/.ssh
    exit

    ## Install the new OpenJDK from Sun
    sudo apt-get install openjdk-6-jre
    ## On the server, create the root project folder (our project is called "mateme")
    sudo mkdir /var/www/mateme
    sudo chown deploy:deploy /var/www/mateme
    sudo mkdir /etc/mongrel_cluster

    # ------------- Firefox


    sudo apt-get install dnsmasq firefox-2
    sudo apt-get install xorg xserver xserver-xorg-core
    sudo apt-get install xinit xauth
    displayconfig-gtk libgl1-mesa-dri xfonts-base xfonts-100dpi xfonts-75dpi xfonts-scalable
    ## On your local, cross your fingers and deploy
    cap deploy:setup
    cap deploy
    cap nginx:start

    sudo adduser --disabled-password firefox
    * run the db/migrate scripts
    * run the bootstrap



    READ the firefox README
    # ------------- Firefox
    # READ the firefox README
    # If you don't have the firefox daemon it is here https://github.com/baobab/firefox-daemon
  11. jeffrafter created this gist Sep 13, 2008.
    88 changes: 88 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    ## Install
    I Installed Ubuntu 8.04 Server
    US Keyboard Layout
    Zimbabwe region
    If this machine was using an SSD drive configure the paritions so that it has no swap
    I did a single partition marked as bootable and setup for the root on EXT3+Journaling
    I marked the OpenSSH server as an additional option
    I did not set it as a DNS server or Mail Server

    ## Naming
    For baobab we name our computers after trees so I called this one Sapele
    I added the default user as baobab

    ## Reboot and login

    ## Get the stuff you will need (you may want to combine these steps so you can leave the download running)
    sudo apt-get update
    sudo apt-get install mysql-server nginx build-essential sudo git-core openssl lynx

    ## At the end you will need to input the mysql root password
    In general we create paswords with a hash of the machine name, a common nonce value and some special characters

    ## Update the ssh for Debian security vulnerability
    ## If you are running Ubuntu/Debian locally, you should do this on your machine *before*
    ## You ssh into the server!
    sudo apt-get install openssh-client

    ## Check for vulnerable keys
    If you are using 8.04 like me (I think that Intrepid will include this fix by default)
    Then you will get a message saying that it is correcting the blacklisted keys
    When completed, you should run ssh-vulnkey to make sure your root user is
    Not blacklisted. You should see two keys listed and both should start with
    "Not blacklisted:"
    ssh-vulnkey

    ## Setup users on your server
    sudo adduser --disabled-password deploy
    sudo adduser --system --no-create-home --group --disabled-password www
    sudo visudo

    ## Add to the end of the visudo file (someone needs to add a quick vi how-to here)
    deploy ALL=(ALL) ALL

    ## As an option you can give the deploy user more freedom if you control the keys carefully:
    deploy ALL=(ALL) NOPASSWD:ALL

    ## For extra credit, change the defaults in the visudo file to insult people that try to enter passwords
    Defaults env_reset, insults

    ## Back on your local create your public key if you have not done so already
    ## Read the earlier note on Ubuntu <= 8.04 and openssh-client
    cd
    ssh-keygen -t rsa
    Enter file in which to save the key (/home/YOURLOCALUSER/.ssh/id_rsa): <Enter>
    Enter passphrase (empty for no passphrase): <Enter>
    Enter same passphrase again: <Enter>

    ## On your local scp your public key up (note that I use the baobab user I created when installing Ubuntu on the server)
    ## Make sure you copy the id_rsa.pub and not the id_rsa, the id_rsa file is your private key and you want to keep it safe!
    ## If you don't know your server's ip address, type ifconfig on the server
    scp ~/.ssh/id_rsa.pub baobab@YOURSERVERIP:/tmp
    password: <Enter your server's baobab user password>

    ## On the server setup the key for your deploy user (you need to be root)
    sudo su
    mkdir /home/deploy/.ssh
    chmod 700 /home/deploy/.ssh
    cat /tmp/id_rsa.pub >> /home/deploy/.ssh/authorized_keys
    chmod 600 /home/deploy/.ssh/authorized_keys
    chown -R deploy:deploy /home/deploy/.ssh
    exit

    ## Install the new OpenJDK from Sun
    sudo apt-get install openjdk-6-jre

    # ------------- Firefox


    sudo apt-get install dnsmasq firefox-2
    sudo apt-get install xorg xserver xserver-xorg-core
    sudo apt-get install xinit xauth
    displayconfig-gtk libgl1-mesa-dri xfonts-base xfonts-100dpi xfonts-75dpi xfonts-scalable

    sudo adduser --disabled-password firefox



    READ the firefox README