
.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>midriff: quick start</title>
<body bgcolor=99cc99 vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td align=right><a href="Contents.html">
<img src="img/midriff.gif" border=0><br><small>dynamic content system</a> &nbsp; &nbsp; </td></tr>
<td>
.>>

.TH quick start TDH "11-MAR-2003   TDH scg@jax.org" 

.SH Quick start procedure for a MIDRIFF project

.IP \(bu
Look over this page before starting.  We assume that you are comfortable
with unix concepts such as file permissions modes and setuid, and that you understand relevant
.ig >>
<a href="security.html">
.>>
\0security issues.
.ig >>
</a>
.>>
Please don't proceed until you're comfortable with everything described herein.

.ig >>
<br><br>
.>>

.IP \(bu
Download the software from \fCmidriff.sourceforge.net\fR

.ig >>
<br><br>
.>>

.IP \(bu
Edit the \fBMakefile\fR and set the bin directory if desired.

.ig >>
<br><br>
.>>

.IP \(bu
Compile using \fBgcc\fR or other ANSI-compliant C compiler.

.ig >>
<br><br>
.>>

.IP \(bu
Add the midriff bin to your search \fBPATH\fR

.ig >>
<br><br>
.>>

.IP \(bu
Think of a directory name where your project will reside (eg. \fC/home/steve/proj1\fR),
and decide on a unix userid that will own the project.

.ig >>
<br><br>
.>>

.IP \(bu
Log in as the project owner userid, and run the shell script \fBmidriff_newproject.sh\fR
It will prompt you for full pathname of the project directory you are creating.

.ig >>
<br><br>
.>>

.IP
The result will be a project structure that will be used by \fBmidriff\fR and/or \fBshsql\fR.
It will contain a \fCconfig\fR file that \fBmidriff\fR programs will read whenever they are invoked.
It should also contain a demo data file called \fCexamp_people\fR, and a couple of test page templates to play with.

.ig >>
<br><br>
.>>

.IP \(bu
Edit the \fCconfig\fR file, and change the \fBdbbin\fR  entry from \fCpath\fR to the full
path name of the bin directory where shsql executables reside.  This allows midriff to
find several executables that it may need.

.ig >>
<br><br>
.>>
.IP \(bu
Set a shell environment variable called \fBSHSQL_DB\fR
and be sure that it is exportable.  It should contain the full pathname
of your project directory.  This won't be used by CGI processes, but is
needed in command line mode.
.br
Eg. for /bin/ksh do: \fCexport SHSQL_DB=/home/steve/proj1\fR
.br
For future, add this to your \fC.profile\fR or \fC.cshrc\fR file.

.ig >>
<br><br>
.>>

.IP \(bu
The executable must be placed into your \fCcgi bin\fR.
Use \fCcp -p\fR or \fCmv\fR.
You can rename the executable to anything you like, for example, \fCmydbcgi\fR.

.ig >>
<br><br>
.>>

.IP \(bu
\fBPermissions:\fR Determine if you are setting up a read-write, or read-only application.

.ig >>
<br><br>
.>>
If your midriff application will need to \fBupdate\fR a shsql database or other files, it should be
\fBsetuid\fR to the owner of the project/database directory.
Your executable should have a permissions mode of \fB6755\fR (\fC-rwsr-sr-x\fR); if it doesn't,
use a command like this: \fCchmod 6755 mydbcgi\fR
There are security concerns with respect to CGI programs and setuid, and some web hosts
place limitations here.
.ig >>
<a href="security.html">
.>>
\0Further discussion.
.ig >>
</a>
.>>

.ig >>
<br><br>
.>>
If your midriff application will be read-only, setuid is not required, but
all files & subdirectories in your project directory (except logs) must be readable by world, and
your \fC./logs\fR directory must be world-writable.

.ig >>
<br><br>
.>>
.IP \(bu
In your \fBcgi-bin\fR, make a soft link to the project \fBconfig file\fR that was just created.
It should have the same name as your mrcgi executable, with \fC.cnf\fR appended to the end,
for example, \fCmydbcgi.cnf\fR.
To make the config file link, you would use a command like this (the exact location of your cgi-bin
is system-dependent):
.br
\fCcd .../cgi-bin; ln -s /home/steve/myproj/config mydbcgi.cnf\fR.

.ig >>
<br><br>
.>>

.IP \(bu
Try an SQL select command from the command line, eg:
.br
\fCshsql "select * from examp_people"\fR.

.ig >>
<br><br>
.>>

.IP \(bu
\fBtestpage1\fR:
A couple of test pages should be located in your \fC./pages\fR directory.
One of them, \fCtestpage1\fR, is defined in the config file as a default page.
To access your default page, fire up your web browser and enter a URL that will
invoke your mrcgi executable, eg. 
.br
\fChttp://abc.com/cgi-bin/mydbcgi\fR
.br
If you have trouble with this step, check with your local systems support.
.br
This page will display your effective user id and effective group id.
These must match the project directory owner if any database updates are to be possible.

.ig >>
<br><br>
.>>


.IP \(bu
A number of examples are available in the \fC./mrexamples\fR directory.
You can try them now.. just copy all files from \fC./mrexamples\fR to the
\fC./pages\fR directory (in the project directory you just built).
Then point your browser to:
.br
\fChttp://abc.com/cgi-bin/mydbcgi?rtn=examp_index\fR

.ig >>
<br><br>
.>>

.IP \(bu
You are now all set to begin developing page templates in \fC./pages\fR.
Larger projects may be organized into subdirectories of pages therein.

.ig >>
<br><br>
.>>
.IP \(bu
.ig >>
<a href="problems.html">
.>>
\0Examples, troubleshooting, and support
.ig >>
</a>
.>>

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="Contents.html">
<img src="img/midriff.gif" border=0></a><br>
<small>dynamic content system &nbsp; &nbsp;<br>
<a href="Copyright.html">Copyright Steve Grubb</a> &nbsp; &nbsp;
</td></tr>
</table>
.>>

