Skip to content

Commit

Permalink
chore: remove scripts and optimize docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashilzendegen committed Nov 8, 2023
1 parent 3aef9e7 commit 56346b1
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 241 deletions.
18 changes: 3 additions & 15 deletions docs/development-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ Scripts to help building and running the system are provided as
[PowerShell Core](https://github.com/powershell/powershell) scripts, to be able to run cross platform on Windows, macOS
and Linux.

First, a script is provided to build all the docker images (`src/build-docker-images.ps1`).

All other scripts are located in the folder `src/docker`:

* The external components (database, message queue, details see below) can be started with the `run-dependencies.ps1`
script.
* Then the environment with one relay server (`run-environment.ps1`)
* or a multi-server environment (`run-environment-multiserver.ps1`) can be started.
A compose file is provided to build all the docker images (`src/docker/docker-compose.yml`). You can build the images
with the `docker compose build` command.

## First time Development & Test-Setup

Expand All @@ -30,10 +24,6 @@ In order to build and run the development environment, you need the following co
or newer features within .NET 6.0
- [PowerShell Core 6](https://github.com/PowerShell/PowerShell/releases) or newer

After you start the system for the first time, you need to execute the `seed-data.ps1` script, which will create the
first initial configuration for the tenants, so that the connectors can connect with their default development
credentials. After that you can run the environment or the multi-server environment.

The _development_ environment also comes with a [Seq](https://datalust.co/seq) logging server in a local docker
container (using the local, free single-user license). For production, the RelayServer components log to stdout and
stderr as this is default in docker environments, but you can also customize your host applications and your images
Expand Down Expand Up @@ -80,9 +70,7 @@ The relay server environment consists of several parts.
- Needs access to the configuration database.
- Needs access to the message queue.
- Needs access to the identity server.
- If this container is started more than once, all relay server instances need to share one storage volume (shared
file storage). See the `src/docker/Thinktecture.Relay.Server.Docker/run-container-multiserver.ps1` for required
links and mounts.
- If this component is started more than once, all instances need to share one storage volume (shared file storage).
- RelayServer can be accessed at http://localhost:5000/ in single-node mode.
- RelayServer node A can be accessed at http://localhost:5010/ in multi-server mode.
- RelayServer node B can be accessed at http://localhost:5011/ in multi-server mode.
Expand Down
7 changes: 1 addition & 6 deletions src/Thinktecture.Relay.sln
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.Relay.Server.I
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.Relay.Server.Management", "Thinktecture.Relay.Server.Management\Thinktecture.Relay.Server.Management.csproj", "{4EF4176E-34E3-477A-8CB1-982A318C3C30}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rabbitmq", "rabbitmq", "{59F4013A-610D-40D2-A6AD-894FBB5A28B4}"
ProjectSection(SolutionItems) = preProject
docker\rabbitmq\.erlang.cookie = docker\rabbitmq\.erlang.cookie
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "environments", "environments", "{0A0F0537-6270-4D1C-AFF7-F998AECCF938}"
ProjectSection(SolutionItems) = preProject
docker\environments\relay_connector.env = docker\environments\relay_connector.env
Expand All @@ -113,6 +108,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "environments", "environment
docker\environments\relay_server_b.env = docker\environments\relay_server_b.env
docker\environments\relay_transport_rabbitmq.env = docker\environments\relay_transport_rabbitmq.env
docker\environments\relay_transport_rabbitmq2.env = docker\environments\relay_transport_rabbitmq2.env
docker\environments\relay_transport_rabbitmq1.env = docker\environments\relay_transport_rabbitmq1.env
EndProjectSection
EndProject
Global
Expand Down Expand Up @@ -235,7 +231,6 @@ Global
{84437CA2-F563-4D08-A1CF-A07ECB154884} = {EACF91C8-8B43-4E87-8859-4902B3CC7F63}
{CD190E32-1B0F-48D4-BFF1-43BD388A7C4A} = {D8D76BB9-1D64-43C5-9B7E-710CF4A35374}
{4EF4176E-34E3-477A-8CB1-982A318C3C30} = {D8D76BB9-1D64-43C5-9B7E-710CF4A35374}
{59F4013A-610D-40D2-A6AD-894FBB5A28B4} = {3126FA1D-9755-4842-BDE0-34F7EADF9969}
{0A0F0537-6270-4D1C-AFF7-F998AECCF938} = {3126FA1D-9755-4842-BDE0-34F7EADF9969}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
9 changes: 0 additions & 9 deletions src/build-docker-images.ps1

This file was deleted.

1 change: 0 additions & 1 deletion src/docker/Thinktecture.Relay.Connector.Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ RUN chmod u-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_c
chmod g-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_chkpwd /usr/bin/expiry /usr/bin/newgrp /usr/bin/chage /usr/bin/chfn /usr/bin/wall /usr/bin/passwd /bin/su

USER relay

COPY --chown=relay --from=build /app .

ENTRYPOINT ["dotnet", "Thinktecture.Relay.Connector.Docker.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ USER idsrv
COPY --chown=idsrv --from=build /app .

EXPOSE 5000

ENV ASPNETCORE_URLS=http://+:5000
ENV CertificateStore__Path=/var/signingkeys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ RUN chmod u-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_c
chmod g-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_chkpwd /usr/bin/expiry /usr/bin/newgrp /usr/bin/chage /usr/bin/chfn /usr/bin/wall /usr/bin/passwd /bin/su

USER relay

COPY --chown=relay --from=build /app .

EXPOSE 5000

ENV ASPNETCORE_URLS=http://+:5000

ENTRYPOINT ["dotnet", "Thinktecture.Relay.ManagementApi.Docker.dll"]
3 changes: 2 additions & 1 deletion src/docker/Thinktecture.Relay.Server.Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ RUN mkdir -p /var/bodystore
RUN chown -R relay /var/bodystore

USER relay

COPY --chown=relay --from=build /app .

EXPOSE 5000

ENV ASPNETCORE_URLS=http://+:5000

ENTRYPOINT ["dotnet", "Thinktecture.Relay.Server.Docker.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists && \
RUN chmod u-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_chkpwd /usr/bin/expiry /usr/bin/newgrp /usr/bin/chage /usr/bin/chfn /usr/bin/wall /usr/bin/passwd /bin/su && \
chmod g-s /usr/bin/gpasswd /usr/bin/chsh /bin/umount /bin/mount /sbin/unix_chkpwd /usr/bin/expiry /usr/bin/newgrp /usr/bin/chage /usr/bin/chfn /usr/bin/wall /usr/bin/passwd /bin/su


USER relay
COPY --chown=relay --from=build /app .

EXPOSE 5000

ENV ASPNETCORE_URLS=http://+:5000

ENTRYPOINT ["dotnet", "Thinktecture.Relay.StatisticsApi.Docker.dll"]
25 changes: 7 additions & 18 deletions src/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ x-defaults: &defaults
x-rabbit-defaults: &rabbit-defaults
<<: *defaults
image: rabbitmq:management-alpine
volumes:
- ./rabbitmq/.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie
command: ["bash", "-c", "chmod 400 /var/lib/rabbitmq/.erlang.cookie; rabbitmq-server"]
command: ["bash", "-c", "echo -n 'V2VsY29tZSB0byBUaGlua3RlY3R1cmUgUmVsYXlTZXJ2ZXIgMyDigJMgWW91IHN1Y2Nlc3NmdWxseSBkZWNvZGVkIG91ciBmYWtlIEVSTEFORyBjb29raWUgY29udGFpbmluZyB0aGlzIG1lc3NhZ2Uu' > /var/lib/rabbitmq/.erlang.cookie; chmod 400 /var/lib/rabbitmq/.erlang.cookie; rabbitmq-server"]

services:
relay_transport_rabbitmq1:
Expand All @@ -30,7 +28,7 @@ services:
- environments/relay_transport_rabbitmq2.env
relay_logging_seq:
<<: *defaults
image: datalust/seq:latest
image: datalust/seq
container_name: relay_logging_seq
ports:
- "5341:80"
Expand All @@ -54,7 +52,6 @@ services:
build:
context: ..
dockerfile: ./docker/Thinktecture.Relay.Server.Docker/Dockerfile
pull_policy: build
container_name: relay_server_migrations
depends_on:
- relay_persistence_postgresql
Expand All @@ -65,7 +62,6 @@ services:
build:
context: ..
dockerfile: ./docker/Thinktecture.Relay.ManagementApi.Docker/Dockerfile
pull_policy: build
container_name: relay_management
ports:
- "5004:5000"
Expand All @@ -87,7 +83,6 @@ services:
build:
context: ..
dockerfile: ./docker/Thinktecture.Relay.IdentityServer.Docker/Dockerfile
pull_policy: build
container_name: relay_identityserver
ports:
- "5002:5000"
Expand All @@ -105,7 +100,7 @@ services:
- environments/relay_server.env
- environments/relay_server_a.env
volumes:
- relay_persistence_bodystore:/var/bodystore
- relay-bodystore:/var/bodystore
depends_on:
- relay_server_migrations
- relay_identityserver
Expand All @@ -119,7 +114,7 @@ services:
- environments/relay_server.env
- environments/relay_server_b.env
volumes:
- relay_persistence_bodystore:/var/bodystore
- relay-bodystore:/var/bodystore
depends_on:
- relay_server_migrations
- relay_identityserver
Expand All @@ -129,14 +124,11 @@ services:
build:
context: ..
dockerfile: ./docker/Thinktecture.Relay.Connector.Docker/Dockerfile
pull_policy: build
container_name: relay_connector_a1
env_file:
- environments/relay_connector.env
- environments/relay_connector_a1.env
depends_on:
- relay_logging_seq
- relay_identityserver
- relay_server_a
relay_connector_a2:
<<: *defaults
Expand All @@ -147,7 +139,6 @@ services:
- environments/relay_connector_a2.env
depends_on:
- relay_connector_a1
- relay_identityserver
relay_connector_b1:
<<: *defaults
image: relay_connector
Expand All @@ -156,8 +147,7 @@ services:
- environments/relay_connector.env
- environments/relay_connector_b1.env
depends_on:
- relay_connector_a1
- relay_identityserver
- relay_server_b
relay_connector_b2:
<<: *defaults
image: relay_connector
Expand All @@ -166,13 +156,12 @@ services:
- environments/relay_connector.env
- environments/relay_connector_b2.env
depends_on:
- relay_connector_a1
- relay_identityserver
- relay_connector_b1

volumes:
seq-data:
postgresql-data:
relay_persistence_bodystore:
relay-bodystore:

networks:
relayserver:
Expand Down
1 change: 0 additions & 1 deletion src/docker/rabbitmq/.erlang.cookie

This file was deleted.

39 changes: 0 additions & 39 deletions src/docker/remove-all.ps1

This file was deleted.

76 changes: 0 additions & 76 deletions src/docker/run-dependencies.ps1

This file was deleted.

22 changes: 0 additions & 22 deletions src/docker/run-environment-multiserver.ps1

This file was deleted.

Loading

0 comments on commit 56346b1

Please sign in to comment.