Skip to content

Commit

Permalink
Update guides and website for latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Apr 16, 2024
1 parent bd6a658 commit 5007bb0
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ pine run-server --public-urls="http://*:5000" --deploy=https://github.com/pin

## Docker Image

To deploy in a docker container, use the `elm-time/elm-time` image from the [GitHub Container registry](https://github.com/pine-vm/pine/pkgs/container/elm-time) (`ghcr.io/elm-time/elm-time`). The tags are aligned with the version IDs in the CLI executable file.
To deploy in a docker container, use the `pine-vm/pine` image from the [GitHub Container registry](https://github.com/pine-vm/pine/pkgs/container/pine) (`ghcr.io/pine-vm/pine`). The tags are aligned with the version IDs in the CLI executable file.

```txt
docker run -p 5000:80 -p 4000:4000 --env "APPSETTING_adminPassword=test" ghcr.io/elm-time/elm-time
docker run -p 5000:80 -p 4000:4000 --env "APPSETTING_adminPassword=test" ghcr.io/pine-vm/pine
```


Expand Down
38 changes: 19 additions & 19 deletions guide/how-to-configure-and-deploy-an-elm-backend-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
This guide covers running a backend app programmed in Elm, including configuration, deployment, and migrations.
The backend includes a web server and a database persisting the application state and automating state migrations.

## Installing and Registering the `elm-time` Command
## Installing and Registering the `pine` Command

In this guide, I use the `elm-time` command-line interface (CLI) program. You can find all downloads at <https://pinevm.org/downloads> and <https://github.com/pine-vm/pine/releases>
In this guide, I use the `pine` command-line interface (CLI) program. You can find all downloads at <https://pinevm.org/downloads> and <https://github.com/pine-vm/pine/releases>

To register the elm-time executable on your system, run the `elm-time install` command. If you use Linux or PowerShell on Windows, you can achieve this by running the following command after navigating to the directory containing the executable file extracted from the downloaded archive:
To register the pine executable on your system, run the `pine install` command. If you use Linux or PowerShell on Windows, you can achieve this by running the following command after navigating to the directory containing the executable file extracted from the downloaded archive:

```text
./elm-time install
./pine install
```

In Windows, you will get a confirmation like this:

```text
I added the path 'C:\Users\John\Downloads\elm-time-bin-v2023-08-19-win10-x64' to the 'PATH' environment variable for the current user account. You will be able to use the 'elm-time' command in newer instances of the Command Prompt.
I added the path 'C:\Users\John\Downloads\pine-bin-v0.3.0-win-x64' to the 'PATH' environment variable for the current user account. You will be able to use the 'pine' command in newer instances of the Command Prompt.
```

On Linux, the confirmation of the installation looks like this:

```text
I copied the executable file to '/bin/elm-time'. You will be able to use the 'elm-time' command in newer terminal instances.
I copied the executable file to '/bin/pine'. You will be able to use the 'pine' command in newer terminal instances.
```

## Running a Server and Deploying an App

As part of a deployment, Elm-Time compiles the app program code.
The compiler requires the program code to contain the entry point for a web server app. In addition, it offers various functions we can use independent of each other as needed. It supports projects without a front-end or with multiple front-ends apps.

Here is an example app containing backend and frontend: <https://github.com/pine-vm/pine/tree/5be007cd5a827be1561226713d8c01ae929e51c8/implement/example-apps/docker-image-default-app>
Here is an example app containing backend and frontend: <https://github.com/pine-vm/pine/tree/bd6a65808505eef741e159fb33c7ecf5c351b53d/implement/example-apps/docker-image-default-app>

We can use this command to run a server and deploy this app:

```cmd
elm-time run-server --public-urls="http://*:5000" --deploy=https://github.com/pine-vm/pine/tree/5be007cd5a827be1561226713d8c01ae929e51c8/implement/example-apps/docker-image-default-app
pine run-server --public-urls="http://*:5000" --deploy=https://github.com/pine-vm/pine/tree/bd6a65808505eef741e159fb33c7ecf5c351b53d/implement/example-apps/docker-image-default-app
```

When running this command, we get an output like this:
Expand All @@ -44,9 +44,9 @@ When running this command, we get an output like this:
I got no path to a persistent store for the process. This process will not be persisted!
Loading app config to deploy...
This path looks like a URL into a remote git repository. Trying to load from there...
This path points to commit 5be007cd5a827be1561226713d8c01ae929e51c8
The first parent commit with same tree is https://github.com/pine-vm/pine/tree/1d5c77b5bd9f2f18c11a4f41e37fb4cfb1ba6dd6/implement/example-apps/docker-image-default-app
Loaded source composition b360367bb08010eb39902695fd4e776f7975263a777d695e26cdda110c4fd6e0 from 'https://github.com/pine-vm/pine/tree/5be007cd5a827be1561226713d8c01ae929e51c8/implement/example-apps/docker-image-default-app'.
This path points to commit bd6a65808505eef741e159fb33c7ecf5c351b53d
The first parent commit with same tree is https://github.com/pine-vm/pine/tree/ec9bf5da38a7d9915b903e9225ebc10417b73e9d/implement/example-apps/docker-image-default-app
Loaded source composition 1760759d9ec6a517bebf061989f79f20b1c0cb0958275604c6a311166628b1f4 from 'https://github.com/pine-vm/pine/tree/bd6a65808505eef741e159fb33c7ecf5c351b53d/implement/example-apps/docker-image-default-app'.
Starting web server with admin interface (using engine JavaScript_V8 { })...
info: ElmTime.Platform.WebService.StartupAdminInterface[0]
letsEncryptRenewalServiceCertificateCompleted: False
Expand Down Expand Up @@ -284,7 +284,7 @@ On startup, the server restores the state of the process from the given store lo
Here is a complete command to run a server that maintains the persistence of the Elm-Time process:

```cmd
elm-time run-server --process-store=./process-store --admin-password=test --admin-urls="http://*:4000" --public-urls="http://*:5000"
pine run-server --process-store=./process-store --admin-password=test --admin-urls="http://*:4000" --public-urls="http://*:5000"
```

When running this command, we will get an output like this:
Expand Down Expand Up @@ -322,13 +322,13 @@ But we don't need a web browser to interact with the admin interface. The comman

## Deploy an App to an Existing Server

Use the `elm-time deploy` command to deploy an app to a running server in an atomic operation.
Use the `pine deploy` command to deploy an app to a running server in an atomic operation.

With this command, we need to specify the path to the app to deploy and the destination site to deploy to.
Here is an example that matches the admin interface configured with the `run-server` command above:

```cmd
elm-time deploy --init-app-state https://github.com/pine-vm/pine/tree/0ae86d63e4353c8225794fd3cc214121d6c02847/implement/example-apps/docker-image-default-app http://localhost:4000
pine deploy --init-app-state https://github.com/pine-vm/pine/tree/0ae86d63e4353c8225794fd3cc214121d6c02847/implement/example-apps/docker-image-default-app http://localhost:4000
```

The `--init-app-state` option means we do not migrate the previous backend state but reset it to the value from the init function.
Expand All @@ -342,9 +342,9 @@ The server at 'http://localhost:4000/api/deploy-and-init-app-state' is asking fo

We enter the same password we gave with the `--admin-password` option on the command to run the server.

The `elm-time deploy` command also writes a report of the deployment attempt into a file under the current directory. It points out the exact path to the report file in a log message:
The `pine deploy` command also writes a report of the deployment attempt into a file under the current directory. It points out the exact path to the report file in a log message:
```text
Saved report to file 'C:\Users\John\elm-time-tool\report\2023-02-17T15-28-25_deploy.json'.
Saved report to file 'C:\Users\John\pine-tool\report\2023-02-17T15-28-25_deploy.json'.
```

In this report, we can see if the deployment was successful and how much time it took. If a migration fails, we also find a description of the problem in this report.
Expand All @@ -355,18 +355,18 @@ If you do not use the `--admin-password` option with the `run-server` command, t
Configuring the password using the environment variable makes it easier to reuse the standard Docker image:

```cmd
docker run -p 5000:80 -p 4000:4000 --env "APPSETTING_adminPassword=test" ghcr.io/elm-time/elm-time
docker run -p 5000:80 -p 4000:4000 --env "APPSETTING_adminPassword=test" ghcr.io/pine-vm/pine
```

## Manage the Process Store

The process store contains not only the latest state of the app but also the event log.
In the Docker image `elm-time/elm-time`, the process store is located in the directory `/elm-time/process-store`.
In the Docker image `pine-vm/pine`, the process store is located in the directory `/pine/process-store`.
You can copy this directory to backup the process store or copy it to another container.

Alternatively, use a [docker volume](https://docs.docker.com/storage/volumes/) to map this directory to another location:
```powershell
docker run --mount source=your-docker-volume-name,destination=/elm-time/process-store -p 80:80 -p 4000:4000 ghcr.io/elm-time/elm-time
docker run --mount source=your-docker-volume-name,destination=/pine/process-store -p 80:80 -p 4000:4000 ghcr.io/pine-vm/pine
```

## Support HTTPS
Expand Down
2 changes: 1 addition & 1 deletion implement/example-apps/docker-image-default-app/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This app is a placeholder that comes with the [docker image](https://github.com/pine-vm/pine/pkgs/container/elm-time). To deploy your app into the Elm-Time process, follow the guide at <https://github.com/pine-vm/pine/blob/main/guide/how-to-configure-and-deploy-an-elm-backend-app.md>
This app is a placeholder that comes with the [docker image](https://github.com/pine-vm/pine/pkgs/container/pine). To deploy your app into the Elm-Time process, follow the guide at <https://github.com/pine-vm/pine/blob/main/guide/how-to-configure-and-deploy-an-elm-backend-app.md>

You can find the source code for this app at <https://github.com/pine-vm/pine/tree/main/implement/example-apps/docker-image-default-app>
4 changes: 2 additions & 2 deletions implement/example-apps/rich-chat-room/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ You can find the source code for this example at <https://github.com/pine-vm/pin
To run the app with the default source code, use the `run-server` command as follows:

```cmd
elm-time run-server --deploy=https://github.com/pine-vm/pine/tree/main/implement/example-apps/rich-chat-room
pine run-server --deploy=https://github.com/pine-vm/pine/tree/main/implement/example-apps/rich-chat-room
```

If you have copied (and modified) the code on your local file system, you can run the app with this command:

```cmd
elm-time run-server --deploy=.
pine run-server --deploy=.
```

## Fast Distribution of Messages in the Chat Room Using Long-Polling
Expand Down
2 changes: 1 addition & 1 deletion implement/pine/Gui/elm/src/Frontend/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ viewAdminInterfaceConfig state config =
|> Element.column [ Element.spacing 10 ]
]
|> Element.column [ Element.spacing 10 ]
, [ [ Element.text "The easiest way to use the APIs is via the command-line interface in the elm-time executable file." ]
, [ [ Element.text "The easiest way to use the APIs is via the command-line interface in the Pine executable file." ]
, [ Element.text "To learn about the admin interface and how to deploy an app, see "
, Visuals.linkElementFromHref { newTabLink = False } "https://github.com/pine-vm/pine/blob/main/guide/how-to-configure-and-deploy-an-elm-backend-app.md"
]
Expand Down
4 changes: 2 additions & 2 deletions implement/run-server-in-docker.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Since it only uses Docker commands, we can run this script on both Windows and Linux.

docker build --tag elm-time-test .
docker build --tag pine-test .

docker stop elm-test-container

docker run --rm -p 80:80 -p 4000:4000 --name elm-test-container --env "APPSETTING_adminPassword=notempty" elm-time-test
docker run --rm -p 80:80 -p 4000:4000 --name elm-test-container --env "APPSETTING_adminPassword=notempty" pine-test
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#r "System.Text.Json"

/*
Use the `elm-time describe` command to get the hash of a file:
Use the `pine describe` command to get the hash of a file:
elm-time describe ./assembly/assembly.dll
pine describe ./assembly/assembly.dll
Loaded composition d0adb9c0632d35c7a982da279276879c7d49a99dd7c004277f78d34dd718e961 from './assembly/assembly.dll'.
Composition d0adb9c0632d35c7a982da279276879c7d49a99dd7c004277f78d34dd718e961 is a blob containing 4096 bytes
*/
Expand Down
8 changes: 4 additions & 4 deletions implement/website/pinevm/src/Frontend/Page/Download.elm
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ downloadPlatforms =

dockerImageUrl : String
dockerImageUrl =
"https://github.com/pine-vm/pine/pkgs/container/elm-time"
"https://github.com/pine-vm/pine/pkgs/container/pine"


downloads : DownloadLinksByPlatform
downloads =
{ linux = "https://github.com/pine-vm/pine/releases/download/v0.1.4/elm-time-bin-v0.1.4-linux-x64.zip"
, windows = "https://github.com/pine-vm/pine/releases/download/v0.1.4/elm-time-bin-v0.1.4-win-x64.zip"
, macOS = "https://github.com/pine-vm/pine/releases/download/v0.1.4/elm-time-bin-v0.1.4-osx-x64.zip"
{ linux = "https://github.com/pine-vm/pine/releases/download/v0.3.0/pine-bin-v0.3.0-linux-x64.zip"
, windows = "https://github.com/pine-vm/pine/releases/download/v0.3.0/pine-bin-v0.3.0-win-x64.zip"
, macOS = "https://github.com/pine-vm/pine/releases/download/v0.3.0/pine-bin-v0.3.0-osx-x64.zip"
}


Expand Down

0 comments on commit 5007bb0

Please sign in to comment.