Skip to content

Commit

Permalink
grammarly full pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Aug 25, 2024
1 parent 4f0d895 commit 1b561ac
Show file tree
Hide file tree
Showing 7 changed files with 2,285 additions and 188 deletions.
325 changes: 299 additions & 26 deletions Chapters/Chap06-TinyBlog-SeasideCategories-EN.md

Large diffs are not rendered by default.

480 changes: 444 additions & 36 deletions Chapters/Chap06-TinyBlog-SeasideUserComponents-EN.md

Large diffs are not rendered by default.

805 changes: 739 additions & 66 deletions Chapters/Chap07-TinyBlog-Authentification-EN.md

Large diffs are not rendered by default.

550 changes: 507 additions & 43 deletions Chapters/Chap08-TinyBlog-Admin-EN.md

Large diffs are not rendered by default.

133 changes: 126 additions & 7 deletions Chapters/Chap13-TinyBlog-Deployment-EN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,45 @@
## Deploying TinyBlogIn this chapter we will show you how to deploy your Pharo application. In particular we will show how to deploy on the cloud.### Deploying in the cloudNow that TinyBlog is ready we will see how we can deploy your application on a server on the web.If you want to deploy your application on a server that you administrate, we suggest reading the last chapter of "Enterprise Pharo: a Web Perspective" \([http://books.pharo.org](http://books.pharo.org)\).In the following we present a simpler solution offered by PharoCloud.### Login on PharoCloudPharoCloud is hosting Pharo applications and it offers the possibility to freely tests its services \(ephemeric cloud subscription\).Prepare your PharoCloud account:- Create an account on [http://pharocloud.com](http://pharocloud.com)- Activate your account- Connect to this account- Activate "Ephemeric Cloud" to get an id \(**API User ID**\) and password \(**API Auth Token**\)- Click on "Open Cloud Client" and login with the previous ids- Once connected, you should get a web page that allows you to upload a zip archive containing a Pharo image and its companion Pharo changes file.### Preparing your Pharo image Pharo for PharoCloud#### Get a fresh new imageYou should- First downaload a fresh PharoWeb image from [http://files.pharo.org/mooc/image/PharoWeb-60.zip](http://files.pharo.org/mooc/image/PharoWeb-60.zip).- Launch this image and now we will configure it.#### Seaside configurationWe remove the Seaside demo applications and the development tools```"Seaside Deployment configuration"
## Deploying TinyBlog


In this chapter, we will show you how to deploy your Pharo application. In particular, we will show how to deploy on the cloud.

### Deploying in the cloud


Now that TinyBlog is ready we will see how we can deploy your application on a server on the web.
If you want to deploy your application on a server that you administrate, we suggest reading the last chapter of
"Enterprise Pharo: a Web Perspective" ([http://books.pharo.org](http://books.pharo.org)).
In the following, we present a simpler solution offered by PharoCloud.

### Login on PharoCloud

PharoCloud is hosting Pharo applications and it offers the possibility to freely tests its services \(ephemeric cloud subscription\).

Prepare your PharoCloud account:
- Create an account on [http://pharocloud.com](http://pharocloud.com)
- Activate your account
- Connect to this account
- Activate "Ephemeric Cloud" to get an id \(**API User ID**\) and password \(**API Auth Token**\)
- Click on "Open Cloud Client" and log in with the previous IDs
- Once connected, you should get a web page that allows you to upload a zip archive containing a Pharo image and its companion Pharo changes file.


### Preparing your Pharo image Pharo for PharoCloud


#### Get a fresh new image

You should
- First download a fresh PharoWeb image from [http://files.pharo.org/mooc/image/PharoWeb-60.zip](http://files.pharo.org/mooc/image/PharoWeb-60.zip).
- Launch this image and now we will configure it.


#### Seaside configuration

We remove the Seaside demo applications and the development tools

```
"Seaside Deployment configuration"
WAAdmin clearAll.
WAAdmin applicationDefaults removeParent: WADevelopmentConfiguration instance.
WAFileHandler default: WAFileHandler new.
Expand All @@ -7,27 +48,92 @@ WAFileHandler default
put: WAHtmlFileHandlerListing.
WAAdmin defaultDispatcher
register: WAFileHandler default
at: 'files'.```#### Loading TinyBlogWe load the latest version of the TinyBlog application.To load the version we propose you can use :```"Load TinyBlog"
at: 'files'.
```


#### Loading TinyBlog


We load the latest version of the TinyBlog application.
To load the version we propose you can use :

```
"Load TinyBlog"
Gofer new
smalltalkhubUser: 'PharoMooc' project: 'TinyBlog';
package: 'ConfigurationOfTinyBlog';
load.
#ConfigurationOfTinyBlog asClass loadFinalApp.
"Create Demo posts if needed"
#TBBlog asClass createDemoPosts.```You can also load **your ** TinyBlog code from your Smalltalkhub repository.For example doing:```"Load TinyBlog"
#TBBlog asClass createDemoPosts.
```


You can also load **your ** TinyBlog code from your Smalltalkhub repository.
For example doing:

```
"Load TinyBlog"
Gofer new
smalltalkhubUser: 'XXXX' project: 'TinyBlog';
package: 'TinyBlog';
load.
"Create Demo posts if needed"
#TBBlog asClass createDemoPosts.```#### TinyBlog as Default Seaside ApplicationWe now set Tinyblog as the default Seaside application and we run the HTTP webserver:```"Tell Seaside to use TinyBlog as default app"
#TBBlog asClass createDemoPosts.
```


#### TinyBlog as Default Seaside Application

We now set Tinyblog as the default Seaside application and we run the HTTP webserver:

```
"Tell Seaside to use TinyBlog as default app"
WADispatcher default defaultName: 'TinyBlog'.
"Register TinyBlog on Seaside"
#TBApplicationRootComponent asClass initialize.```Lancer Seaside :``` "Start HTTP server"
ZnZincServerAdaptor startOn: 8080.```#### Save the ImageSave your image \(Pharo Menu > save\) and locally test it in your web browser at: [http://localhost:8080](http://localhost:8080).### Manually deploying on PharoCloud's Ephemeric Cloud- Create a zip archive that contains the previously saved images and changes files: `PharoWeb.image` et `PharoWeb.changes`.- Drag and drop this zip file on the Ephemeric Cloud and activate the image using the play button as shown in Figure *@activeEphemerics@*.![Ephemeric Cloud administration Pharo image.](figures/ActiveEphemerics.png width=85&label=activeEphemerics)By clicking on the public URL given by PharoCloud you will be able to display your TinyBlog application as shown by Figure *@tinyBlogOnPharoCloud@*.![Your TinyBlog Application on PharoCloud.](figures/TinyBlogOnPharoCloud.png width=85&label=tinyBlogOnPharoCloud)### Automatic Deployment on PharoCloud's Ephemeric CloudInstead of creating a zip archive and using your web browser, the documentation of PharoCloud \([http://docs.swarm.pharocloud.com/](http://docs.swarm.pharocloud.com/)\) shows how to deploy automatically by executing the following code \(it takes some time\):```|client EPHUSER EPHTOKEN|
#TBApplicationRootComponent asClass initialize.
```


Lancer Seaside :

```
"Start HTTP server"
ZnZincServerAdaptor startOn: 8080.
```


#### Save the Image

Save your image (Pharo Menu > save) and locally test it in your web browser at: [http://localhost:8080](http://localhost:8080).

### Manually deploying on PharoCloud's Ephemeric Cloud


- Create a zip archive that contains the previously saved images and changes files: `PharoWeb.image` et `PharoWeb.changes`.


- Drag and drop this zip file on the Ephemeric Cloud and activate the image using the play button as shown in Figure *@activeEphemerics@*.


![Ephemeric Cloud administration Pharo image. % width=85&label=activeEphemerics](figures/ActiveEphemerics.png)

By clicking on the public URL given by PharoCloud you will be able to display your TinyBlog application as shown by Figure *@tinyBlogOnPharoCloud@*.

![Your TinyBlog Application on PharoCloud. % width=85&label=tinyBlogOnPharoCloud](figures/TinyBlogOnPharoCloud.png)

### Automatic Deployment on PharoCloud's Ephemeric Cloud


Instead of creating a zip archive and using your web browser, the documentation of
PharoCloud ([http://docs.swarm.pharocloud.com/](http://docs.swarm.pharocloud.com/)) shows how to deploy automatically by executing the following code (it takes some time):

```
|client EPHUSER EPHTOKEN|
Metacello new
smalltalkhubUser: 'mikefilonov' project: 'EphemericCloudAPI';
Expand All @@ -39,4 +145,17 @@ ephToken :='<REST API Token>'.
client := EphemericCloudClient userID: EPHUSER authToken: EPHTOKEN.
(client publishSelfAs: 'glimpse')
ifTrue:[ZnZincServerAdaptor startOn: 8080]
ifFalse: [ client lastPublishedInstance hostname ]```### About DependenciesGood development practice in Pharo are to specific explicitly the dependencies on the used packages.This ensures the fact that we can reproduce a software artefact.Such reproducibility supports then the use of an integration server such as Travis or Jenkins.For this a baseline \(a special class\) defines the architecture of a project \(dependencies to other projects as well as structure of your projects\).This is this way that we automatically build the PharoWeb image.In this book we do not cover this point.
ifFalse: [ client lastPublishedInstance hostname ]
```



### About Dependencies


Good development practices in Pharo are to specify explicitly the dependencies on the used packages.
This ensures the fact that we can reproduce a software artifact.
Such reproducibility supports then the use of an integration server such as Travis or Jenkins.
For this a baseline (a special class) defines the architecture of a project \(dependencies to other projects as well as the structure of your projects).
This is this way that we automatically build the PharoWeb image.
In this book we do not cover this point.
160 changes: 151 additions & 9 deletions Chapters/Chap14-TinyBlog-Loading-EN.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,175 @@
## Loading Chapter Code@cha:loadingThis chapter contains the expressions to load the code described in each of the chapters.Such expressions can be executed in any Pharo 8.0 \(or above\) image.Nevertheless, using the Pharo MOOC image \(cf. Pharo Launcher\) is usually faster because it already includes several libraries such as: Seaside, Voyage, ...When you start for example the chapter 4, you can load all the code of the previous chapters \(1, 2, and 3\) by following the process described in the following section 'Chapter 4'.Obviously, we believe that this is better that you use you own code but having our code at hand can help you in case you would be stuck.### Chapter 3: Extending and Testing the ModelYou can load the correction of the previous chapter as follow:```Metacello new
## Loading Chapter Code

@cha:loading

This chapter contains the expressions to load the code described in each of the chapters.
Such expressions can be executed in any Pharo 8.0 (or above) image.
Nevertheless, using the Pharo MOOC image (cf. Pharo Launcher) is usually faster because it already includes several libraries such as: Seaside, Voyage, ...

When you start for example the chapter 4, you can load all the code of the previous Chapters (1, 2, and 3) by following the process described in the following section 'Chapter 4'.

Obviously, we believe that this is better that you use you own code but having our code at hand can help you in case you would be stuck.

### Chapter 3: Extending and Testing the Model


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter2/src';
onConflict: [ :ex | ex useLoaded ];
load```Run the tests!To do so, you can use the TestRunner \(Tools menu > Test Runner\), look for the package TinyBlog-Tests and click on "Run Selected".All tests should be green.### Chapter 4: Data Persitency using Voyage and MongoYou can load the correction of the previous chapter as follow:```Metacello new
load
```


Run the tests!
To do so, you can use the TestRunner (Tools menu > Test Runner), look for the package TinyBlog-Tests, and click on "Run Selected".
All tests should be green.

### Chapter 4: Data Persistency using Voyage and Mongo


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter3/src';
onConflict: [ :ex | ex useLoaded ];
load```Once loaded execute the tests.### Chapter 5: First Steps with SeasideYou can load the correction of the previous chapter as follow:```Metacello new
load
```


Once loaded execute the tests.

### Chapter 5: First Steps with Seaside


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter4/src';
onConflict: [ :ex | ex useLoaded ];
load```Execute the tests.To test the application, start the HTTP server:```ZnZincServerAdaptor startOn: 8080.```Open your web browser at `http://localhost:8080/TinyBlog`You may need to recreate some posts as follows:```TBBlog reset ; createDemoPosts```### Chapitre 6: Web Components for TinyBlogYou can load the correction of the previous chapter as follow:```Metacello new
load
```


Execute the tests.

To test the application, start the HTTP server:
```
ZnZincServerAdaptor startOn: 8080.
```


Open your web browser at `http://localhost:8080/TinyBlog`

You may need to recreate some posts as follows:

```
TBBlog reset ; createDemoPosts
```


### Chapitre 6: Web Components for TinyBlog


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter5/src';
onConflict: [ :ex | ex useLoaded ];
load```Same process as above.### Chapitre 7: Managing CategoriesYou can load the correction of the previous chapter as follow:```Metacello new
load
```


Same process as above.

### Chapitre 7: Managing Categories


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter6/src';
onConflict: [ :ex | ex useLoaded ];
load```To test the application, start the HTTP server:```ZnZincServerAdaptor startOn: 8080.```Open your web browser at `http://localhost:8080/TinyBlog`You may need to recreate some posts as follows:```TBBlog reset ; createDemoPosts```### Chapitre 8: Authentication and SessionYou can load the correction of the previous chapter as follow:```Metacello new
load
```



To test the application, start the HTTP server:

```
ZnZincServerAdaptor startOn: 8080.
```


Open your web browser at `http://localhost:8080/TinyBlog`


You may need to recreate some posts as follows:

```
TBBlog reset ; createDemoPosts
```




### Chapitre 8: Authentication and Session


You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter7/src';
onConflict: [ :ex | ex useLoaded ];
load```To test the application, start the HTTP server:```ZnZincServerAdaptor startOn: 8080.```### Chapitre 9: Administration Web Interface and Automatic Form GenerationYou can load the correction of the previous chapter as follow:```Metacello new
load
```


To test the application, start the HTTP server:

```
ZnZincServerAdaptor startOn: 8080.
```


### Chapitre 9: Administration Web Interface and Automatic Form Generation



You can load the correction of the previous chapter as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog:chapter8/src';
onConflict: [ :ex | ex useLoaded ];
load```### Latest Version of TinyBlogThe most up-to-date version of TinyBlog can be loaded as follow:```Metacello new
load
```


### Latest Version of TinyBlog


The most up-to-date version of TinyBlog can be loaded as follows:

```
Metacello new
baseline:'TinyBlog';
repository: 'github://LucFabresse/TinyBlog/src';
onConflict: [ :ex | ex useLoaded ];
load.```
load.
```
20 changes: 19 additions & 1 deletion Chapters/Chap15-TinyBlog-SavingCode-EN.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
## Save your codeWhen you save the Pharo image \(Pharo Menu > Save menuentry\), it contains all objects of the system as well as all classes.This solution is useful but fragile.We will show you how Pharoers save their code directly using Iceberg.Iceberg is the Pharo code versionning tools \(introduced in Pharo 7.0\) that directly send code to well-known Web sites such as: github, bitbucket, or gitlab.We suggest you read the chapter in the book "Managing Your Code with Iceberg" \(available at [http://books.pharo.org](http://books.pharo.org)\).We list the key points here:- Create an account on [http://www.github.com](http://www.github.com) or similar.- Create a project on [http://www.github.com](http://www.github.com) or similar.- Add a new project into Iceberg by choosing the option: clone from github.- Create a folder `'src'` with the filelist or using the command line in the folder that you just cloned.- Open your project and add your packages \(Define a baseline to be able to reload your code -- check [https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/Baselines.md](https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/Baselines.md)\)- Commit your code.- Push your code on github.
## Save your code


When you save the Pharo image (Pharo Menu > Save menu entry), it contains all objects of the system as well as all classes.
This solution is useful but fragile.
We will show you how Pharoers save their code directly using Iceberg.
Iceberg is the Pharo code versioning tools (introduced in Pharo 7.0) that directly send code to well-known Web sites such as: github, bitbucket, or gitlab.

We suggest you read the chapter in the book "Managing Your Code with Iceberg" \(available at [http://books.pharo.org](http://books.pharo.org)\).

We list the key points here:

- Create an account on [http://www.github.com](http://www.github.com) or similar.
- Create a project on [http://www.github.com](http://www.github.com) or similar.
- Add a new project into Iceberg by choosing the option: clone from github.
- Create a folder `'src'` with the filelist or using the command line in the folder that you just cloned.
- Open your project and add your packages (Define a baseline to be able to reload your code -- check [https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/Baselines.md](https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/Baselines.md))
- Commit your code.
- Push your code on github.

0 comments on commit 1b561ac

Please sign in to comment.