You are currently browsing the category archive for the ‘Macintosh’ category.

While the strict definition of GLASS (GemStone, Linux, Apache, Seaside, and Smalltalk) specifies a particular technology for each layer of the stack, other technologies can be used for the OS (e.g., Mac OS X), the web server (e.g., lighttpd or nginx), and the web framework (e.g., AidaWeb). I’ve been running GemStone/S 64 Bit on Mac OS X for some time and have had a local (laptop) configuration much like the tradition Linux setup with FastCGI routing requests to three gems that receive and process Seaside requests. This worked well at the beginning when Mac OS X included FastCGI (as part of its built-in support for Ruby on Rails). This has changed in the later releases; starting with 10.7 (Lion) and continuing with 10.8 (Mountain Lion), FastCGI is no longer included in the operating system. This has broken my setup.

GLASS uses FastCGI to route requests to long-running server processes (typically a Topaz process) that remains logged in to the GemStone database. The Topaz processes can run on a different host from the web server (Apache or whatever), using the ‘ExternalServer’ (discussed here and here). While FastCGI is sometimes thought to be out-of-date, it is more accurate to say that “There is not much development on FastCGI because it is a very stable protocol / application.” Apache now provides a fast cgi module (here), that is commonly described as a replacement to mod_fastcgi, but it doesn’t support the external server configuration used by GLASS.

Getting GLASS to work on Mac OS X 10.8 requires jumping through some hoops, but now that I’ve done it I’ll describe the steps I took (please feel free to suggest alternatives in the comments).

I used the App Store application to find and install Xcode (4.6), then installed the command line tools (from Xcode Preferences->Downloads or from Apple). Next, I installed the latest MacPorts. Then, from a Terminal I entered the following command:

sudo port install mod_fastcgi

This did a full Apache build, but also created the needed modules. Instead of running the MacPorts build of Apache, I copied the new module to the expected directory:

sudo cp /opt/local/apache2/modules/mod_fastcgi.so \
    /usr/libexec/apache2/mod_fastcgi.so

Then I was able to run my usual setup with FastCGI on Mac OS X 10.8!

Advertisements

As part of a project to simplify running GemStone/S 64 Bit on the Macintosh, I need to be able to modify the OS kernel settings to allow for shared memory. The changes need to be made as root and the typical way to do it is using sudo from a command shell. This requires using the command line interface as well as making various calculations, all of which is somewhat familiar to an experienced GemStone DBA but is not very nice as an initial experience with GemStone, particularly for Mac users who have come to expect a better user experience.

The currently-approved way to do privileged operations on the Mac is to create a “helper tool” (a small C application) that does the minimal task. A client application (running as a regular user) then can install the tool and (with appropriate authorizations) “bless” it so that launchd can start it as root when it is needed. Apple provides an example of how to install a helper tool (SMJobBless), but the sample helper does not actually do anything in the way of providing a service to the sample application. It seems that there are a number of requests on the web for a more complete sample, and so rather than moving straight to my application I started by enhancing the sample app. You can find the result on github.

Communication is done using Unix domain sockets. That is, rather than listening on a port, the server listens on a file. This allows a safer naming scheme that avoids overlap better than port numbers. It also limits requests to clients on the same machine. Socket programming is reasonable straightforward, but somewhat tedious. Because it is stream-based, one can’t be sure that an entire message has been received so there needs to be code that figures out how many bytes to expect and then waits till they come. Of course, you shouldn’t wait forever, so there are timing issues as well.

If you are building a Mac application that needs a helper tool, then take a look and let us know what is missing…

The following script shows the commands used in a Terminal to install GemStone/S 64 Bit 2.4.4 on a brand new install of Mac OS X Version 10.6. It would be best to read the script and decide what applies to your situation because this makes changes to some OS settings and files. Check back for a video of the experience and some further comments on the settings describing which are required and which are optional.

# get sudo ready (not secure!)
echo swordfish | sudo -S whoami

# if the following does not work, then edit /etc/hosts
ping -c3 `hostname`

sudo mv /etc/hosts /etc/hosts.bak
sed "s/localhost$/localhost `hostname`/" \
< /etc/hosts.bak \
| sudo tee /etc/hosts

ping -c3 `hostname`

# set current shared memory settings
sudo sysctl -w kern.sysv.shmall=393216
sudo sysctl -w kern.sysv.shmmax=1610612736
echo '
# boot-time shared memory settings for GemStone/S 64 Bit
kern.sysv.shmall=393216 # 4KB pages (1.5 GB)
kern.sysv.shmmax=1610612736 # bytes (1.5 GB)
' | sudo tee -a /etc/sysctl.conf

# set services
echo ‘
gs64ldi 50377/tcp # GemStone/S 64
‘ | sudo tee -a /etc/services

# set my user environment
echo ‘
# GemStone/S 64 Bit Configuration
export GEMSTONE=/opt/gemstone/product
export PATH=$GEMSTONE/bin:$PATH
export GEMSTONE_EXE_CONF=/opt/gemstone/etc
export GEMSTONE_SYS_CONF=/opt/gemstone/etc/system.conf
export GEMSTONE_NRS_ALL=\
#dir:/opt/gemstone#log:/opt/gemstone/log/%N_%P.log
alias gslist=”gslist -cvl”
alias startnetldi=”startnetldi -g -a `whoami`”
alias startstone=”startstone \
gs64stone -l /opt/gemstone/log/gs64stone.log”
alias stopstone=”stopstone gs64stone DataCurator swordfish”
alias topaz=”topaz -l -T 50000″
‘ >> ~/.bash_profile
source ~/.bash_profile

# set topaz initialization
echo ‘
set user DataCurator pass swordfish gems gs64stone
login
‘ > ~/.topazini

# create directories
mkdir \
/opt \
/opt/gemstone \
/opt/gemstone/locks \
/opt/gemstone/log \
/opt/gemstone/etc \
/opt/gemstone/data
cd /opt/gemstone

# get GemStone/S 64 Bit product
ftp -n ftp.gemstone.com << EOF
binary
quote USER anonymous
quote PASS password
ls
cd /pub/GemStone64/2.4.4
ls
get GemStone64Bit2.4.4-i386.Darwin.zip
bye
EOF
unzip *.zip
ln -s GemStone64Bit2.4.4-i386.Darwin product

cp /opt/gemstone/product/bin/extent0.dbf /opt/gemstone/data
chmod 600 /opt/gemstone/data/extent0.dbf

# see http://seaside.gemstone.com/etc/
# for a keyfile with larger limis
cp /opt/gemstone/product/seaside/etc/gemstone.key \
/opt/gemstone/etc
cp /opt/gemstone/product/data/system.conf \
/opt/gemstone/etc

echo ‘
# GemStone/S 64 Bit Stone Configuration
KEYFILE = /opt/gemstone/etc/gemstone.key;
DBF_EXTENT_NAMES = /opt/gemstone/data/extent0.dbf;
SHR_PAGE_CACHE_SIZE_KB = 1048576;
STN_TRAN_FULL_LOGGING = TRUE;
STN_TRAN_LOG_DIRECTORIES = /opt/gemstone/data/, /opt/gemstone/data/;
STN_TRAN_LOG_SIZES = 100, 100;
‘ > /opt/gemstone/etc/gs64stone.conf

cd ~

startnetldi
startstone
gslist
topaz << EOF
run
| stream |
stream := WriteStream on: String new.
System stoneConfigurationReport keysAndValuesDo: [:key :value |
stream nextPutAll: key , ‘ -> ‘ , value printString; cr.
].
stream contents.
%
logout
exit
EOF

stopstone
stopnetldi

UPDATE 2008-12-16: Mac OS 10.5.6 is out and http://support.apple.com/kb/HT3194 says that it “Includes fixes for possible graphics distortion issues with certain ATI graphics cards.” It does appear that thousands of colors now displays properly.

UPDATE 2008-10-25: Working with the good folk at ScreenFlow, it does seem that the problem is pretty clearly with the Mac OS. If you switch to thousands of colors the title bar for other applications gets stripes in the title bar–even without ScreenFlow running.

UPDATE 2008-10-05: Further investigation suggests that the problem occurs when the display colors is set to Thousands. The problem does not occur when the colors is set to Millions.

According to Apple, the latest update to Leopard (10.5.5) “[i]ncludes extensive graphics enhancements.” Unfortunately, these “enhancements” do not play well with ScreenFlow.

I have been using ScreenFlow for a couple weeks, and have been generally quite pleased with it. (Randal Schwartz, who had recommended ScreenFlow, described my recent work as “a well produced video” and was surprised when I told him it had been done with ScreenFlow!)

A couple days ago my MacBook Pro offered to install the latest OS X update that promised better security and stability. I’m generally a “bleeding-edge” sort of guy, so willingly take anything offered.

Yesterday, when trying to do a screen capture, I found a problem. By way of background, when I do a screen capture, I usually set the resolution to 800×600 since that is as big as the resulting movie is likely to be and I generally want people to be able to read the screen. Well, I set the screen resolution down, started the recording, and then looked at the result:

ScreenFlow after Mac OS X 10.5.5 Update

ScreenFlow after Mac OS X 10.5.5 Update

It has taken me half the day to recover back to 10.5.4. At first I tried to use Time Machine to simply restore my System folder. This ended up corrupting things badly enough so the computer would not boot. I then did a full disk restore to the latest backup (which went quite smoothly). Then, I copied the /System directory out of the backup disk (using the Finder, not using the Time Machine user interface) to a temp folder. From there, I use the Terminal to move the current /System/Library to a backup, and move in the old one as the current one. When I rebooted, I was on 10.5.4 and ScreenFlow works fine.

I’ve no idea of the cause of the problem, but I’ve put in a support request for ScreenFlow to address the problem. I’m glad to be back in business with ScreenFlow and hope I can upgrade to 10.5.5 soon!

Categories

Advertisements