Sunday, July 22, 2012

My flight to nowhere

An example logbook entry added to Blogger. Visit PilotPal.com to get your own Pilot Logbook!

Wednesday, November 24, 2010

Notes on Installing Ubuntu, Tomcat, Apache

  • Install Java (http://openjdk.java.net/install/)
    • sudo apt-get install openjdk-6-jdk
  • Install Tomcat (http://www.ubuntugeek.com/how-to-install-tomcat-6-on-ubuntu-9-04-jaunty.html)
    • sudo apt-get install tomcat6 tomcat6-examples
    • CATALINA_HOME gets set to /usr/share/tomcat6.
    • CATALINA_BASE gets set to /var/lib/tomcat6
    • Webapps in /var/lib/tomcat6. However, we will configure Tomcat to load our web application from the mounted EBS volume, /vol.
    • For Grails application - increase -Xmx and permGen space in /etc/init.d/tomcat6
      • JAVA_OPTS="-Djava.awt.headless=true -Xmx1024M -XX:PermSize=512m -XX:MaxPermSize=512m" (use smaller values for "micro" instance)
    • Disable context reloading
      • edit "/var/lib/tomcat6/conf/Context.xml"
        • <Context reloadable="false">
    • Create "your_application.xml" in /var/lib/tomcat6/conf/Catalina/localhost
      • <?xml version='1.0' encoding='utf-8'?>
        <Context docBase="/vol/
        your_application" path="/your_application" reloadable="false" /> where it is assumed your "unwarred" application resides in /vol/your_application -this is the mounted external EBS volume.
    • Disable security, else, grails gives java.security.AccessControlException: access denied (java.util.PropertyPermission grails.env read) error:
      • Edit /etc/default/tomcat6 and change the line that reads

        #TOMCAT6_SECURITY=yes

        into

        TOMCAT6_SECURITY=no
    • Start/Stop Tomcat: sudo /etc/init.d/tomcat6 start/stop
  • Install Apache:
    • sudo apt-get install apache2 libapache2-mod-jk
  • Apache-Tomcat Integration (http://rcpeters.blogspot.com/2009/05/installing-apache2-and-tomcat6-on.html)
    • This will configure your application to be served under "root", e.g., http://www.yourdomain.com (NOT http://www.yourdomain.com/your_application).
    • sudo vim /etc/apache2/workers.properties:
    • # Define 1 real worker using ajp13
      worker.list=worker1
      # Set properties for worker1 (ajp13)
      worker.worker1.type=ajp13
      worker.worker1.host=localhost
      worker.worker1.port=8009
    • sudo vim /etc/apache2/apache2.conf:
    • # Load mod_jk module
      # Update this path to match your modules location
      LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
      # Declare the module for (remove this line on Apache 2.x)
      #AddModule mod_jk.c
      # Where to find workers.properties
      # Update this path to match your conf directory location (put workers.properties next to httpd.conf)
      JkWorkersFile /etc/apache2/workers.properties
      # Where to put jk shared memory
      # Update this path to match your local state directory or logs directory
      JkShmFile /var/log/apache2/mod_jk.shm
      # Where to put jk logs
      # Update this path to match your logs directory location (put mod_jk.log next to access_log)
      JkLogFile /var/log/apache2/mod_jk.log
      # Set the jk log level [debug/error/info]
      JkLogLevel info
      # Select the timestamp log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    • sudo vim /etc/apache2/sites-enabled/000-default
    • Delete "DocumentRoot /var/www" And type in JkMount / worker1 JkMount /* worker1
      note, you can use JkUnMount to define directories you want apache to serve
    • Enable port 8009 on tomcat
    • sudo vim /etc/tomcat6/server.xml
      uncomment <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    • restart tomcat
    • sudo /etc/init.d/tomcat6 restart
    • restart apache
    • sudo /etc/init.d/apache2 restart
  • For automatic MySQL backup (http://sourceforge.net/projects/automysqlbackup/)
    • copy automysqlbackup to /vol/somedirectory - This is your mounted, external EBS volume
  • Create a symbolic link to automysqlbackup in /etc/cron.daily
  • Install mutt, if you want your mysql backup dumps to be emailed to you.
    • Configure it for "Internet" using the defaults.
  • After your AMI is configured, don't forget to bundle it as your very own private AMI, or everything will be lost once you terminate your instance (except, of course, the content you put under /vol, your mounted EBS volume).