diff --git a/docs/develop/go/cancellation.mdx b/docs/develop/go/cancellation.mdx
index 282f327c1b..302a581119 100644
--- a/docs/develop/go/cancellation.mdx
+++ b/docs/develop/go/cancellation.mdx
@@ -52,7 +52,7 @@ func YourWorkflow(ctx workflow.Context) error {
WaitForCancellation: true,
}
defer func() {
- // This logic ensures cleanup only happens if there is a Cancellation error
+ // This logic ensures cleanup only happens if there is a Cancelation error
if !errors.Is(ctx.Err(), workflow.ErrCanceled) {
return
}
diff --git a/docs/develop/plugins-guide.mdx b/docs/develop/plugins-guide.mdx
index 6fb581cbca..871f5bd6b8 100644
--- a/docs/develop/plugins-guide.mdx
+++ b/docs/develop/plugins-guide.mdx
@@ -81,9 +81,9 @@ Temporal's Activity retry mechanism gives applications the benefits of Durable E
async def some_activity() -> None:
return None
-plugin = SimplePlugin("organization.PluginName", activities=[some_activity])
-````
+plugin = SimplePlugin("organization.PluginName", activities=[some_activity])
+```
{/* SNIPEND */}
@@ -108,8 +108,7 @@ func createActivityPlugin() (*temporal.SimplePlugin, error) {
})
}
-````
-
+```
{/* SNIPEND */}
@@ -123,13 +122,18 @@ public interface SomeActivity {
void someActivity();
}
-public class SomeActivityImpl implements SomeActivity { @Override public void someActivity() { // Activity
-implementation } }
-
-SimplePlugin activityPlugin = SimplePlugin.newBuilder("organization.PluginName") .registerActivitiesImplementations(new
-SomeActivityImpl()) .build();
+public class SomeActivityImpl implements SomeActivity {
+ @Override
+ public void someActivity() {
+ // Activity implementation
+ }
+}
-````
+SimplePlugin activityPlugin =
+ SimplePlugin.newBuilder("organization.PluginName")
+ .registerActivitiesImplementations(new SomeActivityImpl())
+ .build();
+```
{/* SNIPEND */}
@@ -143,8 +147,7 @@ const plugin = new SimplePlugin({
pluginActivity: activity,
},
});
-````
-
+```
{/* SNIPEND */}
@@ -155,10 +158,10 @@ const plugin = new SimplePlugin({
[Activity]
static void SomeActivity() => throw new NotImplementedException();
-SimplePlugin activityPlugin = new SimplePlugin( "organization.PluginName", new SimplePluginOptions() {
-}.AddActivity(SomeActivity));
-
-````
+SimplePlugin activityPlugin = new SimplePlugin(
+ "organization.PluginName",
+ new SimplePluginOptions() { }.AddActivity(SomeActivity));
+```
{/* SNIPEND */}
@@ -173,8 +176,7 @@ plugin = Temporalio::SimplePlugin.new(
name: 'organization.PluginName',
activities: [method(:some_activity)]
)
-````
-
+```
{/* SNIPEND */}
@@ -256,9 +258,9 @@ class HelloWorkflow:
async def run(self, name: str) -> str:
return f"Hello, {name}!"
-plugin = SimplePlugin("organization.PluginName", workflows=[HelloWorkflow])
-````
+plugin = SimplePlugin("organization.PluginName", workflows=[HelloWorkflow])
+```
{/* SNIPEND */}
@@ -282,8 +284,7 @@ func createWorkflowPlugin() (*temporal.SimplePlugin, error) {
})
}
-````
-
+```
{/* SNIPEND */}
@@ -297,13 +298,18 @@ public interface HelloWorkflow {
String run(String name);
}
-public static class HelloWorkflowImpl implements HelloWorkflow { @Override public String run(String name) { return
-"Hello, " + name + "!"; } }
-
-SimplePlugin workflowPlugin = SimplePlugin.newBuilder("organization.PluginName")
-.registerWorkflowImplementationTypes(HelloWorkflowImpl.class) .build();
+public static class HelloWorkflowImpl implements HelloWorkflow {
+ @Override
+ public String run(String name) {
+ return "Hello, " + name + "!";
+ }
+}
-````
+SimplePlugin workflowPlugin =
+ SimplePlugin.newBuilder("organization.PluginName")
+ .registerWorkflowImplementationTypes(HelloWorkflowImpl.class)
+ .build();
+```
{/* SNIPEND */}
@@ -320,8 +326,7 @@ class SimpleWorkflow
SimplePlugin workflowPlugin = new SimplePlugin(
"organization.PluginName",
new SimplePluginOptions() { }.AddWorkflow());
-````
-
+```
{/* SNIPEND */}
@@ -335,9 +340,11 @@ class HelloWorkflow < Temporalio::Workflow::Definition
end
end
-plugin = Temporalio::SimplePlugin.new( name: 'organization.PluginName', workflows: [HelloWorkflow] )
-
-````
+plugin = Temporalio::SimplePlugin.new(
+ name: 'organization.PluginName',
+ workflows: [HelloWorkflow]
+)
+```
{/* SNIPEND */}
@@ -372,8 +379,7 @@ class WeatherServiceHandler:
plugin = SimplePlugin(
"organization.PluginName", nexus_service_handlers=[WeatherServiceHandler()]
)
-````
-
+```
{/* SNIPEND */}
@@ -385,21 +391,36 @@ type WeatherInput struct {
City string `json:"city"`
}
-type Weather struct { City string `json:"city"` TemperatureRange string `json:"temperatureRange"` Conditions string
-`json:"conditions"` }
+type Weather struct {
+ City string `json:"city"`
+ TemperatureRange string `json:"temperatureRange"`
+ Conditions string `json:"conditions"`
+}
var WeatherService = nexus.NewService("weather-service")
-var GetWeatherOperation = nexus.NewSyncOperation( "get-weather", func(ctx context.Context, input WeatherInput, options
-nexus.StartOperationOptions) (Weather, error) { return Weather{ City: input.City, TemperatureRange: "14-20C",
-Conditions: "Sunny with wind.", }, nil }, )
+var GetWeatherOperation = nexus.NewSyncOperation(
+ "get-weather",
+ func(ctx context.Context, input WeatherInput, options nexus.StartOperationOptions) (Weather, error) {
+ return Weather{
+ City: input.City,
+ TemperatureRange: "14-20C",
+ Conditions: "Sunny with wind.",
+ }, nil
+ },
+)
-func createNexusPlugin() (\*temporal.SimplePlugin, error) { return
-temporal.NewSimplePlugin(temporal.SimplePluginOptions{ Name: "organization.PluginName", RunContextBefore: func(ctx
-context.Context, options temporal.SimplePluginRunContextBeforeOptions) error {
-options.Registry.RegisterNexusService(WeatherService) return nil }, }) }
+func createNexusPlugin() (*temporal.SimplePlugin, error) {
+ return temporal.NewSimplePlugin(temporal.SimplePluginOptions{
+ Name: "organization.PluginName",
+ RunContextBefore: func(ctx context.Context, options temporal.SimplePluginRunContextBeforeOptions) error {
+ options.Registry.RegisterNexusService(WeatherService)
+ return nil
+ },
+ })
+}
-````
+```
{/* SNIPEND */}
@@ -443,8 +464,7 @@ SimplePlugin nexusPlugin =
SimplePlugin.newBuilder("organization.PluginName")
.registerNexusServiceImplementation(new WeatherService())
.build();
-````
-
+```
{/* SNIPEND */}
@@ -480,22 +500,24 @@ public interface IStringService
string DoSomething(string name);
}
-[NexusServiceHandler(typeof(IStringService))] public class HandlerFactoryStringService { private readonly
-Func> handlerFactory;
+[NexusServiceHandler(typeof(IStringService))]
+public class HandlerFactoryStringService
+{
+ private readonly Func> handlerFactory;
public HandlerFactoryStringService(Func> handlerFactory) =>
this.handlerFactory = handlerFactory;
[NexusOperationHandler]
public IOperationHandler DoSomething() => handlerFactory();
-
}
-SimplePlugin nexusPlugin = new SimplePlugin( "organization.PluginName", new SimplePluginOptions() {
-}.AddNexusService(new HandlerFactoryStringService(() => OperationHandler.Sync((ctx, name) => $"Hello,
-{name}"))) );
-
-````
+SimplePlugin nexusPlugin = new SimplePlugin(
+ "organization.PluginName",
+ new SimplePluginOptions() { }.AddNexusService(new HandlerFactoryStringService(() =>
+ OperationHandler.Sync((ctx, name) => $"Hello, {name}")))
+);
+```
{/* SNIPEND */}
@@ -521,8 +543,7 @@ def set_converter(converter: DataConverter | None) -> DataConverter:
plugin = SimplePlugin("organization.PluginName", data_converter=set_converter)
-````
-
+```
{/* SNIPEND */}
@@ -533,14 +554,13 @@ plugin = SimplePlugin("organization.PluginName", data_converter=set_converter)
func createConverterPlugin() (*temporal.SimplePlugin, error) {
customConverter := converter.GetDefaultDataConverter() // Or your custom converter
- return temporal.NewSimplePlugin(temporal.SimplePluginOptions{
- Name: "organization.PluginName",
- DataConverter: customConverter,
- })
-
+ return temporal.NewSimplePlugin(temporal.SimplePluginOptions{
+ Name: "organization.PluginName",
+ DataConverter: customConverter,
+ })
}
-````
+```
{/* SNIPEND */}
@@ -557,8 +577,7 @@ SimplePlugin converterPlugin =
return existingConverter;
})
.build();
-````
-
+```
{/* SNIPEND */}
@@ -594,11 +613,15 @@ private class Codec : IPayloadCodec
public Task> DecodeAsync(IReadOnlyCollection payloads) => throw new NotImplementedException();
}
-SimplePlugin converterPlugin = new SimplePlugin( "organization.PluginName", new SimplePluginOptions() {
-DataConverterOption = new SimplePluginOptions.SimplePluginOption( (converter) => converter with {
-PayloadCodec = new Codec() } ), });
-
-````
+SimplePlugin converterPlugin = new SimplePlugin(
+ "organization.PluginName",
+ new SimplePluginOptions()
+ {
+ DataConverterOption = new SimplePluginOptions.SimplePluginOption(
+ (converter) => converter with { PayloadCodec = new Codec() }
+ ),
+ });
+```
{/* SNIPEND */}
@@ -613,8 +636,7 @@ plugin = Temporalio::SimplePlugin.new(
name: 'organization.PluginName',
data_converter: custom_converter
)
-````
-
+```
{/* SNIPEND */}
@@ -636,11 +658,16 @@ can [learn more about interceptors](/develop/python/interceptors) for the detail
class SomeWorkerInterceptor(temporalio.worker.Interceptor):
pass # Your implementation
-class SomeClientInterceptor(temporalio.client.Interceptor): pass # Your implementation
-plugin = SimplePlugin( "organization.PluginName", interceptors=[SomeWorkerInterceptor(), SomeClientInterceptor()], )
+class SomeClientInterceptor(temporalio.client.Interceptor):
+ pass # Your implementation
+
-````
+plugin = SimplePlugin(
+ "organization.PluginName",
+ interceptors=[SomeWorkerInterceptor(), SomeClientInterceptor()],
+)
+```
{/* SNIPEND */}
@@ -663,8 +690,7 @@ func createInterceptorPlugin() (*temporal.SimplePlugin, error) {
})
}
-````
-
+```
{/* SNIPEND */}
@@ -676,14 +702,16 @@ public class SomeWorkerInterceptor extends WorkerInterceptorBase {
// Your worker interceptor implementation
}
-public class SomeClientInterceptor extends WorkflowClientInterceptorBase {
- // Your client interceptor implementation
+public class SomeClientInterceptor extends WorkflowClientInterceptorBase {
+ // Your client interceptor implementation
}
-SimplePlugin interceptorPlugin = SimplePlugin.newBuilder("organization.PluginName") .addWorkerInterceptors(new
-SomeWorkerInterceptor()) .addClientInterceptors(new SomeClientInterceptor()) .build();
-
-````
+SimplePlugin interceptorPlugin =
+ SimplePlugin.newBuilder("organization.PluginName")
+ .addWorkerInterceptors(new SomeWorkerInterceptor())
+ .addClientInterceptors(new SomeClientInterceptor())
+ .build();
+```
{/* SNIPEND */}
@@ -716,8 +744,7 @@ const plugin = new SimplePlugin({
],
},
});
-````
-
+```
{/* SNIPEND */}
@@ -732,20 +759,25 @@ private class SomeClientInterceptor : IClientInterceptor
throw new NotImplementedException();
}
-private class SomeWorkerInterceptor : IWorkerInterceptor { public WorkflowInboundInterceptor InterceptWorkflow(
-WorkflowInboundInterceptor nextInterceptor) => throw new NotImplementedException();
+private class SomeWorkerInterceptor : IWorkerInterceptor
+{
+ public WorkflowInboundInterceptor InterceptWorkflow(
+ WorkflowInboundInterceptor nextInterceptor) =>
+ throw new NotImplementedException();
public ActivityInboundInterceptor InterceptActivity(
ActivityInboundInterceptor nextInterceptor) =>
throw new NotImplementedException();
-
}
-SimplePlugin interceptorPlugin = new SimplePlugin( "organization.PluginName", new SimplePluginOptions() {
-ClientInterceptors = new List() { new SomeClientInterceptor() }, WorkerInterceptors = new
-List() { new SomeWorkerInterceptor() }, });
-
-````
+SimplePlugin interceptorPlugin = new SimplePlugin(
+ "organization.PluginName",
+ new SimplePluginOptions()
+ {
+ ClientInterceptors = new List() { new SomeClientInterceptor() },
+ WorkerInterceptors = new List() { new SomeWorkerInterceptor() },
+ });
+```
{/* SNIPEND */}
@@ -775,8 +807,7 @@ plugin = Temporalio::SimplePlugin.new(
client_interceptors: [SomeClientInterceptor.new],
worker_interceptors: [SomeWorkerInterceptor.new]
)
-````
-
+```
{/* SNIPEND */}
@@ -815,7 +846,6 @@ use sandboxing, your Plugin should specify the Workflow runner that it uses.
{/* SNIPSTART python-plugin-sandbox */}
[features/snippets/plugins/plugins.py](https://github.com/temporalio/features/blob/main/features/snippets/plugins/plugins.py)
-
```py
def workflow_runner(runner: WorkflowRunner | None) -> WorkflowRunner:
if not runner:
@@ -832,7 +862,6 @@ def workflow_runner(runner: WorkflowRunner | None) -> WorkflowRunner:
plugin = SimplePlugin("organization.PluginName", workflow_runner=workflow_runner)
```
-
{/* SNIPEND */}
#### TypeScript
@@ -846,7 +875,6 @@ you aren't aware of the exact function of the plugin, you can always provide it,
{/* SNIPSTART typescript-plugins-bundler */}
[features/snippets/plugins/plugins.ts](https://github.com/temporalio/features/blob/main/features/snippets/plugins/plugins.ts)
-
```ts
const bundle = await bundleWorkflowCode({
workflowsPath: require.resolve('./workflows'),
@@ -860,7 +888,6 @@ const worker = await Worker.create({
plugins: [plugin],
});
```
-
{/* SNIPEND */}
## Testing your Plugin {#testing-your-plugin}
diff --git a/docs/develop/typescript/asynchronous-activity-completion.mdx b/docs/develop/typescript/asynchronous-activity-completion.mdx
index 082e3a4add..4f648dc631 100644
--- a/docs/develop/typescript/asynchronous-activity-completion.mdx
+++ b/docs/develop/typescript/asynchronous-activity-completion.mdx
@@ -30,7 +30,7 @@ To asynchronously complete an Activity, call [`AsyncCompletionClient.complete`](
[activities-examples/src/activities/async-completion.ts](https://github.com/temporalio/samples-typescript/blob/main/activities-examples/src/activities/async-completion.ts)
```ts
import { CompleteAsyncError, activityInfo } from '@temporalio/activity';
-import { AsyncCompletionClient } from '@temporalio/client';
+import { Client } from '@temporalio/client';
export async function doSomethingAsync(): Promise {
const taskToken = activityInfo().taskToken;
@@ -40,9 +40,9 @@ export async function doSomethingAsync(): Promise {
// this work could be done in a different process or on a different machine
async function doSomeWork(taskToken: Uint8Array): Promise {
- const client = new AsyncCompletionClient();
+ const client = new Client();
// does some work...
- await client.complete(taskToken, "Job's done!");
+ await client.activity.complete(taskToken, "Job's done!");
}
```
diff --git a/docs/evaluate/development-production-features/job-queue.mdx b/docs/evaluate/development-production-features/job-queue.mdx
index 2d04842fe1..b9e3c1613c 100644
--- a/docs/evaluate/development-production-features/job-queue.mdx
+++ b/docs/evaluate/development-production-features/job-queue.mdx
@@ -58,4 +58,4 @@ Standalone Activities add the ability to execute any Temporal Activity as a top-
-
\ No newline at end of file
+
diff --git a/docs/evaluate/development-production-features/temporal-nexus.mdx b/docs/evaluate/development-production-features/temporal-nexus.mdx
index 7c0842f3eb..29f772b4ee 100644
--- a/docs/evaluate/development-production-features/temporal-nexus.mdx
+++ b/docs/evaluate/development-production-features/temporal-nexus.mdx
@@ -161,4 +161,4 @@ To connect with the Nexus community, join the [#nexus](https://temporalio.slack.
-
\ No newline at end of file
+
diff --git a/docs/evaluate/temporal-cloud/actions.mdx b/docs/evaluate/temporal-cloud/actions.mdx
index 046442bf2b..afcd46f9cf 100644
--- a/docs/evaluate/temporal-cloud/actions.mdx
+++ b/docs/evaluate/temporal-cloud/actions.mdx
@@ -158,4 +158,4 @@ Actions.
## Fairness
-For each hour a Namespace has the _Fairness_ feature enabled, an additional `0.1` Action will be charged per Action in the Namespace.
\ No newline at end of file
+For each hour a Namespace has the _Fairness_ feature enabled, an additional `0.1` Action will be charged per Action in the Namespace.
diff --git a/docs/production-deployment/self-hosted-guide/visibility.mdx b/docs/production-deployment/self-hosted-guide/visibility.mdx
index fad032fef2..b86a24a4a5 100644
--- a/docs/production-deployment/self-hosted-guide/visibility.mdx
+++ b/docs/production-deployment/self-hosted-guide/visibility.mdx
@@ -135,29 +135,31 @@ The following example shows how to set up your MySQL as both your persistence an
with different databases.
{/* SNIPSTART compose-mysql-setup */}
-[compose/scripts/setup-mysql.sh](https://github.com/temporalio/samples-server/blob/docker-image-restructure-snipsync/compose/scripts/setup-mysql.sh)
-
+[compose/scripts/setup-mysql.sh](https://github.com/temporalio/samples-server/blob/main/compose/scripts/setup-mysql.sh)
```sh
set -eu
+# Validate required environment variables
+: "${MYSQL_SEEDS:?ERROR: MYSQL_SEEDS environment variable is required}"
+: "${MYSQL_USER:?ERROR: MYSQL_USER environment variable is required}"
+
echo 'Starting MySQL schema setup...'
echo 'Waiting for MySQL port to be available...'
-nc -z -w 10 mysql 3306
+nc -z -w 10 ${MYSQL_SEEDS} ${DB_PORT:-3306}
echo 'MySQL port is available'
# Create and setup temporal database
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal create
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal setup-schema -v 0.0
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal create
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal setup-schema -v 0.0
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned
# Create and setup visibility database
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility create
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility setup-schema -v 0.0
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility update-schema -d /etc/temporal/schema/mysql/v8/visibility/versioned
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility create
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility setup-schema -v 0.0
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility update-schema -d /etc/temporal/schema/mysql/v8/visibility/versioned
echo 'MySQL schema setup complete'
```
-
{/* SNIPEND */}
Note that the script uses
@@ -228,29 +230,31 @@ The following example shows how to set up your PostgreSQL as both persistence an
with different databases.
{/* SNIPSTART compose-postgres-setup */}
-[compose/scripts/setup-postgres.sh](https://github.com/temporalio/samples-server/blob/docker-image-restructure-snipsync/compose/scripts/setup-postgres.sh)
-
+[compose/scripts/setup-postgres.sh](https://github.com/temporalio/samples-server/blob/main/compose/scripts/setup-postgres.sh)
```sh
set -eu
+# Validate required environment variables
+: "${POSTGRES_SEEDS:?ERROR: POSTGRES_SEEDS environment variable is required}"
+: "${POSTGRES_USER:?ERROR: POSTGRES_USER environment variable is required}"
+
echo 'Starting PostgreSQL schema setup...'
echo 'Waiting for PostgreSQL port to be available...'
-nc -z -w 10 postgresql 5432
+nc -z -w 10 ${POSTGRES_SEEDS} ${DB_PORT:-5432}
echo 'PostgreSQL port is available'
# Create and setup temporal database
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal create
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal setup-schema -v 0.0
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal create
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal setup-schema -v 0.0
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned
# Create and setup visibility database
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility create
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility setup-schema -v 0.0
-temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility create
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility setup-schema -v 0.0
+temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned
echo 'PostgreSQL schema setup complete'
```
-
{/* SNIPEND */}
Note that the script uses
@@ -469,8 +473,7 @@ The following example shows how to set up an Elasticsearch Visibility store with
[samples-server repository](https://github.com/temporalio/samples-server/tree/main/compose/scripts).
{/* SNIPSTART compose-mysql-es-setup */}
-[compose/scripts/setup-mysql-es.sh](https://github.com/temporalio/samples-server/blob/docker-image-restructure-snipsync/compose/scripts/setup-mysql-es.sh)
-
+[compose/scripts/setup-mysql-es.sh](https://github.com/temporalio/samples-server/blob/main/compose/scripts/setup-mysql-es.sh)
```sh
set -eu
@@ -481,15 +484,18 @@ set -eu
: "${ES_VISIBILITY_INDEX:?ERROR: ES_VISIBILITY_INDEX environment variable is required}"
: "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}"
+: "${MYSQL_SEEDS:?ERROR: MYSQL_SEEDS environment variable is required}"
+: "${MYSQL_USER:?ERROR: MYSQL_USER environment variable is required}"
+
echo 'Starting MySQL and Elasticsearch schema setup...'
echo 'Waiting for MySQL port to be available...'
-nc -z -w 10 mysql 3306
+nc -z -w 10 ${MYSQL_SEEDS} ${DB_PORT:-3306}
echo 'MySQL port is available'
# Create and setup temporal database
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal create
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal setup-schema -v 0.0
-temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal create
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal setup-schema -v 0.0
+temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned
# Setup Elasticsearch index
# temporal-elasticsearch-tool is available in v1.30+ server releases
@@ -499,7 +505,7 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
temporal-elasticsearch-tool --ep "$ES_SCHEME://$ES_HOST:$ES_PORT" create-index --index $ES_VISIBILITY_INDEX
else
echo 'Using curl for Elasticsearch setup'
- echo 'WARNING: this curl fallback is for older images; current admin-tools images include temporal-elasticsearch-tool.'
+ echo 'WARNING: curl will be removed from admin-tools in v1.30.'
echo 'Waiting for Elasticsearch to be ready...'
max_attempts=30
attempt=0
@@ -526,7 +532,6 @@ fi
echo 'MySQL and Elasticsearch setup complete'
```
-
{/* SNIPEND */}
### Elasticsearch privileges