[Pharo-users] Trying to understand Developing with Pharo, Deploying with Gemstone/s

Dale Henrichs dale.henrichs at gemtalksystems.com
Wed Feb 20 17:16:40 EST 2019

Hello Sergio,

Sorry for the delay in replying .. too many balls in the air:) I'll 
comment in-line ..

On 2/8/19 7:07 AM, sergio ruiz wrote:
> I have an app that is ready to deploy to alpha. I usually do this by 
> creating a script that builds a minimal pharo image, and run that on a 
> cloud server.
> I then use TelePharo to make any live tweaks that need to happen, and 
> something like:
> |./pharo Pharo.image "/run/the/script" |
> to keep run cron jobs, etc.
> I would like to start using Gemstone/s.
> I got GsDevKit_home up and running, with no problems, but I am having 
> a little bit of trouble figuring out how to proceed. I get what tODE 
> is doing, but I don’t get how to do the things I normally do:
>   * I got Seaside installed in the image, but I need several other
>     packages in my install: JSON, Soup, AWS S3, etc. How do I go about
>     installing those?
I assume that you used the following tODE command to install Seaside, 
following these instructions[1]?

    |project install

The url in the command resolves to a project entry for Seaside32, that 
looks like this:

^ TDProjectSpecEntryDefinition new
     baseline: 'Seaside3'
       repository: 'filetree://$GS_HOME/shared/repos/Seaside/repository'
       loads: #('Zinc Project' 'Welcome' 'Development' 'Examples');
         'project clone --https --local Seaside3
       project install --local --url=http://gsdevkit.github.io/GsDevKit_home/GsApplicationTools.ston';
     gitCheckout: 'master';
     status: #(#'inactive');
     locked: true;

The `installScript` is run by the `project install` command and causes 
the two projects to be cloned into your shared git repository area. The 
project entries for both projects are also dropped to a common disk 
location and will show up in your `project list` as unloaded projects in 
all of the stones you create, so the `install` only needs to be done once.

I'm pointing this out because you can use the `project entry` command to 
create project entries in the "common disk location" by using the 
`project entry` command ... here's the man page obtained by doing `man 
project entry` (`man project` will list all of available `project` 

   project entry - Create a new project entry

   project entry --baseline=<project-name> --repo=<project-repo> [--loads=<load-expression>] \
           entry --config=<project-name> [--version=<project-version>] \
                 --repo=<project-repo> [--loads=<load-expression>] <project-path>
           entry --git=<project-name> [--repo=<git-repo-path>] <project-path>
           entry --url=<url-for-project-entry.ston> <project-path>

   The project entry specifies project options used by the `project list` window.

   A project entry can be created for loaded projects or for projects that have
   yet to be loaded.

   There are three basic types of project entry: Git, Metacello, and HTTP.

   Git Project Entries
   For Git project entries you define the name of the project and the location on
   disk where the git repository is located. For example:

     project entry --git=projectHome --repo=$GS_HOME /sys/local/server/projects

   Metacello Project Entries
   For Metacello project entries you define the name of the project, the type of
   the project (baseline or configuration), the repository where the baseline or
   configuration may be found, and (optionally) the package/project/groups to be loaded.
   For configurations, you also specify the version of the project to be loaded. For example:

     project entry --config=External                          \
                   --version=1.0.0                            \
                   --repo=http://ss3.gemstone.com/ss/external \
                   --loads=`#('Core')`                      \

     project entry --baseline=External                                    \
                   --repo=github://dalehenrich/external:master/repository \

   If you don't specify a `--loads` option, the 'default' group is loaded. Once you have
   created a project entry, you may change or add attributes. For example, you may want to
   change the status to #inactive.

   HTTP Project Entries
   For HTTP project entries, you an download an existing project entry from a web-site. For

     project entry --url=http://gsdevkit.github.io/GsDevKit_home/Seaside31.ston \

   Downloads a project entry from http://gsdevkit.github.io/GsDevKit_home/Seaside31.ston
   into the /sys/stone/projects node.

   Once a project is loaded, only changes to the loads specification, locked
   attribute and active attribute may have an effect. The remaining information
   is taken directly from the loaded project itself.

   Any changes you make will take effect after the project list is refreshed.

   If there is already a project with the same project name in your project list, the download
   will be skipped.

   If this command is run as a result of a project entry install script, the project path of the
   outermost project entry (i.e., the project that initiated the original install script) is used
   instead of the <project-path>.

Project Entry Attributes

     When a project entry is initially created, the status is set to #active. Active
     projects are listed in bold and sorted near the top of the project list.

     For projects use github repositories, the gitRootPath specifies a location on
     disk where the git repository should be located. This attribute is used by the
     `project clone` command. If a project entry does not have the gitRootPath
     explicitly set, then the path returned by
     TDProjectEntryDefinition class>>defaultGitRootPath is used. The value of
     TDProjectEntryDefinition class>>defaultGitRootPath can be set on a session
     by session basis.

     For Metacello projects, you may  specify that the project entry is locked. By
     locking a project entry you can ensure that the specified project version (if
     applicable) and repository will be used whenever the project is loaded by
     reference from another project.

   project entry --config=External --version=1.0.0 --repo=http://ss3.gemstone.com/ss/external \
                --loads=`#('Core')` /sys/local/server/projects

   project entry --baseline=External --repo=github://dalehenrich/external:master/repository \
                --loads=`#('Core')` /sys/stone/projects

   project entry --git=projectHome --repo=$GS_HOME /sys/stone/projects

   project entry --url=http://gsdevkit.github.io/GsDevKit_home/Seaside31.ston \

   NOTE - use the `tode it` menu item to run the examples directly from this window.

   browse class --exact --hier TDProjectEntryDefinition
   "The Metacello Lock Command Reference" [1]

[1] https://github.com/dalehenrich/metacello-work/blob/master/docs/LockCommandReference.md#lock-command-reference
   browse method --spec `TDMetacelloTool>>projectentry`

   NOTE - use the `tode it` menu item to run the commands directly from this window.

Soooo, you should create a project entry for each of your projects. I'm 
not sure which of the JSON projects[2] you are using, but if you are 
using NeoJSON[3], then you are in luck because there is an existing port 
of NeoJSON[4] to GemStone. The project is not updated to the latest 
NeoJson release, but that can be done. I don't have a lot of free time 
these days, but I would certainly be willing to answer questions and 
resolve specific issues,,,

Anyway, using NeoJSON as an example here's the project entry command:

project entry \
	--baseline=NeoJSON \
	--repo=github://GsDevKit/NeoJSON:gs_master/repository \
	--loads=`#( 'Core' )` \

II you look at the file $GS_HOME/sys/local/server/projects/NeoJSON.ston:

^ TDProjectSpecEntryDefinition new
     baseline: 'NeoJSON'
       repository: 'github://GsDevKit/NeoJSON:gs_master/repository'
       loads: #('Core');
     status: #(#'active');
     locked: false;

Then a `project clone NeoJSON` will clone the project to 

Then a `project lock NeoJSON` will lock the project, producing this in 
$GS_HOME/sys/local/server/projects/NeoJSON.ston (note the `locked` field 
is now true):

^ TDProjectSpecEntryDefinition new
     baseline: 'NeoJSON'
       repository: 'filetree://$GS_HOME/shared/repos/NeoJSON/repository'
       loads: #('Core');
     status: #(#'active');
     locked: true;

At this point any reference to the NeoJSON project in Metacello spec 
will use your locally cloned git repository for every stone that you create.

There are a few differences between the project entry produced by the 
command:and those that are present up on github[5] and downloaded using 
the command:

project entry --url=http://gsdevkit.github.io/GsDevKit_home/NeoJSON.ston /sys/local/server/projects

Here is the downloaded project entry:

^ TDProjectSpecEntryDefinition new
     comment: '';
     projectUrl: 'https://github.com/GsDevKit/NeoJSON';
     baseline: 'NeoJSON'
       repository: 'github://GsDevKit/NeoJSON:gs_master/repository'
       loads: #('Core');
     installScript: 'project clone --https --local NeoJSON';
     gitCheckout: 'gs_master';
     status: #(#'inactive');
     locked: false;

... I haven't gotten around to adding the extra fields to the `project 
entry` command, but it is pretty easy to copy the .ston files and edit 
the fields to your liking...

So for each of the projects that are part of your application you would:

 1. create a project entry
 2. clone the project
 3. port to gemstone (if needed)

[3] https://github.com/svenvc/NeoJSON
[4] https://github.com/GsDevKit/NeoJSON#gemstone-installation
[5] https://github.com/GsDevKit/GsDevKit_home/blob/gh-pages/NeoJSON.ston
>   * How do I install my main package? It’s in an Iceberg project.
You can create a master project entry for your application or use a 
Metacello load expression (which is presumably how you install your 
project in Pharo...

With the project clones in a known location on disk, you would want to 
hook up your Pharo image to the project repositories (if you've already 
got local clones for use with Pharo, then I can give you the details for 
creating the appropriate project entries for the gemstone tODE env) ... 
by sharing the disk-based clones you will guarantee that the pharo image 
and you stone[s) would be sharing the same source code

>   * How do I update my Iceberg project while it’s live?
Using the NeoJSON project as an example the tODE command `project load 
NeoJSON` causes the code to be reloaded from the git repositories into 
your image ... tODE runs in autoCommit mode by default, so that's about 
it ...

Of course I would recommend that you maintain a "production sandbox" 
stone that is basically a periodic copy from production that you use to 
test your code prior to deploying into production ... there are some 
additional details about GemStone that you should be aware of (mainly in 
the area of dealing with class shape changes and persistent garbage 
collection), but this should get the ball rolling ...

If you have further questions specific to GemStone, you might switch to 
the GLASS mailing list[6].

[6] http://lists.gemtalksystems.com/mailman/listinfo/glass

> I think those questions will get me into beta pretty quickly.
As I said earlier, I will do what I can to help with porting the 
projects to GemStone, I m facing a couple of my own target dates, so my 
availabiliity will vary ...  if you have to fork the project for your 
port (some project owners prefer to not have to deal with non-pharo 
dialects), you can host your port in the GsDevKit[7] organization (I 
will add the repo and make you a contributor) or you can host it 
somewhere else, if you choose ...

See you on the GLASS list:)


[7] https://github.com/GsDevKit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190220/75c5f0e8/attachment-0001.html>

More information about the Pharo-users mailing list