You are not logged in.

#1 2003-06-16 15:46:01

Travholt
Member
Registered: 2003-06-16
Posts: 3
Website

PostgreSQL

Hi, let me first say that MacServers looks like it could become something very cool. It's pretty cool already!

I just thought I'd share my recent discoveries, and maybe see if anyone else has anything to say about what I've been looking into. This post would probably fit in several categories here, but since what I've found boils down to me probably installing PostgreSQL in the near future, I put it here. (And please keep in mind that I'm pretty much a novice when it comes to programming; I've been doing it for years, but have only a few finished projects to show for.)

I'm building my own CMS -- mostly because I have ideas that I can't seem to fit easily into any available CMS out there, and so I'd might as well spend my time and energy on having fun doing it myself and learning a whole lot of stuff that I can apply to many different situations later, instead of learning how to do stuff in some specialized system that I probably wouldn't get to use many other places.

Having poked at Cocoa programming just a tiny bit, I learned about the Model-View-Controller (MVC) design pattern (and the idea of design patterns in general). While searching for more info on the subject, I discovered Smarty, which takes care of the "view" part of MVC. Then I found Phrame to be mentioned within the same sentences as Smarty enough times that I decided to look into it. From there I went on to find this php|architect article which is about implementing MVC with just Phrame and Smarty -- and PostgreSQL.

My requirements and hence also my database model (which I will not torture you with) screams for a relational database system. My brain cringed at the thought of having to code all the relations between tables in PHP -- there were just so many things that could go wrong. But from the above php|architect article I've learned that there's a better alternative to MySQL out there for this kind of job. I do like MySQL, but some times it just doesn't cut it. (If there is a way to do it with MySQL, though, it'd be interesting to learn how.)

So today I discovered that PostgreSQL should be relatively easy to install on OS X. (Knock on wood -- as I haven't done it yet...) And PHP comes compiled with support for it, so that shouldn't be a problem either.

I will have to learn PostgreSQL (and PL/pgSQL and/or equivalents -- this is totally uncharted areas for me), but I think it'll be fun, and that it'll pay off in the end.

If anyone has thoughts, advice, objections, experiences or anything else worthwhile to share, please go ahead.

Offline

 

#2 2003-06-17 22:22:35

Justin
Site Admin
Registered: 2003-06-01
Posts: 33
Website

Re: PostgreSQL

Thanks for the positive comments on MacServers. Much appreciated!  big_smile

HeavyLifters used to offer a self-contained PostgreSQL app called pgMac that you just dragged to your Applications folder to install, and it came with some handy GUI tools. pgMac does not appear to be available any longer, unfortunately. While not as slick as a drag-to-install process, Marc Liyanage's PostgreSQL install instructions should do the job very nicely.

Please be sure to keep us posted as to your progress, Trav. We all forward to hearing about your experiences as you develop your CMS!

Justin

Offline

 

#3 2003-09-25 13:29:47

Travholt
Member
Registered: 2003-06-16
Posts: 3
Website

Re: PostgreSQL

Nice to see MacServers back up. smile

I just recently finished installing PostgreSQL. Things have been moving kinda slowly around here.

But I'm pleased to say it worked out rather nicely, although with one or two stumbling blocks in the way.

First of all, I chose to download the source fresh from their website instead of using Marc Liyanage's package -- partly because I wanted to have the latest version installed, and partly because I feel I could probably manage it, with the aid of online instructions and just a few other installations under my belt.

I started off following the instructions over at MacDevCenter, but configure complained that I didn't have readline installed. After a search on Google I found instructions also over at Apple, where they recommended getting using Fink to install readline, so I installed Fink first.

Fink filled my terminal window with seizure-inducing blinking garbage, but thankfully this problem is addressed in their FAQ and is solved by entering setenv TERM xterm-color before running Fink.

With readline installed, I went ahead with the familiar configure, make, make install procedure. I used the following configure options:

Code:

./configure --enable-locale --enable-multibyte=UNICODE --with-perl 
--with-includes=/sw/include --with-libraries=/sw/lib

Then I made a user called postgres -- I used the System Prefs for this, which I later regret, because I don't really want this user to show up during login or having its own home on the hard drive. Does anyone know how I can "undo" this and just have the user as if registered with NetInfo Manager?

Then I did:

Code:

sudo mkdir /usr/local/pgsql/data
sudo chown postgres /usr/local/pgsql/data/
su -l postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

And last, but not least, I downloaded and installed Liyanage's PostgreSQL StartupItem.

I still have to set up permissions and stuff like that, but it's up and running, with relatively little sweat. smile

Offline

 

#4 2003-09-28 18:52:27

Justin
Site Admin
Registered: 2003-06-01
Posts: 33
Website

Re: PostgreSQL

Nice to see MacServers back up. smile

Thanks for the kind words. It's been a real learning experience on several levels. :oops:

Your PostgreSQL install notes are terrific, and I'm sure they will come in handy for people walking down the same path. Although there are other sources for Mac-specific installers for PostgreSQL, as you mentioned they are usually not the most recent version.

When I made a user called postgres -- I used the System Prefs for this, which I later regret, because I don't really want this user to show up during login or having its own home on the hard drive. Does anyone know how I can "undo" this and just have the user as if registered with NetInfo Manager?

I would probably delete the user from within System Prefs, and then re-create the user via NetInfo commands in the Terminal. You could try something like:

Code:

% sudo niutil -create . /groups/postgres
% sudo niutil -createprop . /groups/postgres gid 1111
% sudo niutil -createprop . /groups/postgres name 'postgres'
% sudo niutil -createprop . /groups/postgres passwd '*'
% sudo niutil -create . /users/postgres
% sudo niutil -createprop . /users/postgres uid 1111
% sudo niutil -createprop . /users/postgres gid 1111
% sudo niutil -createprop . /users/postgres passwd '*'
% sudo niutil -createprop . /users/postgres change 0
% sudo niutil -createprop . /users/postgres expire 0
% sudo niutil -createprop . /users/postgres realname 'Postgres_User'

There may be another way, but that's probably what I would try.

Hope this helps. Be sure to keep us posted about your future installation/configuration adventures!  big_smile

Justin

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson