Setup a Launcher distribution for Pharo trainings/presentations on Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Setup a Launcher distribution for Pharo trainings/presentations on Windows

Torsten Bergmann
Hi,

I was asked on #slack by user embee (Martin Baehr) how he can create an up to date setup with "PharoLauncher"
configuration locally that he can afterwards easily distribute ("unzip and go") to 40 Windows PCs for a
training/presentation.

He was preparing Pharo for Singapore FOSSASIA conference workshop at the science center computer lab.

I helped him with the following short guide that may be useful to others too.

Have fun
T.


-------------------------------------------------------------------------------------------------------------------------------------------------

A. Portable version of Launcher vor Windows
===========================================
  1. Go to https://ci.inria.fr/pharo/view/Launcher/job/Launcher/ and click on "VERSION=stable"
     for a green build  
  2. Download "Pharo-win.zip"
     (Direct link is https://ci.inria.fr/pharo/view/Launcher/job/Launcher/PHARO=40,VERSION=stable,VM=vm,label=linux/lastSuccessfulBuild/artifact/Pharo-win.zip)

  3. Extract this to c:\ so you end up with a directory "c:\Pharo"

B. Create some folders
======================
  4. Create a new folder "images"

  5. Create a new folder "vm" with two subfolders "spur" and "nonspur"
 
So you end up with  
 
  - Pharo
  !- images
  !- vm
   !- spur
   !- nonspur

C. Install stable "non-Spur" VM
===============================
The existing stable VM (before the introduction of Spur) is required for all "PreSpur" images with image version <= 50496
(so latest Pharo 4 and initial images when Pharo 5 was started before switching to Spur during Pharo 5 development)
 
  6. Visit http://files.pharo.org/vm/pharo/win/ and download "Pharo-VM-win-stable.zip"
 
  7. This is the Pharo 4 stable Cog VM. Extract the contents to "C:\Pharo\vm\nonspur"

  8. Copy the source files
           C:\Pharo\PharoV10.sources also to C:\Pharo\vm\nonspur
                   C:\Pharo\PharoV20.sources also to C:\Pharo\vm\nonspur
                   C:\Pharo\PharoV30.sources also to C:\Pharo\vm\nonspur
                   C:\Pharo\PharoV40.sources also to C:\Pharo\vm\nonspur  
 
D. Install latest Spur VM
=========================
The new, fast and shiny Spur VM is required for all "Spur" images with image version 50497 onwards
(so latest Pharo 5)

  9. Visit http://files.pharo.org/vm/pharo-spur32/win/ and download "PharoVM-Spur32-win-latest.zip"  
 
 10. This is the "bleeding edge" Spur VM. Extract the contents to "C:\Pharo\vm\spur"
 
 11. Copy only the source file
           C:\Pharo\PharoV40.sources also to C:\Pharo\vm\spur

E. Configure Pharo Launcher
===========================
 11. Start C:\Pharo\Pharo.exe by double clicking on it, this will open the Pharo Launcher window
 
 12. At the bottom right corner of the Window there is a button called "Open Settings". This opens
     the settings browser for Pharo Launcher. Click on the node "PharoLauncher" in the settings tree.

 13. For the setting "Spur VM Full Path" enter ".\vm\spur\Pharo.exe" and hit ENTER
 
 14. For the setting "VM Full Path" enter ".\vm\nonspur\Pharo.exe" and hit ENTER
 
F. Hack the "images" folder location to be relative
===================================================
 15. When you try to change "Location of your images" to be relative like ".\images" you will
     notice that it always changes back to an absolute path "C:\Pharo\images". So we need to hack
         this:
 
 16. Hit "SHIFT" + "ENTER" to open the Pharo Spotter. Enter "PhLDirectoryBasedImageRepository"
     to open a browser on this class. and change the class method #location to look like
     that
 
       location
               ^ FileSystem workingDirectory / 'images'
 
 17. Close the class browser, close the settings browser and leave the Pharo Launcher by
     clicking on "Quit" in the bottom right corner. Note that the launcher image is saved
         on exit - so our code change will be in effect when we start Launcher again.
         
Now ZIP the c:\Pharo folder and you can extract it on any computer that you like.

So when you distribute the ZIP the image folder should be clean. But you can also download
and include preconfigured images that you like your audience to be working with.
         
G. Sharing caches
=================
With the above setup each time you download and start an image using the Launcher a new
"package-cache" for Monticello/Metacello downloads will be created for each image directory.

To avoid such a cache per image and use a general cache for all images it is helpful to
change the package-cache location in each image. This can easily be done:

  18. Start an image and evaluate
 
        StartupPreferencesLoader preferencesGeneralFolder
         
          to find out which preferences folder usually is used. In my example this is
      C:\Users\root\AppData\Roaming\pharo  

  19. Go to this folder and create a file called "startup.st" with the following contents:
 
        |mczCache|
        mczCache := 'C:\Software\Pharo\cache' asFileReference.
        MCCacheRepository cacheDirectory: mczCache.
        UIManager inform: 'Package cache set to', mczCache fullName

If you solely work with the setup and following our path logic you can even give this as
a relative path in the startup script:
 
        mczCache := FileSystem workingDirectory parent parent / 'package-cache'
               
Details on further startup customization can be found on
https://marianopeck.wordpress.com/2012/05/12/startuploader-running-startup-scripts-in-pharo/               

Reply | Threaded
Open this post in threaded view
|

Re: Setup a Launcher distribution for Pharo trainings/presentations on Windows

Martin Bähr
Excerpts from Torsten Bergmann's message of 2016-03-23 09:45:09 +0100:
> I was asked on #slack by martin how he can create an up to date setup with
> "PharoLauncher" configuration locally that he can afterwards easily
> distribute ("unzip and go") to 40 Windows PCs for a training/presentation.
>
> He was preparing Pharo for Singapore FOSSASIA conference workshop at the
> science center computer lab.
>
> I helped him with the following short guide that may be useful to others too.

thank you again torsten.
you saved me a lot of work there.

the workshop went quite well, btw, the audience was enthusiastic.
sadly though it was very small too. the kids were more interested in IoT and
android workshops than learning smalltalk.

i need to work on a more capturing introduction for next time.
or maybe look into smalltalk for robots or something like that.

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      pike.lysator.liu.se    caudium.net     societyserver.org
secretary                                                      beijinglug.org
mentor                                                           fossasia.org
foresight developer  foresightlinux.org                            realss.com
unix sysadmin
Martin Bähr          working in china        http://societyserver.org/mbaehr/

Reply | Threaded
Open this post in threaded view
|

Re: Setup a Launcher distribution for Pharo trainings/presentations on Windows

stepharo
In reply to this post by Torsten Bergmann
cool ressource!!!


Le 23/3/16 09:45, Torsten Bergmann a écrit :
Hi,

I was asked on #slack by user embee (Martin Baehr) how he can create an up to date setup with "PharoLauncher" 
configuration locally that he can afterwards easily distribute ("unzip and go") to 40 Windows PCs for a 
training/presentation.

He was preparing Pharo for Singapore FOSSASIA conference workshop at the science center computer lab.

I helped him with the following short guide that may be useful to others too.

Have fun
T. 


-------------------------------------------------------------------------------------------------------------------------------------------------

A. Portable version of Launcher vor Windows
===========================================
  1. Go to https://ci.inria.fr/pharo/view/Launcher/job/Launcher/ and click on "VERSION=stable"
     for a green build  
  2. Download "Pharo-win.zip"
     (Direct link is https://ci.inria.fr/pharo/view/Launcher/job/Launcher/PHARO=40,VERSION=stable,VM=vm,label=linux/lastSuccessfulBuild/artifact/Pharo-win.zip)

  3. Extract this to c:\ so you end up with a directory "c:\Pharo"

B. Create some folders
======================
  4. Create a new folder "images" 

  5. Create a new folder "vm" with two subfolders "spur" and "nonspur"
  
So you end up with  
  
  - Pharo 
  !- images
  !- vm
   !- spur
   !- nonspur

C. Install stable "non-Spur" VM
=============================== 
The existing stable VM (before the introduction of Spur) is required for all "PreSpur" images with image version <= 50496
(so latest Pharo 4 and initial images when Pharo 5 was started before switching to Spur during Pharo 5 development)
  
  6. Visit http://files.pharo.org/vm/pharo/win/ and download "Pharo-VM-win-stable.zip"
  
  7. This is the Pharo 4 stable Cog VM. Extract the contents to "C:\Pharo\vm\nonspur"

  8. Copy the source files
           C:\Pharo\PharoV10.sources also to C:\Pharo\vm\nonspur
		   C:\Pharo\PharoV20.sources also to C:\Pharo\vm\nonspur
		   C:\Pharo\PharoV30.sources also to C:\Pharo\vm\nonspur
		   C:\Pharo\PharoV40.sources also to C:\Pharo\vm\nonspur  
 
D. Install latest Spur VM 
=========================
The new, fast and shiny Spur VM is required for all "Spur" images with image version 50497 onwards
(so latest Pharo 5)

  9. Visit http://files.pharo.org/vm/pharo-spur32/win/ and download "PharoVM-Spur32-win-latest.zip"   
  
 10. This is the "bleeding edge" Spur VM. Extract the contents to "C:\Pharo\vm\spur"
  
 11. Copy only the source file
           C:\Pharo\PharoV40.sources also to C:\Pharo\vm\spur

E. Configure Pharo Launcher
===========================
 11. Start C:\Pharo\Pharo.exe by double clicking on it, this will open the Pharo Launcher window
 
 12. At the bottom right corner of the Window there is a button called "Open Settings". This opens 
     the settings browser for Pharo Launcher. Click on the node "PharoLauncher" in the settings tree.

 13. For the setting "Spur VM Full Path" enter ".\vm\spur\Pharo.exe" and hit ENTER
 
 14. For the setting "VM Full Path" enter ".\vm\nonspur\Pharo.exe" and hit ENTER
 
F. Hack the "images" folder location to be relative
=================================================== 
 15. When you try to change "Location of your images" to be relative like ".\images" you will 
     notice that it always changes back to an absolute path "C:\Pharo\images". So we need to hack
	 this:
 
 16. Hit "SHIFT" + "ENTER" to open the Pharo Spotter. Enter "PhLDirectoryBasedImageRepository" 
     to open a browser on this class. and change the class method #location to look like
     that
 
       location
	       ^ FileSystem workingDirectory / 'images' 
 
 17. Close the class browser, close the settings browser and leave the Pharo Launcher by
     clicking on "Quit" in the bottom right corner. Note that the launcher image is saved
	 on exit - so our code change will be in effect when we start Launcher again.
	 
Now ZIP the c:\Pharo folder and you can extract it on any computer that you like.

So when you distribute the ZIP the image folder should be clean. But you can also download
and include preconfigured images that you like your audience to be working with.
	 
G. Sharing caches
=================
With the above setup each time you download and start an image using the Launcher a new
"package-cache" for Monticello/Metacello downloads will be created for each image directory.

To avoid such a cache per image and use a general cache for all images it is helpful to
change the package-cache location in each image. This can easily be done:

  18. Start an image and evaluate 
  
        StartupPreferencesLoader preferencesGeneralFolder
	  
	  to find out which preferences folder usually is used. In my example this is 
      C:\Users\root\AppData\Roaming\pharo	  

  19. Go to this folder and create a file called "startup.st" with the following contents:
  
        |mczCache|
        mczCache := 'C:\Software\Pharo\cache' asFileReference.
        MCCacheRepository cacheDirectory: mczCache.
        UIManager inform: 'Package cache set to', mczCache fullName

If you solely work with the setup and following our path logic you can even give this as 
a relative path in the startup script:
  
        mczCache := FileSystem workingDirectory parent parent / 'package-cache'
		
Details on further startup customization can be found on 
https://marianopeck.wordpress.com/2012/05/12/startuploader-running-startup-scripts-in-pharo/		



Reply | Threaded
Open this post in threaded view
|

Re: Setup a Launcher distribution for Pharo trainings/presentations on Windows

Damien Cassou-2
In reply to this post by Torsten Bergmann
Torsten Bergmann <[hidden email]> writes:

> I was asked on #slack by user embee (Martin Baehr) how he can create an up to date setup with "PharoLauncher"
> configuration locally that he can afterwards easily distribute ("unzip and go") to 40 Windows PCs for a
> training/presentation.
> He was preparing Pharo for Singapore FOSSASIA conference workshop at the science center computer lab.
> I helped him with the following short guide that may be useful to others too.

that's amazing work Torsten, thank you very much. What about adding a
Jenkins job that would create this automatically?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Setup a Launcher distribution for Pharo trainings/presentations on Windows

Ben Coman
In reply to this post by Martin Bähr
On Wed, Mar 23, 2016 at 5:22 PM, Martin Bähr
<[hidden email]> wrote:
> the kids were more interested in IoT

I'm think of getting some ESP8286 [1] modules to connect Pharo (and
thus possibly Phratch0 to via TCP/IP. There is a lot of buzz around
IoT and I think the ESP8286 might be a way for Pharo to piggyback
that.

http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/

cheers -ben