dwyl/learn-temporal

Why? What? How?

nelsonic opened this issue Β· 51 comments

The home page https://temporal.io is a classic landing page ... tells me nothing
image

image

image

image

image

image

image

image

image

Lots of social proof: πŸ™„

image

image

image

This homepage has told me exactly zero of What I'm looking at or How it works. πŸ€¦β€β™‚οΈ

The hero text at the top of the Use Cases page https://temporal.io/use-cases is more social proof noise:

image

Keep scrolling and it's logos ...

image

image

At no point do they actually give any inkling what the actual use case might be!! 😑

Busy watching this: Designing a Workflow Engine from First Principles: https://youtu.be/t524U9CixZ0 πŸ“Ί ⏳

image

Explaining Worflows, Task Queues ... ⏳

image

YouTube shortcut for speeding up playback > (Greater-than sign)

Most applications use databases for storing Task Queues:
image

Maxim has used the word "scalability" so many times in the last 10 minutes ... πŸ™„

image

image

image

Behind the scenes Temporal is using Elastic for storing data:

image

"Transfer queue mechanism" ...

Multicluster deployment:

image

i.e. paying for many instances ...

Wow. talk could have been 5 minutes. talk about dragging it out. πŸ™„

Next:

Complete Intro to Temporal Workshop - TypeScript SDK: https://youtu.be/CeHSmv8oF_4

image

Published Dec 4, 2021 ... 3 months ago. Is this even still relevant? Surely there are like 10 new frameworks since then!

Endorsement from Mitchell Hashimoto of Hashicorp:
image

Yah, it uses gRPC under the hood.

image

Suuuuuuuuuper scalable! πŸš€

Workflows vs. Activities:
image

Basically nothing that has a side-effect is allowed in a workflow.

Loading ...

image

Good thing nobody is in a hurry. ⏳

While I wait ...
Watching this quick intro: https://youtu.be/2HjnQlnA5eY

image

Following the getting started guide: https://docs.temporal.io/docs/typescript/introduction/#getting-started

Bunch of warnings:

image

To begin development, start Temporal Server:

cd ~/path/to/temporal/docker-compose/
docker-compose up

If you haven’t run Temporal Server before, visit:
https://docs.temporal.io/docs/typescript/getting-started/

Then, in the project directory, using two other shells, run these commands:

npm run start.watch
npm run workflow

Got the following error:

[nodemon] starting `ts-node src/worker.ts`
Found prebuilt bridge module {
  binary: '/Users/n/code/learn-temporal/example/node_modules/@temporalio/core-bridge/releases/x86_64-apple-darwin/index.node'
}
[TransportError: Server connection error: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })))]
[nodemon] app crashed - waiting for file changes before starting...

I can certainly see the benefits Temporal.
But the learning curve is steep ...

The temporal forum has only 3 threads for the typescript-sdk tag:
https://community.temporal.io/tag/typescript-sdk
image

Not very active ... πŸ’­

"a real life production deployment can have 5 Frontend, 15 History, 17 Matching, and 3 Worker services per cluster."

https://docs.temporal.io/docs/concepts/what-is-a-temporal-cluster

image

https://docs.temporal.io/docs/concepts/what-is-a-temporal-cluster#database

image

Cassandra, MySQL, and PostgreSQL schemas are supported and thus can be used as the Server's database.

So at the heart of Temporal is a database.
Inevitably most people will use Cassandra because it's soooo scalable ...
https://en.wikipedia.org/wiki/Apache_Cassandra

Gitpod timed out:
image

Reloading ...

image

It didn't save my state ... πŸ™„
Starting everything again from scratch.

Going to try and run everything on localhost instead.

Installing docker ... ⏳

image

image

image

Still blows my mind that this app is so ridiculously huge!! 🀯

image

image

Of course it does ...

image

$ docker-compose up
Error response from daemon: dial unix /Users/n/Library/Containers/com.docker.docker/Data/docker.raw.sock: connect: no such file or directory

Trying to run the sample container:

docker run -d -p 80:80 docker/getting-started

Seeing:

Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
59bf1c3509f3: Pull complete 
8d6ba530f648: Pull complete 
5288d7ad7a7f: Pull complete 
39e51c61c033: Pull complete 
ee6f71c6f4a8: Pull complete 
f2303c6c8865: Pull complete 
0645fddcff40: Pull complete 
d05ee95f5d2f: Pull complete 
Digest: sha256:aa945bdff163395d3293834697fa91fd4c725f47093ec499f27bc032dc1bdd16
Status: Downloaded newer image for docker/getting-started:latest
64ba27e3e31ba2efe50f5f3a2a12ba5094686dab3cf1fbcb40def900de78065e

image

Fans running on my poor mac ...
image

5 Docker containers running just to do "hello world" in Temporal ... πŸ™„

image

http://localhost:8088/
image

Once Docker has successfully downloaded all its dependencies and booted the containers,
you should see something similar to the following in the Docker Desktop App:

docker-temporal-5-containers

Fun fact: The node_modules directory for the Hello World example in Temporal uses 473.7 MB (504.5 MB on disk) ...

image

You wouldn't want to have too many of these projects. πŸ™„

Attempting to run docker-compose up -d

Get the following error:

Creating network "temporal-network" with driver "bridge"
Creating temporal-elasticsearch ... error
Creating temporal-postgresql    ...

ERROR: for temporal-elasticsearch  Cannot create container for service elasticsearch: Conflict. The container name "/temporal-elasticsearch" is already in use by container "830fbd148bb1f4e3422901f7ab362f09b40219a
Creating temporal-postgresql    ... error

ERROR: for temporal-postgresql  Cannot create container for service postgresql: Conflict. The container name "/temporal-postgresql" is already in use by container "ed97ad218913ad6d2a2d5ac2fbd13a81e51d7250e002e4ec693b0f63a18d76bc". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for elasticsearch  Cannot create container for service elasticsearch: Conflict. The container name "/temporal-elasticsearch" is already in use by container "830fbd148bb1f4e3422901f7ab362f09b40219ae4d4e82abda8d3f99d36dd16e". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for postgresql  Cannot create container for service postgresql: Conflict. The container name "/temporal-postgresql" is already in use by container "ed97ad218913ad6d2a2d5ac2fbd13a81e51d7250e002e4ec693b0f63a18d76bc". You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.
n@MBP docker-compose % docker-compose down --remove-orphans
Removing network temporal-network
n@MBP docker-compose % docker-compose up -d
Creating network "temporal-network" with driver "bridge"
Creating temporal-postgresql ...
Creating temporal-elasticsearch ... error

ERROR: for temporal-elasticsearch  Cannot create container for service elasticsearch: Conflict. The contai
Creating temporal-postgresql    ... error
e4d4e82abda8d3f99d36dd16e". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for temporal-postgresql  Cannot create container for service postgresql: Conflict. The container name "/temporal-postgresql" is already in use by container "ed97ad218913ad6d2a2d5ac2fbd13a81e51d7250e002e4ec693b0f63a18d76bc". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for elasticsearch  Cannot create container for service elasticsearch: Conflict. The container name "/temporal-elasticsearch" is already in use by container "830fbd148bb1f4e3422901f7ab362f09b40219ae4d4e82abda8d3f99d36dd16e". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for postgresql  Cannot create container for service postgresql: Conflict. The container name "/temporal-postgresql" is already in use by container "ed97ad218913ad6d2a2d5ac2fbd13a81e51d7250e002e4ec693b0f63a18d76bc". You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.

Thankfully - or sadly depending on your view - this is an issue many people have faced before.
Google search surfaces the following thread: moby/moby#23371

Good thing Docker is so efficient and doesn't take up any space on your SSD ...

image

Ran:

docker container prune

Purged all the Docker Containers and re-created them to test how long it would take.
Obviously Docker only removed the volumes but not the downloaded dependencies so in actual fact they weren't "purged" at all.

docker ps

image

docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[61540] Failed to execute script docker-compose

Had to delete the previous docker containers and re-create them. Then it worked.

This is hilarious, and also on the first page of Google for "learn temporal" :) Actually managed to get the darn thing setup after reading through your posts..

@yazinsai stoked you found the thread and that it was useful to you in your quest to get Temporal running. Please drop a β€œlike” (⭐) on the repo so I have motivation to continue writing the tutorial. 😜