-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
220 additions
and
508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# multistage docker build | ||
FROM messense/rust-musl-cross:aarch64-musl as builder | ||
ENV SQLX_OFFLINE=true | ||
WORKDIR /app | ||
|
||
# Install protoc | ||
RUN apt-get update && apt-get install -y protobuf-compiler | ||
# update rust toolchain | ||
RUN rustup update | ||
|
||
# copy relevant source code | ||
COPY ./chat ./chat | ||
COPY ./protos ./protos | ||
|
||
# build and show build result | ||
RUN cd chat && cargo build --release --target aarch64-unknown-linux-musl | ||
RUN ls /app/chat/target/aarch64-unknown-linux-musl/release | ||
|
||
# final stage | ||
FROM alpine:3.20 | ||
|
||
WORKDIR /app | ||
|
||
# Create a non-root user and group | ||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
|
||
# Set permissions for /app | ||
RUN chown -R appuser:appgroup /app | ||
|
||
# Switch to the non-root user | ||
USER appuser | ||
|
||
ARG APP_NAME | ||
ARG APP_PORT | ||
|
||
COPY --from=builder /app/chat/target/aarch64-unknown-linux-musl/release/$APP_NAME /app/$APP_NAME | ||
|
||
EXPOSE $APP_PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
DOCKER=podman | ||
PWD=$(shell pwd) | ||
|
||
|
||
build-docker: | ||
$(DOCKER) build -t chat-server:latest --build-arg APP_NAME=chat-server --build-arg APP_PORT=6688 . | ||
$(DOCKER) build -t notify-server:latest --build-arg APP_NAME=notify-server --build-arg APP_PORT=6687 . | ||
$(DOCKER) build -t bot-server:latest --build-arg APP_NAME=bot --build-arg APP_PORT=6686 . | ||
$(DOCKER) build -t analytics-server:latest --build-arg APP_NAME=analytics-server --build-arg APP_PORT=6690 . | ||
|
||
run-docker: kill-dockers | ||
$(DOCKER) run --entrypoint /app/chat-server --env OPENAI_API_KEY=$(OPENAI_API_KEY) --name chat -d -p 6688:6688 --mount type=bind,source=$(PWD)/fixtures/chat.yml,target=/app/chat.yml,readonly localhost/chat-server:latest | ||
$(DOCKER) run --entrypoint /app/notify-server --name notify -d -p 6687:6687 --mount type=bind,source=$(PWD)/fixtures/notify.yml,target=/app/notify.yml,readonly localhost/notify-server:latest | ||
$(DOCKER) run --entrypoint /app/bot --env OPENAI_API_KEY=$(OPENAI_API_KEY) --name bot -d -p 6686:6686 --mount type=bind,source=$(PWD)/fixtures/bot.yml,target=/app/bot.yml,readonly localhost/bot-server:latest | ||
$(DOCKER) run --entrypoint /app/analytics-server --name analytics -d -p 6690:6690 --mount type=bind,source=$(PWD)/fixtures/analytics.yml,target=/app/analytics.yml,readonly localhost/analytics-server:latest | ||
|
||
kill-dockers: | ||
@$(DOCKER) kill $(shell $(DOCKER) ps -aq) || true | ||
@$(DOCKER) container prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ inputs: | |
- directory: ../protos | ||
plugins: | ||
- local: protoc-gen-es | ||
opt: target=ts | ||
opt: target=js | ||
out: src/gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// @generated by protoc-gen-es v2.2.0 with parameter "target=js" | ||
// @generated from file messages.proto (package analytics, syntax proto3) | ||
/* eslint-disable */ | ||
|
||
import { enumDesc, fileDesc, messageDesc, tsEnum } from "@bufbuild/protobuf/codegenv1"; | ||
|
||
/** | ||
* Describes the file messages.proto. | ||
*/ | ||
export const file_messages = /*@__PURE__*/ | ||
fileDesc("Cg5tZXNzYWdlcy5wcm90bxIJYW5hbHl0aWNzIr0ECg5BbmFseXRpY3NFdmVudBIoCgdjb250ZXh0GAEgASgLMhcuYW5hbHl0aWNzLkV2ZW50Q29udGV4dBItCglhcHBfc3RhcnQYCCABKAsyGC5hbmFseXRpY3MuQXBwU3RhcnRFdmVudEgAEisKCGFwcF9leGl0GAkgASgLMhcuYW5hbHl0aWNzLkFwcEV4aXRFdmVudEgAEi8KCnVzZXJfbG9naW4YCiABKAsyGS5hbmFseXRpY3MuVXNlckxvZ2luRXZlbnRIABIxCgt1c2VyX2xvZ291dBgLIAEoCzIaLmFuYWx5dGljcy5Vc2VyTG9nb3V0RXZlbnRIABI1Cg11c2VyX3JlZ2lzdGVyGAwgASgLMhwuYW5hbHl0aWNzLlVzZXJSZWdpc3RlckV2ZW50SAASMwoMY2hhdF9jcmVhdGVkGA0gASgLMhsuYW5hbHl0aWNzLkNoYXRDcmVhdGVkRXZlbnRIABIzCgxtZXNzYWdlX3NlbnQYDiABKAsyGy5hbmFseXRpY3MuTWVzc2FnZVNlbnRFdmVudEgAEjEKC2NoYXRfam9pbmVkGA8gASgLMhouYW5hbHl0aWNzLkNoYXRKb2luZWRFdmVudEgAEi0KCWNoYXRfbGVmdBgQIAEoCzIYLmFuYWx5dGljcy5DaGF0TGVmdEV2ZW50SAASMAoKbmF2aWdhdGlvbhgRIAEoCzIaLmFuYWx5dGljcy5OYXZpZ2F0aW9uRXZlbnRIAEIMCgpldmVudF90eXBlIg8KDUFwcFN0YXJ0RXZlbnQimAEKDEFwcEV4aXRFdmVudBIzCglleGl0X2NvZGUYASABKA4yIC5hbmFseXRpY3MuQXBwRXhpdEV2ZW50LkV4aXRDb2RlIlMKCEV4aXRDb2RlEhkKFUVYSVRfQ09ERV9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.AnalyticsEvent. | ||
* Use `create(AnalyticsEventSchema)` to create a new message. | ||
*/ | ||
export const AnalyticsEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 0); | ||
|
||
/** | ||
* Describes the message analytics.AppStartEvent. | ||
* Use `create(AppStartEventSchema)` to create a new message. | ||
*/ | ||
export const AppStartEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 1); | ||
|
||
/** | ||
* Describes the message analytics.AppExitEvent. | ||
* Use `create(AppExitEventSchema)` to create a new message. | ||
*/ | ||
export const AppExitEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 2); | ||
|
||
/** | ||
* Describes the enum analytics.AppExitEvent.ExitCode. | ||
*/ | ||
export const AppExitEvent_ExitCodeSchema = /*@__PURE__*/ | ||
enumDesc(file_messages, 2, 0); | ||
|
||
/** | ||
* @generated from enum analytics.AppExitEvent.ExitCode | ||
*/ | ||
export const AppExitEvent_ExitCode = /*@__PURE__*/ | ||
tsEnum(AppExitEvent_ExitCodeSchema); | ||
|
||
/** | ||
* Describes the message analytics.UserLoginEvent. | ||
* Use `create(UserLoginEventSchema)` to create a new message. | ||
*/ | ||
export const UserLoginEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 3); | ||
|
||
/** | ||
* Describes the message analytics.UserLogoutEvent. | ||
* Use `create(UserLogoutEventSchema)` to create a new message. | ||
*/ | ||
export const UserLogoutEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 4); | ||
|
||
/** | ||
* Describes the message analytics.UserRegisterEvent. | ||
* Use `create(UserRegisterEventSchema)` to create a new message. | ||
*/ | ||
export const UserRegisterEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 5); | ||
|
||
/** | ||
* Describes the message analytics.ChatCreatedEvent. | ||
* Use `create(ChatCreatedEventSchema)` to create a new message. | ||
*/ | ||
export const ChatCreatedEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 6); | ||
|
||
/** | ||
* Describes the message analytics.MessageSentEvent. | ||
* Use `create(MessageSentEventSchema)` to create a new message. | ||
*/ | ||
export const MessageSentEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 7); | ||
|
||
/** | ||
* Describes the message analytics.ChatJoinedEvent. | ||
* Use `create(ChatJoinedEventSchema)` to create a new message. | ||
*/ | ||
export const ChatJoinedEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 8); | ||
|
||
/** | ||
* Describes the message analytics.ChatLeftEvent. | ||
* Use `create(ChatLeftEventSchema)` to create a new message. | ||
*/ | ||
export const ChatLeftEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 9); | ||
|
||
/** | ||
* Describes the message analytics.NavigationEvent. | ||
* Use `create(NavigationEventSchema)` to create a new message. | ||
*/ | ||
export const NavigationEventSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 10); | ||
|
||
/** | ||
* Describes the message analytics.EventContext. | ||
* Use `create(EventContextSchema)` to create a new message. | ||
*/ | ||
export const EventContextSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 11); | ||
|
||
/** | ||
* Describes the message analytics.SystemInfo. | ||
* Use `create(SystemInfoSchema)` to create a new message. | ||
*/ | ||
export const SystemInfoSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 12); | ||
|
||
/** | ||
* Describes the message analytics.GeoLocation. | ||
* Use `create(GeoLocationSchema)` to create a new message. | ||
*/ | ||
export const GeoLocationSchema = /*@__PURE__*/ | ||
messageDesc(file_messages, 13); |
Oops, something went wrong.