Skip to content

Commit a1bc5c4

Browse files
authored
Merge pull request #522 from serverlessworkflow/fix-volume-mounts
Fixed the `DockerRuntime` to apply the provided `HostConfig`, thereby supporting volume mount functionality
2 parents ad1f170 + 543d3c3 commit a1bc5c4

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

deployments/docker-compose/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
GARNET_URI=garnet:6379
1+
REDIS_URI=redis:6379
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
services:
22

3-
garnet:
4-
image: ghcr.io/microsoft/garnet
3+
redis:
4+
image: redis:8.0.0
55
volumes:
6-
- garnet_data:/data
6+
- redis_data:/data
77

88
api:
99
image: ghcr.io/serverlessworkflow/synapse/api
1010
environment:
11-
CONNECTIONSTRINGS__REDIS: ${GARNET_URI}
11+
CONNECTIONSTRINGS__REDIS: ${REDIS_URI}
1212
SYNAPSE_DASHBOARD_SERVE: 'true'
1313
SYNAPSE_API_AUTH_TOKEN_FILE: /app/tokens.yaml
1414
SYNAPSE_API_JWT_AUTHORITY: http://api:8080
@@ -18,12 +18,12 @@ services:
1818
ports:
1919
- 8080:8080
2020
depends_on:
21-
- garnet
21+
- redis
2222

2323
operator:
2424
image: ghcr.io/serverlessworkflow/synapse/operator
2525
environment:
26-
CONNECTIONSTRINGS__REDIS: ${GARNET_URI}
26+
CONNECTIONSTRINGS__REDIS: ${REDIS_URI}
2727
SYNAPSE_OPERATOR_NAMESPACE: default
2828
SYNAPSE_OPERATOR_NAME: operator-1
2929
SYNAPSE_RUNNER_API: http://api:8080
@@ -37,25 +37,23 @@ services:
3737
- /var/run/docker.sock:/var/run/docker.sock
3838
user: root
3939
depends_on:
40-
- garnet
40+
- redis
4141

4242
correlator:
4343
image: ghcr.io/serverlessworkflow/synapse/correlator
4444
environment:
45-
CONNECTIONSTRINGS__REDIS: ${GARNET_URI}
45+
CONNECTIONSTRINGS__REDIS: ${REDIS_URI}
4646
SYNAPSE_CORRELATOR_NAMESPACE: default
4747
SYNAPSE_CORRELATOR_NAME: correlator-1
4848
ports:
4949
- 8081:8080
5050
depends_on:
51-
- garnet
51+
- redis
5252

5353
volumes:
54-
55-
garnet_data:
54+
redis_data:
5655
driver: local
5756

5857
networks:
59-
6058
default:
6159
name: synapse

src/core/Synapse.Core.Infrastructure.Containers.Docker/DockerContainerPlatform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public virtual async Task<IContainer> CreateAsync(ContainerProcessDefinition def
100100
HostConfig = new()
101101
{
102102
PortBindings = definition.Ports?.ToDictionary(kvp => kvp.Value.ToString(), kvp => (IList<PortBinding>)[new PortBinding() { HostPort = kvp.Key.ToString() }]),
103-
Binds = definition.Volumes?.Select(e => $"{e.Key}={e.Value}")?.ToList() ?? []
103+
Binds = definition.Volumes?.Select(e => $"{e.Key}:{e.Value}")?.ToList() ?? []
104104
}
105105
};
106106
var response = await this.Docker.Containers.CreateContainerAsync(parameters, cancellationToken).ConfigureAwait(false);

src/core/Synapse.Core/Resources/DockerRuntimeConfiguration.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,22 @@ public DockerRuntimeConfiguration()
8080
[DataMember(Order = 4, Name = "containerTemplate"), JsonPropertyOrder(4), JsonPropertyName("containerTemplate"), YamlMember(Order = 4, Alias = "containerTemplate")]
8181
public virtual Config ContainerTemplate { get; set; } = LoadContainerTemplate();
8282

83+
/// <summary>
84+
/// Gets/sets the configuration of the host to use when running runner containers
85+
/// </summary>
86+
[DataMember(Order = 5, Name = "hostConfig"), JsonPropertyOrder(5), JsonPropertyName("hostConfig"), YamlMember(Order = 5, Alias = "hostConfig")]
87+
public virtual HostConfig? HostConfig { get; set; }
88+
8389
/// <summary>
8490
/// Gets/sets the path to the directory that contains the secrets to mount in runner containers on a per workflow configuration basis
8591
/// </summary>
86-
[DataMember(Order = 5, Name = "secrets"), JsonPropertyOrder(5), JsonPropertyName("secrets"), YamlMember(Order = 5, Alias = "secrets")]
92+
[DataMember(Order = 6, Name = "secrets"), JsonPropertyOrder(6), JsonPropertyName("secrets"), YamlMember(Order = 6, Alias = "secrets")]
8793
public virtual DockerRuntimeSecretsConfiguration Secrets { get; set; } = new();
8894

8995
/// <summary>
9096
/// Gets/sets the name of the network, if any, to connect Runner containers to
9197
/// </summary>
92-
[DataMember(Order = 6, Name = "network"), JsonPropertyOrder(6), JsonPropertyName("network"), YamlMember(Order = 6, Alias = "network")]
98+
[DataMember(Order = 7, Name = "network"), JsonPropertyOrder(7), JsonPropertyName("network"), YamlMember(Order = 7, Alias = "network")]
9399
public virtual string Network { get; set; } = DefaultNetwork;
94100

95101
/// <summary>

src/dashboard/Synapse.Dashboard/Layout/MainLayout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
{
134134
user = (await AuthenticationStateProvider.GetAuthenticationStateAsync()).User;
135135
AuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
136-
theme = await Storage.GetItemAsync("preferedTheme") ?? "dark";
136+
theme = await Storage.GetItemAsync("preferredTheme") ?? "dark";
137137
await MonacoEditorHelper.ChangePreferredThemeAsync(theme);
138138
await base.OnInitializedAsync();
139139
}

src/dashboard/Synapse.Dashboard/Services/JsInterop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public async ValueTask SetThemeAsync(string theme)
6161
{
6262
var module = await moduleTask.Value;
6363
await module.InvokeVoidAsync("setTheme", theme);
64-
await storage.SetItemAsync("preferedTheme", theme);
64+
await storage.SetItemAsync("preferredTheme", theme);
6565
await monacoEditorHelper.ChangePreferredThemeAsync(theme);
6666
}
6767

src/dashboard/Synapse.Dashboard/wwwroot/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<link href="Synapse.Dashboard.styles.css" rel="stylesheet" />
4444
<link href="css/app.css" rel="stylesheet" />
4545
<script type="text/javascript">
46-
const preferedTheme = localStorage.getItem('preferedTheme') || 'dark';
47-
if (preferedTheme == 'light') {
46+
const preferredTheme = localStorage.getItem('preferredTheme') || 'dark';
47+
if (preferredTheme == 'light') {
4848
document.documentElement.removeAttribute('data-bs-theme');
4949
}
5050
</script>

src/runtime/Synapse.Runtime.Docker/Services/DockerRuntime.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,16 @@ public override async Task<IWorkflowProcess> CreateProcessAsync(Workflow workflo
104104
container.SetEnvironmentVariable("DOCKER_HOST", "unix:///var/run/docker.sock");
105105
container.User = "root";
106106
if (this.Runner.Certificates?.Validate == false) container.SetEnvironmentVariable(SynapseDefaults.EnvironmentVariables.SkipCertificateValidation, "true");
107-
var hostConfig = new HostConfig()
108-
{
109-
Mounts = []
110-
};
107+
var hostConfig = this.Runner.Runtime.Docker.HostConfig?.Clone()! ?? new();
111108
if (!Directory.Exists(this.Runner.Runtime.Docker.Secrets.Directory)) Directory.CreateDirectory(this.Runner.Runtime.Docker.Secrets.Directory);
112-
hostConfig.Mounts.Add(new()
109+
hostConfig.Mounts ??= [];
110+
hostConfig.Mounts.Insert(0, new()
113111
{
114112
Type = "bind",
115113
Source = this.Runner.Runtime.Docker.Secrets.Directory,
116114
Target = this.Runner.Runtime.Docker.Secrets.MountPath
117115
});
118-
hostConfig.Mounts.Add(new()
116+
hostConfig.Mounts.Insert(1, new()
119117
{
120118
Type = "bind",
121119
Source = "/var/run/docker.sock",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy