temporalio / samples-php

Temporal PHP SDK samples
Other
88 stars 40 forks source link

Docker image error #42

Open renatocosta opened 10 months ago

renatocosta commented 10 months ago

when you run any example using the configuration docker:

Docker image:

FROM php:8.1.15-cli

RUN apt-get update && apt-get install -y --no-install-recommends \
  nano \
  bash \
  libzip-dev \
  unzip \
  libonig-dev

# Install PHP Extensions
ENV CFLAGS="$CFLAGS -D_GNU_SOURCE"
RUN docker-php-ext-install zip \
  && docker-php-ext-install opcache sockets mbstring \
  && docker-php-ext-enable opcache sockets mbstring

# Protobuf and GRPC
ENV PROTOBUF_VERSION "3.19.2"
RUN pecl channel-update pecl.php.net
RUN pecl install protobuf-${PROTOBUF_VERSION} grpc \
    && docker-php-ext-enable protobuf grpc

# Install Temporal CLI
COPY --from=temporalio/admin-tools /usr/local/bin/tctl /usr/local/bin/tctl

# Install Composer
COPY --from=composer /usr/bin/composer /usr/local/bin/composer

# Wait for Temporal service to star up
COPY wait-for-temporal.sh /usr/local/bin
RUN chmod +x /usr/local/bin/wait-for-temporal.sh

# Copy application codebase
WORKDIR /var/app
COPY app/ /var/app

RUN composer install

# Setup RoadRunner
RUN vendor/bin/rr get --no-interaction \
    && mv rr /usr/local/bin/rr \
    && chmod +x /usr/local/bin/rr

Error:

Deprecated: Return type of Google\Protobuf\Internal\MapField::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapField::offsetSet($index, $newval) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapField::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapField::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapField::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapFieldIter::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapFieldIter::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapFieldIter::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapFieldIter::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0
Deprecated: Return type of Google\Protobuf\Internal\MapFieldIter::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

B]f{"pid":28}

Could anyone help me?

wolfy-j commented 10 months ago

We will try to update the Dockerfile. However, your protobuf version is outdated for this PHP version. Try to use fresher version of protobuf and GRPC. You can find an example here for 8.1: https://github.com/spiral/docker-php81-grpc/blob/main/Dockerfile

renatocosta commented 10 months ago

Thank you @wolfy-j for letting me know. It worked very well except for the following issue:

Name: default
Id: ceff3ec8-7029-44bb-b906-28c8aa3c2e79
Description: Default namespace for Temporal Server.
OwnerEmail: 
NamespaceData: map[string]string(nil)
State: Registered
Retention: 24h0m0s
ActiveClusterName: active
Clusters: active
HistoryArchivalState: Disabled
IsGlobalNamespace: false
FailoverVersion: 0
FailoverHistory: []
VisibilityArchivalState: Disabled
Bad binaries to reset:
+-----------------+----------+------------+--------+
| BINARY CHECKSUM | OPERATOR | START TIME | REASON |
+-----------------+----------+------------+--------+
+-----------------+----------+------------+--------+
Temporal is up - executing command
2023-10-27T20:51:08+0000    DEBUG   rpc             plugin was started  {"address": "tcp://127.0.0.1:6001", "list of the plugins with RPC methods:": ["lock", "app", "informer", "temporal", "resetter"]}
2023-10-27T20:51:08+0000    DEBUG   server          worker is allocated {"pid": 23, "internal_event_name": "EventWorkerConstruct"}
2023-10-27T20:51:08+0000    DEBUG   server          worker is allocated {"pid": 20, "internal_event_name": "EventWorkerConstruct"}
2023-10-27T20:51:08+0000    DEBUG   server          worker is allocated {"pid": 21, "internal_event_name": "EventWorkerConstruct"}
2023-10-27T20:51:08+0000    DEBUG   server          worker is allocated {"pid": 22, "internal_event_name": "EventWorkerConstruct"}
2023-10-27T20:51:08+0000    DEBUG   server          worker is allocated {"pid": 36, "internal_event_name": "EventWorkerConstruct"}
2023-10-27T20:51:08+0000    DEBUG   temporal        outgoing message    {"id": 0, "data": "", "context": ""}
2023-10-27T20:51:09+0000    DEBUG   server          req-resp mode   {"pid": 36}
2023-10-27T20:51:09+0000    DEBUG   temporal        received message    {"command": null, "id": 0, "data": "\n\ufffd\u001f*\ufffd\u001f\n\ufffd\u0019\n\u0016\n\u0008encoding\u0012\njson/plain\u0012\ufffd\u0019{\"TaskQueue\":\"default\",\"Options\":{\"MaxConcurrentActivityExecutionSize\":0,\"WorkerActivitiesPerSecond\":0.0,\"MaxConcurrentLocalActivityExecutionSize\":0,\"WorkerLocalActivitiesPerSecond\":0.0,\"TaskQueueActivitiesPerSecond\":0.0,\"MaxConcurrentActivityTaskPollers\":0,\"MaxConcurrentWorkflowTaskExecutionSize\":0,\"MaxConcurrentWorkflowTaskPollers\":0,\"StickyScheduleToStartTimeout\":null,\"WorkerStopTimeout\":null,\"EnableSessionWorker\":false,\"SessionResourceID\":null,\"MaxConcurrentSessionExecutionSize\":1000},\"Workflows\":[{\"Name\":\"FileProcessing\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Cron.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"SearchAttributes\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Parent.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Child.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"CancellationScope.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"SimpleActivity.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"DynamicSleepWorkflowInterface\",\"Queries\":[\"getWakeUpTime\"],\"Signals\":[\"updateWakeUpTime\"]},{\"Name\":\"GreetingWorkflow\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"AsyncActivityCompletion.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"FailedWorkflow\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"ChildWorkflow\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"MoneyBatch\",\"Queries\":[\"getBalance\",\"getCount\"],\"Signals\":[\"withdraw\"]},{\"Name\":\"AsyncActivity.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"ActivityRetry.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Signal.greet\",\"Queries\":[],\"Signals\":[\"addName\",\"exit\"]},{\"Name\":\"Polymorphic.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"AsyncClosure.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Periodic.greet\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"SubscriptionWorkflowInterface\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"QueryWorkflow.createGreeting\",\"Queries\":[\"queryGreeting\"],\"Signals\":[]},{\"Name\":\"Saga\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Saga.Compensate\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"Saga.ChildWorkflow\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"BookingSaga\",\"Queries\":[],\"Signals\":[]},{\"Name\":\"MoneyTransfer\",\"Queries\":[],\"Signals\":[]}],\"Activities\":[{\"Name\":\"FileProcessing.upload\"},{\"Name\":\"FileProcessing.process\"},{\"Name\":\"FileProcessing.download\"},{\"Name\":\"Cron.ComposeGreeting\"},{\"Name\":\"composeGreeting\"},{\"Name\":\"CancellationScope.ComposeGreeting\"},{\"Name\":\"SimpleActivity.ComposeGreeting\"},{\"Name\":\"AsyncActivityCompletion.ComposeGreeting\"},{\"Name\":\"fail\"},{\"Name\":\"MoneyBatch.deposit\"},{\"Name\":\"MoneyBatch.withdraw\"},{\"Name\":\"AsyncActivity.ComposeGreeting\"},{\"Name\":\"ActivityRetry.ComposeGreeting\"},{\"Name\":\"Hello.composeGreeting\"},{\"Name\":\"Bye.composeGreeting\"},{\"Name\":\"AsyncClosure.ComposeGreeting\"},{\"Name\":\"Periodic.Greet\"},{\"Name\":\"Subscription.sendWelcomeEmail\"},{\"Name\":\"Subscription.chargeMonthlyFee\"},{\"Name\":\"Subscription.sendEndOfTrialEmail\"},{\"Name\":\"Subscription.sendMonthlyChargeEmail\"},{\"Name\":\"Subscription.sendSorryToSeeYouGoEmail\"},{\"Name\":\"Subscription.processSubscriptionCancellation\"},{\"Name\":\"Saga.execute\"},{\"Name\":\"Saga.compensate\"},{\"Name\":\"BookingActivities.reserveCar\"},{\"Name\":\"BookingActivities.bookFlight\"},{\"Name\":\"BookingActivities.bookHotel\"},{\"Name\":\"BookingActivities.cancelFlight\"},{\"Name\":\"BookingActivities.cancelHotel\"},{\"Name\":\"BookingActivities.cancelCar\"},{\"Name\":\"MoneyTransfer.deposit\"},{\"Name\":\"MoneyTransfer.withdraw\"}],\"PhpSdkVersion\":\"2.6.1\"}\n\ufffd\u0005\n\u0016\n\u0008encoding\u0012\njson/plain\u0012\ufffd\u0005{\"TaskQueue\":\"fc03f8c0c9f4\",\"Options\":{\"MaxConcurrentActivityExecutionSize\":0,\"WorkerActivitiesPerSecond\":0.0,\"MaxConcurrentLocalActivityExecutionSize\":0,\"WorkerLocalActivitiesPerSecond\":0.0,\"TaskQueueActivitiesPerSecond\":0.0,\"MaxConcurrentActivityTaskPollers\":0,\"MaxConcurrentWorkflowTaskExecutionSize\":0,\"MaxConcurrentWorkflowTaskPollers\":0,\"StickyScheduleToStartTimeout\":null,\"WorkerStopTimeout\":null,\"EnableSessionWorker\":false,\"SessionResourceID\":null,\"MaxConcurrentSessionExecutionSize\":1000},\"Workflows\":[],\"Activities\":[{\"Name\":\"FileProcessing.upload\"},{\"Name\":\"FileProcessing.process\"},{\"Name\":\"FileProcessing.download\"}],\"PhpSdkVersion\":\"2.6.1\"}"}
2023-10-27T20:51:09+0000    DEBUG   temporal        PHP-SDK version: 2.6.1
handle_serve_command: Function call error:
    serve error from the plugin *rrtemporal.Plugin stopping execution, error: temporal_plugin_serve: failed reaching server: last connection error: connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:7233: connect: connection refused"

It is running on docker-compose mac os.

Do you @wolfy-j have any idea how to proceed with that?