DEV Community

tariqhamid
tariqhamid

Posted on

Gemstone Seaside Webserver

Gemstone is a multi-user Smalltalk database. Here I show how to load Seaside into Gemstone. Nginx supports a reverse-proxy mechanism for Seaside, as described below.

Download Gemstone
On the page https://gemtalksystems.com/products/gs64/ click on Download

On the download page click on the zip or dmg file

Click on the downloaded file.

I recommend you copy the contents of Gemstone dowload to /opt/gemstone/product

Install Seaside
make the seaside subdirectory your current directory:
cd /opt/gemstone/product/seaside/

Copy the system.conf file, shown below to /opt/gemstone/product/seaside/data/system.conf

# system.conf
#
# This is a larger configuration suitable for a standalone system.
DBF_EXTENT_NAMES = $GEMSTONE_DATADIR/extent0.dbf;
# DBF_SCRATCH_DIR = $GEMSTONE_DATADIR/;
KEYFILE = $GEMSTONE_KEYFILE;
STN_HALT_ON_FATAL_ERR = FALSE;
STN_TRAN_FULL_LOGGING = TRUE;
STN_TRAN_LOG_DIRECTORIES = $GEMSTONE_DATADIR/, $GEMSTONE_DATADIR/;
STN_TRAN_LOG_SIZES = 1000, 1000;

# Increased for GLASS/Seaside loading
# SHR_PAGE_CACHE_SIZE_KB should always be > GEM_TEMPOBJ_CACHE_SIZE
SHR_PAGE_CACHE_SIZE_KB = 2000000;
GEM_TEMPOBJ_CACHE_SIZE = 1000000;

# This is set to ensure that all garbage is collected when
# when an MFC is run. See the discussion in 
#  Issue 136: maintenance vm running only #unregisterExpiredHandlers may hang onto dead objects
#  http://code.google.com/p/glassdb/issues/detail?id=136
GEM_TEMPOBJ_POMGEN_PRUNE_ON_VOTE=90;

Enter fullscreen mode Exit fullscreen mode

Copy the database extent:
cp /opt/gemstone/product/bin/extent0.seaside.dbf \
/opt/gemstone/product/seaside/data/extent0.dbf

Make the extent writable:

chmod +w /opt/gemstone/product/seaside/data/extent0.dbf

set the environment variables:
source defSeaside

Check that the stone and netldi services are running by typing, gslist -lcv

gslist -lcv
Status        Version    Owner       Pid   Port   Started     Type       Name
-------      --------- --------- -------- ----- ------------ ------      ----
OK           3.7.4.3   trex        17955 50377 Dec 29 15:21 Netldi      gs64ldi
OK           3.7.4.3   trex       17990 54101 Dec 29 15:25 Stone       seaside
OK           3.7.4.3   trex        17991 54099 Dec 29 15:25 cache       seaside~e65467ac4c061631
Enter fullscreen mode Exit fullscreen mode

edit ~/.topazini

! default initialization for Topaz session
set user DataCurator pass swordfish
! set user SystemUser pass swordfish
!set gemstone gs64stone
!set gemstone gs_3.7.4.3
set gemstone seaside

set gemnetid !#netldi:gs64ldi!gemnetobject

! login
Enter fullscreen mode Exit fullscreen mode

Lines starting with exclamation marks are comments. Make sure you are logged in as DataCurator and not SystemUser.

DataCurator can see the necessary classes: Gofer, GsDeployer and Metacello, which are used to load Seaside from GitHub.

Run topaz:

topaz -l

Reading initialization file /Users/trex/.topazini
Enter fullscreen mode Exit fullscreen mode

login to a gem

topaz> login
[29/12/2025 16:37:02.845 GMT]
  gci login: currSession 2  rpc gem processId 19278 socket 4 
successful login
 fileformat is now utf8
sourcestringclass is now Unicode16
Enter fullscreen mode Exit fullscreen mode

Go to the GitHub Seaside repository:
https://github.com/seasidest/seaside


In the middle of the above page you will see a section for Gemstone:

Paste the following into your topaz session:

run
Gofer new
  package: 'GsUpgrader-Core';
  url: 'http://ss3.gemtalksystems.com/ss/gsUpgrader';
  load.
(Smalltalk at: #GsUpgrader) upgradeGrease.
%
Enter fullscreen mode Exit fullscreen mode
run
GsDeployer deploy: [
  Metacello new
    baseline: 'Seaside3';
    repository: 'github://SeasideSt/Seaside:master/repository';
    onLock: [:ex | ex honor];
    load ].
%
Enter fullscreen mode Exit fullscreen mode
run
GsDeployer deploy: [
  Metacello new
    baseline: 'Seaside3';
    repository: 'github://SeasideSt/Seaside:master/repository';
    onLock: [:ex | ex honor];
    load: #('Zinc') ].
%
Enter fullscreen mode Exit fullscreen mode

Commit the code to ensure that it can be used across further topaz sessions:

run
System commit.
%
Enter fullscreen mode Exit fullscreen mode

As a test

run
"Test server startup (this should now work)"
WAGemStoneRunSeasideGems startGemServerOn: 9001.
%
Enter fullscreen mode Exit fullscreen mode

View the Seaside server run on port 9001:

Control-C and quit the topaz session:

topaz 4> run
"Test server startup (this should now work)"
WAGemStoneRunSeasideGems startGemServerOn: 9001.
%

[Sending hard break]
ERROR 6004 , a Break occurred (error 6004), A hard break was received.
topaz 4> quit
Enter fullscreen mode Exit fullscreen mode

3 Seaside Servers
Ensure line 58 of /opt/gemstone/product/seaside/bin/startSeaside30_Adaptor is commented out:

58c58
<     Breakpoint trappable: true.
---
>     "Breakpoint trappable: true."
Enter fullscreen mode Exit fullscreen mode

The edited startSeaside30_Adaptor file should look like:

As a precaution first stop the 3 seaside servers on ports 8080, 8081 and 8082

cd /opt/gemstone/product/seaside
./bin/runSeasideGems30 stop Zinc "8080 8081 8082"

Finally run 3 seaside servers:
cd /opt/gemstone/product/seaside
./bin/runSeasideGems30 start Zinc "8080 8081 8082"

You should see 3 Seaside webservers run at

http://localhost:8080

http://localhost:8081

http://localhost:8082

Reverse-Proxy Hosting
To see any of the 3 Seaside servers running on just http://localhost

edit seaside.conf

this is normally located at /etc/nginx/conf.d/seaside.conf for Linux and at /opt/homebrew/etc/nginx/seaside.conf for Mac.

# /opt/homebrew/etc/nginx/seaside.conf        (Mac/Homebrew path)
# or /etc/nginx/conf.d/seaside.conf           (Linux)

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    upstream seaside_backend {
        # nginx will round-robin between the three gems
        server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
        server 127.0.0.1:8081 max_fails=3 fail_timeout=30s;
        server 127.0.0.1:8082 max_fails=3 fail_timeout=30s;
    }

    server {
        listen 80;
        server_name seaside.example.com;          # <-- your public host

        # --- static files (optional) ------------------------------------------
        # serve everything under /seaside/static/* from disk
        location /seaside/static/ {
            alias /opt/gemstone/product/seaside/web-root/static/;  # adjust path
            expires 1y;
            add_header Cache-Control "public, immutable";
            access_log off;
        }

        # --- dynamic Seaside requests -----------------------------------------
        location / {
            proxy_pass         http://seaside_backend;
            proxy_redirect     off;

            # standard headers Seaside needs to build correct external URLs
            proxy_set_header Host              $host;
            proxy_set_header X-Real-IP         $remote_addr;
            proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

            # timeouts (adjust if your pages are slow)
            proxy_connect_timeout 10s;
            proxy_send_timeout    60s;
            proxy_read_timeout    60s;
        }
    }

    include servers/*;
}
Enter fullscreen mode Exit fullscreen mode

Check that the above nginx.conf is good and the reload nginx.

sudo nginx -t   # syntax check
sudo nginx -s reload
or
sudo nginx
Enter fullscreen mode Exit fullscreen mode

Now view any of the 3 websites at http://localhost

References
https://www.monkeysnatchbanana.com/2010/06/24/reverse-proxying-to-seaside-with-nginx/
https://www.monkeysnatchbanana.com/2010/08/18/using-fastcgi-with-nginx-and-seaside/
https://dev.to/tariqhamid/gemstone-seaside-webserver-appendices-386k

Top comments (0)