Skip to content

Commit 8f4eea0

Browse files
eliasdarrudaclaude
andcommitted
Update spawn with latest changes
This PR includes: - Updated actor entity and lifecycle management - Enhanced state management and handoff controllers - Improved gRPC dispatcher and code generator - Updated protocol buffers and generated code - Proxy and SDK improvements - State store adapter updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 59e2834 commit 8f4eea0

File tree

190 files changed

+9338
-1157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+9338
-1157
lines changed

Dockerfile-elixir-example

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM elixir:1.15-alpine AS builder
2+
3+
ENV MIX_ENV=prod
4+
5+
WORKDIR /app
6+
7+
RUN apk add --no-cache --update git build-base ca-certificates zstd
8+
9+
RUN mkdir config
10+
COPY config/ ./config
11+
COPY spawn_sdk/ ./spawn_sdk
12+
COPY spawn_statestores/ ./spawn_statestores
13+
COPY lib/ ./lib
14+
COPY priv/ ./priv
15+
COPY mix.exs .
16+
COPY mix.lock .
17+
18+
RUN mix local.rebar --force \
19+
&& mix local.hex --force \
20+
&& mix deps.get \
21+
&& mix release.init
22+
23+
RUN echo "-name spawn_sdk_elixir@${HOSTNAME}" >> ./rel/vm.args.eex \
24+
&& echo "-setcookie ${RELEASE_COOKIE}" >> ./rel/vm.args.eex
25+
26+
RUN cd spawn_sdk/spawn_sdk_example \
27+
&& mix deps.get \
28+
&& mix release spawn_sdk_example
29+
30+
# ---- Application Stage ----
31+
FROM alpine:3.17.3
32+
RUN apk add --no-cache --update zstd ncurses-libs libstdc++ libgcc libcrypto1.1
33+
34+
WORKDIR /app
35+
RUN chown nobody /app
36+
37+
# Set runner ENV
38+
ENV MIX_ENV=prod
39+
ENV HOME=/app
40+
41+
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/bakeware/ ./
42+
43+
RUN mkdir -p /app/.cache/bakeware/ && chmod 777 /app/.cache/bakeware/
44+
RUN touch /.erlang.cookie && chmod 777 /.erlang.cookie
45+
RUN touch /app/.erlang.cookie && chmod 777 /app/.erlang.cookie
46+
47+
USER nobody
48+
49+
ENTRYPOINT ["./spawn_sdk_example", "start"]

Dockerfile-initializer

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM elixir:1.15-alpine AS builder
2+
3+
ENV MIX_ENV=prod
4+
5+
WORKDIR /app
6+
7+
RUN apk add --no-cache --update git build-base ca-certificates zstd gcc pkgconfig openssl-dev
8+
9+
COPY spawn_initializer/ .
10+
11+
RUN mix local.rebar --force \
12+
&& mix local.hex --force \
13+
&& mix deps.get \
14+
&& mix release.init
15+
16+
# This will be the basename of node
17+
ENV RELEASE_NAME="spawn_initializer"
18+
19+
# Disable Erlang Dist
20+
ENV RELEASE_DISTRIBUTION=none
21+
22+
RUN mix deps.get \
23+
&& mix release spawn_initializer
24+
25+
# ---- Application Stage ----
26+
FROM alpine:3.20
27+
28+
RUN apk add --no-cache --update zstd ncurses-libs libstdc++ libgcc
29+
30+
WORKDIR /app
31+
RUN chown nobody /app
32+
33+
# Set runner ENV
34+
ENV MIX_ENV=prod
35+
ENV HOME=/app
36+
37+
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/bakeware/ ./
38+
39+
RUN mkdir -p /app/.cache/bakeware/ && chmod 777 /app/.cache/bakeware/
40+
RUN touch /.erlang.cookie && chmod 777 /.erlang.cookie
41+
RUN touch /app/.erlang.cookie && chmod 777 /app/.erlang.cookie
42+
43+
USER nobody
44+
45+
ENTRYPOINT ["./spawn_initializer"]

Dockerfile-operator

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM elixir:1.15-alpine AS builder
2+
3+
ENV MIX_ENV=prod
4+
5+
WORKDIR /app
6+
7+
RUN apk add --no-cache --update git build-base ca-certificates zstd gcc pkgconfig openssl-dev
8+
9+
RUN mkdir config
10+
COPY config/ ./config
11+
COPY spawn_operator/ ./spawn_operator
12+
COPY spawn_statestores/ ./spawn_statestores
13+
COPY lib/ ./lib
14+
COPY priv/ ./priv
15+
COPY mix.exs .
16+
COPY mix.lock .
17+
18+
RUN mix local.rebar --force \
19+
&& mix local.hex --force \
20+
&& mix deps.get \
21+
&& mix release.init
22+
23+
ENV RELEASE_DISTRIBUTION="name"
24+
25+
# Overriden at runtime
26+
ENV POD_IP="127.0.0.1"
27+
28+
# This will be the basename of node
29+
ENV RELEASE_NAME="spawn_operator"
30+
31+
# This will be the full nodename
32+
ENV RELEASE_NODE="${RELEASE_NAME}@${POD_IP}"
33+
34+
RUN echo "-setcookie ${RELEASE_COOKIE}" >> ./rel/vm.args.eex
35+
36+
RUN cd spawn_operator/spawn_operator \
37+
&& mix deps.get \
38+
&& mix release spawn_operator
39+
40+
# ---- Application Stage ----
41+
FROM alpine:3.20
42+
43+
RUN apk add --no-cache --update zstd ncurses-libs libstdc++ libgcc
44+
45+
WORKDIR /app
46+
RUN chown nobody /app
47+
48+
# Set runner ENV
49+
ENV MIX_ENV=prod
50+
ENV HOME=/app
51+
52+
COPY --from=builder --chown=nobody:root /app/spawn_operator/spawn_operator/_build/${MIX_ENV}/rel/bakeware/ ./
53+
54+
RUN mkdir -p /app/.cache/bakeware/ && chmod 777 /app/.cache/bakeware/
55+
RUN touch /.erlang.cookie && chmod 777 /.erlang.cookie
56+
RUN touch /app/.erlang.cookie && chmod 777 /app/.erlang.cookie
57+
58+
USER nobody
59+
60+
ENTRYPOINT [ "./spawn_operator", "start" ]

Dockerfile-proxy

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM elixir:1.15-alpine AS builder
2+
3+
ENV MIX_ENV=prod
4+
5+
WORKDIR /app
6+
7+
RUN apk add --no-cache --update git build-base ca-certificates zstd gcc pkgconfig openssl-dev
8+
9+
RUN mkdir config
10+
COPY config/ ./config
11+
COPY spawn_proxy/ ./spawn_proxy
12+
COPY lib/ ./lib
13+
COPY spawn_statestores/ ./spawn_statestores
14+
COPY priv/ ./priv
15+
COPY mix.exs .
16+
COPY mix.lock .
17+
18+
RUN mix local.rebar --force \
19+
&& mix local.hex --force \
20+
&& mix deps.get \
21+
&& mix release.init
22+
23+
ENV RELEASE_DISTRIBUTION="name"
24+
25+
# Overriden at runtime
26+
ENV POD_IP="127.0.0.1"
27+
28+
# This will be the basename of node
29+
ENV RELEASE_NAME="proxy"
30+
31+
# This will be the full nodename
32+
ENV RELEASE_NODE="${RELEASE_NAME}@${POD_IP}"
33+
34+
#RUN echo "-setcookie ${RELEASE_COOKIE}" >> ./priv/rel/vm.args.eex
35+
36+
RUN cd spawn_proxy/proxy \
37+
&& mix deps.get \
38+
&& mix release proxy
39+
40+
# ---- Application Stage ----
41+
FROM alpine:3.20
42+
43+
RUN apk add --no-cache --update zstd ncurses-libs libstdc++ libgcc protobuf
44+
45+
WORKDIR /app
46+
RUN chown nobody /app
47+
48+
# Set runner ENV
49+
ENV MIX_ENV=prod
50+
ENV HOME=/app
51+
52+
COPY rel/overlays/mtls.ssl.conf .
53+
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/proxy ./
54+
55+
RUN mkdir -p /app/.cache/bakeware/ && chmod 777 /app/.cache/bakeware/
56+
RUN mkdir -p /app/priv/generated_modules/ && chmod 777 /app/priv/generated_modules/
57+
RUN mkdir /data/ && chmod 777 /data/
58+
RUN touch /.erlang.cookie && chmod 777 /.erlang.cookie
59+
RUN touch /app/.erlang.cookie && chmod 777 /app/.erlang.cookie
60+
61+
USER nobody
62+
63+
ENTRYPOINT ["/app/bin/proxy", "start"]
64+

Makefile

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -293,25 +293,6 @@ run-proxy-with-postgres:
293293
SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= \
294294
iex --name spawn_a3@127.0.0.1 -S mix
295295

296-
run-proxy-with-mariadb:
297-
cd spawn_proxy/proxy && mix deps.get && \
298-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 \
299-
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc \
300-
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION=gzip \
301-
SPAWN_PROXY_LOGGER_LEVEL=info \
302-
PROXY_CLUSTER_STRATEGY=epmd \
303-
SPAWN_USE_INTERNAL_NATS=false \
304-
SPAWN_PUBSUB_ADAPTER=native \
305-
PROXY_DATABASE_PORT=3307 \
306-
PROXY_DATABASE_TYPE=mariadb \
307-
PROXY_DATABASE_USERNAME=admin \
308-
PROXY_DATABASE_SECRET=admin \
309-
PROXY_DATABASE_POOL_SIZE=30 \
310-
PROXY_HTTP_PORT=9001 \
311-
USER_FUNCTION_PORT=8090 \
312-
SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= \
313-
iex --name spawn_a3@127.0.0.1 -S mix
314-
315296
run-proxy-local-nodejs-test:
316297
ERL_ZFLAGS='-proto_dist inet_tls -ssl_dist_optfile rel/overlays/local-mtls.ssl.conf' \
317298
cd spawn_proxy/proxy && mix deps.get && \

0 commit comments

Comments
 (0)