What is the deliverable for Homework Six? 

http://silo.cs.indiana.edu:14819/qotd/

Do you have another example? 

http://silo.cs.indiana.edu:13693/

What other options are there?

Really deployment should be done in Tomcat with a .war (no separate server is needed). 

So do I have to have a server running for you to check? 

Not necessarily. 

Can Homework Six be turned in in person? 

Yes. 

What is Tomcat? 

A web server. 

How do you install Tomcat? 

(a) download the archive
(b) unzip it, move into the folder
(c) modify conf/server.xml (your port numbers)
(d) define environment variables 
(e) start the server $CATALINA_HOME/bin/startup.sh

What is Grails? 

It is a web application development framework.

Is it a server? 

It contains a (development) server.

Where do you deploy finished applications? 

In a production server? 

Such as? 

Tomcat. 

How do I install Grails? 

(a) download the archive (instructor provides it) 
(b) unzip it, move into the folder that gets created 
(c) you will specify your port number when you start the dev server 
(d) define environment variables 
(e) start the server 

What environment variables do we define when we install Tomcat?

One of them is $CATALINA_HOME

The other two are $JAVA_HOME and $CLASSPATH 

How do I check that they are set? 

[jgtopp@silo ~]$ echo $CATALINA_HOME
/u/jgtopp/bin/C212/lab6/apache-tomcat-7.0.35
[jgtopp@silo ~]$

I can also do: 

[jgtopp@silo ~]$ echo $JAVA_HOME
/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
[jgtopp@silo ~]$

Why is it set as soon as I log in? 

Ben Erin Shikun Michael Brian Danielle Minh 
Grant Daniel Chen Vinayak Connor Taylor Shane 
Griffin Kevin Joe Brandon Nick Phoebe Nick Seong 

We added three lines in a file called ~/.bash_profile

Does this information transfer to Grails? 

Yes, I will have to define the environment variables in a file somewhere. 

How do I do these steps specifically:

https://www.cs.indiana.edu/classes/c212-dgerman/spr2015/hwSix.html

So let's do it: 

1. cd ~ ; cp /l/www/classes/c212/software/grails-2.3.4.zip ~
2. unzip grails-2.3.4.zip ; cd grails-2.3.4
3. pico -w .grails-setup
4. source .grails-setup

What else? 

Now that you have installed grails you need to start using it? 

What do I do? 

Download the code that comes with the book.

Where do I get the code from? 

cp /l/www/classes/c212/software/graina2-master.zip ~

What do I do next? 

I go there (~) and unzip it, then move into the folder created. 

Then what? 

Move into ch01/qotd/ and start the grails server. 

How do I start the Grails server? 

grails -Dserver.port=54533 run-app 

What's 54533 -- is that the port I should use? 

Probably not, get a port of your own. 

How do I determine what port is available?

Try this out:

[jgtopp@silo qotd]$ netstat -a | grep 55555
tcp        0      0 *:55555                     *:*                         LISTEN
[jgtopp@silo qotd]$ netstat -a | grep 55556
tcp        0      0 *:55556                     *:*                         LISTEN
[jgtopp@silo qotd]$ netstat -a | grep 55557
[jgtopp@silo qotd]$

So 55557 is available (currently) and I take it (so it becomes unavailable now). 

  425  echo $CATALINA_HOME
  426  clear
  427  echo $JAVA_HOME
  428  pwd
  429  ls
  430  clear
  431  cp /l/www/classes/c212/software/grails-2.3.4.zip ~
  432  pwd
  433  ls
  434  unzip grails-2.3.4.zip
  435  clear
  436  ls -l
  437  cd grails-2.3.4
  438  ls -l
  439  pico -w .grails-setup
  440  echo $CATALINA_HOME
  441  cat .grails-setup
  442  echo $GRAILS_HOME
  443  source .grails-setup
  444  echo $GRAILS_HOME
  445  clear
  446  pwd
  447  cp /l/www/classes/c212/software/graina2-master.zip ~
  448  ls
  449  pwd
  450  cd ..
  451  ls
  452  unzip graina2-master.zip
  453  clear
  454  pwd
  455  ls -l
  456  cd graina2-master
  457  ls-l
  458  ls -l
  459  cd ch01
  460  clear
  461  pwd
  462  ls -l
  463  cd qotd/
  464  ls -l
  465  which grails
  466  grails -Dserver.port=13949 run-app
  467  clear
  468  netstat -a | grep 55555
  469  netstat -a | grep 55556
  470  netstat -a | grep 55557
  471  [jgtopp@silo qotd]$ netstat -a | grep 55555
  472  tcp        0      0 *:55555                     *:*                         LISTEN
  473  [jgtopp@silo qotd]$ netstat -a | grep 55556
  474  tcp        0      0 *:55556                     *:*                         LISTEN
  475  [jgtopp@silo qotd]$ netstat -a | grep 55557
  476  [jgtopp@silo qotd]$
  477  clear
  478  grails -Dserver.port=55557 run-app
  479  clear
  480  ps -ef | grep jgtopp
  481  clear
  482  ls -l
  483  grails -Dserver.port=55557 run-app
  484  clear
  485  pwd
  486  ls -l
  487  cat application.properties
  488  cd ..
  489  cd ch02
  490  ls
  491  cd qotd/
  492  ls
  493  clear
  494  pwd
  495  ls -l
  496  cat application.properties
  497  cd ../../
  498  cd ch07
  499  ls
  500  cd hubbub/
  501  ls
  502  cat application.properties
  503  clear
  504  pwd
  505  cd ../../ch01
  506  cd qotd/
  507  clear
  508  pwd
  509  ls -l
  510  ( nohup grails run-app -Dserver.port=55557 --non-interactive 2>&1 > /dev/null & )
  511  pwd
  512  ls -l
  513  clear
  514  ps -ef | grep jgto
  515  cd $CATALINA_HOME
  516  cd webapps/
  517  cd ROOT/
  518  pico -w index.html
  519  netstat -a | grep 13887
  520  history

--