Skip to content

Commit 058a508

Browse files
committed
Fix the initial 1.0.0-alpha1 release
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent 481fa5d commit 058a508

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

.github/workflows/publish.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ jobs:
2222
run: dotnet restore "./Synapse.sln"
2323
- name: Build
2424
run: dotnet build "./Synapse.sln" --configuration Release --no-restore
25-
- name: Push1
26-
run: dotnet nuget push "./src/*/*/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
27-
- name: Push2
25+
- name: Push
2826
run: dotnet nuget push "./src/*/*/*/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
2927

3028
publish-server-image:
@@ -111,6 +109,34 @@ jobs:
111109
tags: ${{ steps.meta.outputs.tags }}
112110
labels: ${{ steps.meta.outputs.labels }}
113111

112+
publish-runner-image:
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: Checkout repository
116+
uses: actions/checkout@v3
117+
- name: Log in to the Container registry
118+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
119+
with:
120+
registry: ${{ env.REGISTRY }}
121+
username: ${{ github.actor }}
122+
password: ${{ secrets.GITHUB_TOKEN }}
123+
- name: Extract metadata (tags, labels) for Docker
124+
id: meta
125+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
126+
with:
127+
images: ${{ env.REGISTRY }}/${{ github.repository }}/runner
128+
tags: |
129+
type=semver,pattern={{version}}
130+
type=semver,pattern={{major}}.{{minor}}
131+
- name: Build and push Docker image
132+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
133+
with:
134+
context: .
135+
file: './src/runner/Synapse.Runner/Dockerfile'
136+
push: true
137+
tags: ${{ steps.meta.outputs.tags }}
138+
labels: ${{ steps.meta.outputs.labels }}
139+
114140
publish-server-bin:
115141
name: Release API Binaries
116142
strategy:
@@ -133,7 +159,7 @@ jobs:
133159
- name: Setup
134160
uses: actions/setup-dotnet@v2
135161
with:
136-
dotnet-version: 6.0.x
162+
dotnet-version: 8.0.x
137163
- name: Restore
138164
run: dotnet restore
139165
- name: Build
@@ -182,7 +208,7 @@ jobs:
182208
- name: Setup
183209
uses: actions/setup-dotnet@v2
184210
with:
185-
dotnet-version: 6.0.x
211+
dotnet-version: 8.0.x
186212
- name: Restore
187213
run: dotnet restore
188214
- name: Build
@@ -231,7 +257,7 @@ jobs:
231257
- name: Setup
232258
uses: actions/setup-dotnet@v2
233259
with:
234-
dotnet-version: 6.0.x
260+
dotnet-version: 8.0.x
235261
- name: Restore
236262
run: dotnet restore
237263
- name: Build
@@ -280,7 +306,7 @@ jobs:
280306
- name: Setup
281307
uses: actions/setup-dotnet@v2
282308
with:
283-
dotnet-version: 6.0.x
309+
dotnet-version: 8.0.x
284310
- name: Restore
285311
run: dotnet restore
286312
- name: Build
@@ -329,7 +355,7 @@ jobs:
329355
- name: Setup
330356
uses: actions/setup-dotnet@v2
331357
with:
332-
dotnet-version: 6.0.x
358+
dotnet-version: 8.0.x
333359
- name: Restore
334360
run: dotnet restore
335361
- name: Build

deployments/docker-compose/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
CONNECTIONSTRINGS__REDIS: ${GARNET_URI}
1212
SYNAPSE_DASHBOARD_SERVE: true
1313
SYNAPSE_API_AUTH_TOKEN_FILE: /app/tokens.yaml
14+
SYNAPSE_API_AUTH_AUTHORITY: http://api:8080
1415
volumes:
1516
- ./config/tokens.yaml:/app/tokens.yaml
1617
ports:

src/api/Synapse.Api.Http/Extensions/IServiceCollectionExtensions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
using IdentityServer4.Models;
1514
using Microsoft.AspNetCore.Mvc.Controllers;
1615
using Microsoft.OpenApi.Models;
1716
using Neuroglia;
@@ -34,8 +33,9 @@ public static class IServiceCollectionExtensions
3433
/// Adds and configures the Synapse HTTP API and its related services
3534
/// </summary>
3635
/// <param name="services">The <see cref="IServiceCollection"/> to configure</param>
36+
/// <param name="authority">The API's JWT authority</param>
3737
/// <returns>The configured <see cref="IServiceCollection"/></returns>
38-
public static IServiceCollection AddSynapseHttpApi(this IServiceCollection services)
38+
public static IServiceCollection AddSynapseHttpApi(this IServiceCollection services, string? authority = null)
3939
{
4040
ServiceAccountSigningKey.Initialize();
4141
services.AddHttpContextAccessor();
@@ -46,7 +46,10 @@ public static IServiceCollection AddSynapseHttpApi(this IServiceCollection servi
4646
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
4747
})
4848
.AddApplicationPart(typeof(WorkflowsController).Assembly);
49-
services.AddIdentityServer()
49+
services.AddIdentityServer(options =>
50+
{
51+
if (!string.IsNullOrWhiteSpace(authority)) options.IssuerUri = authority;
52+
})
5053
.AddSigningCredential(ServiceAccountSigningKey.LoadPrivateKey())
5154
.AddInMemoryApiResources(SynapseApiDefaults.OpenIDConnect.ApiResources.AsEnumerable())
5255
.AddInMemoryIdentityResources(SynapseApiDefaults.OpenIDConnect.IdentityResources.AsEnumerable())

src/api/Synapse.Api.Server/Program.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
using IdentityServer4.Extensions;
1415
using Microsoft.AspNetCore.Authentication.JwtBearer;
1516

1617
var builder = WebApplication.CreateBuilder(args);
1718
var applicationOptions = new ApiServerOptions();
1819
builder.Configuration.Bind(applicationOptions);
1920
if (applicationOptions.Authentication.Tokens.Count < 1) throw new Exception("The Synapse API server requires that at least one static user token be configured");
21+
var authority = builder.Environment.RunsInDocker() || builder.Environment.RunsInKubernetes() ? Environment.GetEnvironmentVariable("SYNAPSE_API_AUTH_AUTHORITY") : null;
2022

2123
builder.Services.Configure<ApiServerOptions>(builder.Configuration);
2224
builder.Services.AddResponseCompression();
2325
builder.Services.AddSynapse(builder.Configuration);
2426
builder.Services.AddSynapseApi();
25-
builder.Services.AddSynapseHttpApi();
27+
builder.Services.AddSynapseHttpApi(authority);
2628

2729
var authentication = builder.Services.AddAuthentication(FallbackPolicySchemeDefaults.AuthenticationScheme);
2830
authentication.AddScheme<StaticBearerAuthenticationOptions, StaticBearerAuthenticationHandler>(StaticBearerDefaults.AuthenticationScheme, options =>
@@ -31,9 +33,7 @@
3133
});
3234
authentication.AddJwtBearer(ServiceAccountAuthenticationDefaults.AuthenticationScheme, options =>
3335
{
34-
options.Authority = builder.Environment.RunsInDocker() || builder.Environment.RunsInKubernetes()
35-
? "http://localhost:8080"
36-
: "http://localhost:5257";
36+
options.Authority = authority ?? "http://localhost:5257";
3737
options.RequireHttpsMetadata = false;
3838
options.TokenValidationParameters = new()
3939
{
@@ -109,6 +109,11 @@
109109
if (options.ServeDashboard) app.UseBlazorFrameworkFiles();
110110
app.UseStaticFiles();
111111
app.UseRouting();
112+
if (!string.IsNullOrWhiteSpace(authority)) app.Use(async (ctx, next) =>
113+
{
114+
ctx.SetIdentityServerOrigin(authority);
115+
await next();
116+
});
112117
app.UseIdentityServer();
113118
app.UseAuthentication();
114119
app.UseAuthorization();

0 commit comments

Comments
 (0)