add healthchecks to docker
This commit is contained in:
@@ -24,6 +24,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /build /opt/MareSynchronosServer
|
COPY --from=BUILD /build /opt/MareSynchronosServer
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosServer
|
RUN chown -R mare:mare /opt/MareSynchronosServer
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosServer
|
WORKDIR /opt/MareSynchronosServer
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /MareSynchronosServer /opt/MareSynchronosServer
|
COPY --from=BUILD /MareSynchronosServer /opt/MareSynchronosServer
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosServer
|
RUN chown -R mare:mare /opt/MareSynchronosServer
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosServer
|
WORKDIR /opt/MareSynchronosServer
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /build /opt/MareSynchronosServices
|
COPY --from=BUILD /build /opt/MareSynchronosServices
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosServices
|
RUN chown -R mare:mare /opt/MareSynchronosServices
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosServices
|
WORKDIR /opt/MareSynchronosServices
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /MareSynchronosServices /opt/MareSynchronosServices
|
COPY --from=BUILD /MareSynchronosServices /opt/MareSynchronosServices
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosServices
|
RUN chown -R mare:mare /opt/MareSynchronosServices
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosServices
|
WORKDIR /opt/MareSynchronosServices
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /build /opt/MareSynchronosStaticFilesServer
|
COPY --from=BUILD /build /opt/MareSynchronosStaticFilesServer
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
|
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosStaticFilesServer
|
WORKDIR /opt/MareSynchronosStaticFilesServer
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ RUN adduser \
|
|||||||
|
|
||||||
COPY --from=BUILD /MareSynchronosStaticFilesServer /opt/MareSynchronosStaticFilesServer
|
COPY --from=BUILD /MareSynchronosStaticFilesServer /opt/MareSynchronosStaticFilesServer
|
||||||
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
|
RUN chown -R mare:mare /opt/MareSynchronosStaticFilesServer
|
||||||
|
RUN apt-get update; apt-get install curl -y
|
||||||
|
|
||||||
USER mare:mare
|
USER mare:mare
|
||||||
WORKDIR /opt/MareSynchronosStaticFilesServer
|
WORKDIR /opt/MareSynchronosStaticFilesServer
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ services:
|
|||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U mare"]
|
test: ["CMD-SHELL", "pg_isready -U mare"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
|
start_period: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
@@ -22,7 +23,10 @@ services:
|
|||||||
- 6000:6000/tcp
|
- 6000:6000/tcp
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/sharded/haproxy-shards.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
- ../config/sharded/haproxy-shards.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||||
|
depends_on:
|
||||||
|
mare-server:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
command: [sh, -c, "rm -f /data/dump.rdb && redis-server --save \"\" --appendonly no --requirepass secretredispassword"]
|
command: [sh, -c, "rm -f /data/dump.rdb && redis-server --save \"\" --appendonly no --requirepass secretredispassword"]
|
||||||
@@ -45,6 +49,11 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "curl --fail http://localhost:6000/health || exit 1"]
|
||||||
|
retries: 60
|
||||||
|
start_period: 10s
|
||||||
|
timeout: 1s
|
||||||
|
|
||||||
mare-shard-1:
|
mare-shard-1:
|
||||||
image: darkarchon/mare-synchronos-server:latest
|
image: darkarchon/mare-synchronos-server:latest
|
||||||
@@ -54,8 +63,8 @@ services:
|
|||||||
- ../log/server-shard-1/:/opt/MareSynchronosServer/logs/:rw
|
- ../log/server-shard-1/:/opt/MareSynchronosServer/logs/:rw
|
||||||
- postgres_socket:/var/run/postgresql/:rw
|
- postgres_socket:/var/run/postgresql/:rw
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-server:
|
||||||
- "mare-server"
|
condition: service_healthy
|
||||||
|
|
||||||
mare-shard-2:
|
mare-shard-2:
|
||||||
image: darkarchon/mare-synchronos-server:latest
|
image: darkarchon/mare-synchronos-server:latest
|
||||||
@@ -65,8 +74,8 @@ services:
|
|||||||
- ../log/server-shard-2/:/opt/MareSynchronosServer/logs/:rw
|
- ../log/server-shard-2/:/opt/MareSynchronosServer/logs/:rw
|
||||||
- postgres_socket:/var/run/postgresql/:rw
|
- postgres_socket:/var/run/postgresql/:rw
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-server:
|
||||||
- "mare-server"
|
condition: service_healthy
|
||||||
|
|
||||||
mare-services:
|
mare-services:
|
||||||
image: darkarchon/mare-synchronos-services:latest
|
image: darkarchon/mare-synchronos-services:latest
|
||||||
@@ -78,8 +87,8 @@ services:
|
|||||||
- ../log/services-standalone/:/opt/MareSynchronosServices/logs/:rw
|
- ../log/services-standalone/:/opt/MareSynchronosServices/logs/:rw
|
||||||
- postgres_socket:/var/run/postgresql/:rw
|
- postgres_socket:/var/run/postgresql/:rw
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-server:
|
||||||
- "mare-server"
|
condition: service_healthy
|
||||||
|
|
||||||
mare-files:
|
mare-files:
|
||||||
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
||||||
@@ -90,8 +99,13 @@ services:
|
|||||||
- postgres_socket:/var/run/postgresql/:rw
|
- postgres_socket:/var/run/postgresql/:rw
|
||||||
- ../data/files-shard-main/:/marecache/:rw
|
- ../data/files-shard-main/:/marecache/:rw
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-server:
|
||||||
- "mare-server"
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: curl --fail http://localhost:6200/health || exit 1
|
||||||
|
retries: 60
|
||||||
|
start_period: 10s
|
||||||
|
timeout: 1s
|
||||||
|
|
||||||
mare-files-shard-1:
|
mare-files-shard-1:
|
||||||
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
||||||
@@ -104,8 +118,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 6200:6200/tcp
|
- 6200:6200/tcp
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-files:
|
||||||
- "mare-files"
|
condition: service_healthy
|
||||||
|
|
||||||
mare-files-shard-2:
|
mare-files-shard-2:
|
||||||
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
image: darkarchon/mare-synchronos-staticfilesserver:latest
|
||||||
@@ -118,8 +132,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 6201:6200/tcp
|
- 6201:6200/tcp
|
||||||
depends_on:
|
depends_on:
|
||||||
- "postgres"
|
mare-files:
|
||||||
- "mare-files"
|
condition: service_healthy
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
cache:
|
cache:
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ public class Startup
|
|||||||
|
|
||||||
// configure mare specific services
|
// configure mare specific services
|
||||||
ConfigureMareServices(services, mareConfig);
|
ConfigureMareServices(services, mareConfig);
|
||||||
|
|
||||||
|
services.AddHealthChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureMareServices(IServiceCollection services, IConfigurationSection mareConfig)
|
private static void ConfigureMareServices(IServiceCollection services, IConfigurationSection mareConfig)
|
||||||
@@ -303,6 +305,8 @@ public class Startup
|
|||||||
endpoints.MapGrpcService<GrpcIdentityService>().AllowAnonymous();
|
endpoints.MapGrpcService<GrpcIdentityService>().AllowAnonymous();
|
||||||
endpoints.MapGrpcService<GrpcConfigurationService<ServerConfiguration>>().AllowAnonymous();
|
endpoints.MapGrpcService<GrpcConfigurationService<ServerConfiguration>>().AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endpoints.MapHealthChecks("/health").WithMetadata(new AllowAnonymousAttribute());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ public class Startup
|
|||||||
);
|
);
|
||||||
|
|
||||||
services.AddHostedService(p => (MareConfigurationServiceClient<MareConfigurationAuthBase>)p.GetService<IConfigurationService<MareConfigurationAuthBase>>());
|
services.AddHostedService(p => (MareConfigurationServiceClient<MareConfigurationAuthBase>)p.GetService<IConfigurationService<MareConfigurationAuthBase>>());
|
||||||
|
|
||||||
|
services.AddHealthChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
@@ -161,6 +163,7 @@ public class Startup
|
|||||||
e.MapGrpcService<GrpcFileService>();
|
e.MapGrpcService<GrpcFileService>();
|
||||||
}
|
}
|
||||||
e.MapControllers();
|
e.MapControllers();
|
||||||
|
e.MapHealthChecks("/health").WithMetadata(new AllowAnonymousAttribute());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user