diff --git a/.dockerignore b/.dockerignore index f382061788..67ced5adcb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,12 +1,27 @@ -* +# MARK: Docker-specific +.git/ -!Cargo.lock -!Cargo.toml -!sdks/api/full/rust/Cargo.toml -!sdks/api/full/rust/src -!packages -!resources/legacy/proto +# MARK: Copied from .gitignore === +**/.DS_Store -!docker/monolith -docker/monolith/*.md +# Rust +**/target + +# JavaScript +**/.cache/ +**/.turbo +**/.yarn +**/dist/ +**/node_modules/ +**/target +.turbo + +# Site +site/public/rss/ +!site/public/rss/.gitkeep + +site/src/generated/ +!site/src/generated/errorPages.json +!site/src/generated/apiPages.json +!site/src/generated/meta.json diff --git a/.gitignore b/.gitignore index 662f9128d1..7c32e97bf2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,66 +1,27 @@ +# Keep all .gitignore files in this file so we can easily keep it in sync with .dockerignore +# # Make sure to update .dockerignore appropriately **/.DS_Store -**/symbolCache.db - -# Terraform -**/*.tfstate -**/*.tfstate.* -**/.terraform.* -**/.terraform/ -infra/tf/*/_bolt.tf - -# Vagrant -.vagrant-remote -.vagrant-digitalocean-token -**/.vagrant/ - -# Bolt -.bolt-cache.json -.volumes/ -Bolt.local.toml - -/namespaces/* -!/namespaces/.gitkeep -!/namespaces/README.md - -/secrets/* -!/secrets/.gitkeep -!/secrets/README.md - -# Generated code -gen/build_script.sh -gen/test_build_script.sh -gen/svc/ -gen/tf/ -gen/docker/ -gen/tests/ -gen/k8s/ - -# K3s -volumes/ # Rust -lib/**/Cargo.lock -!lib/bolt/Cargo.lock -!lib/job-runner/Cargo.lock -# Allows symlinking target instead of being a directory **/target -**/target/ -**/*.rustfmt # JavaScript **/.cache/ +**/.turbo +**/.yarn **/dist/ **/node_modules/ +**/target .turbo -tests/basic-game/.env +# Site +site/public/rss/ +!site/public/rss/.gitkeep +site/src/generated/ +!site/src/generated/errorPages.json +!site/src/generated/apiPages.json +!site/src/generated/meta.json -# Added by cargo - -/target -.yarn/cache -.yarn/install-state.gz -.turbo diff --git a/Cargo.lock b/Cargo.lock index 5c6a5885dc..4065a5064f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,9 +246,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" dependencies = [ "backtrace", ] @@ -1185,7 +1185,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror 1.0.69", - "time 0.3.36", + "time 0.3.37", ] [[package]] @@ -1279,7 +1279,7 @@ dependencies = [ "serde_nanos", "serde_repr", "thiserror 1.0.69", - "time 0.3.36", + "time 0.3.37", "tokio", "tokio-retry", "tokio-rustls 0.24.1", @@ -1476,7 +1476,7 @@ dependencies = [ "ring 0.17.8", "sha2 0.10.8", "subtle", - "time 0.3.36", + "time 0.3.37", "tracing", "zeroize", ] @@ -1689,7 +1689,7 @@ dependencies = [ "itoa 1.0.14", "num-integer", "ryu", - "time 0.3.36", + "time 0.3.37", ] [[package]] @@ -1713,7 +1713,7 @@ dependencies = [ "pin-utils", "ryu", "serde", - "time 0.3.36", + "time 0.3.37", "tokio", "tokio-util 0.7.12", ] @@ -2431,16 +2431,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc309ed89476c8957c50fb818f56fe894db857866c3e163335faa91dc34eb85" +checksum = "8769706aad5d996120af43197bf46ef6ad0fda35216b4505f926a365a232d924" dependencies = [ "camino", "cargo-platform", "semver 1.0.23", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.3", ] [[package]] @@ -6755,19 +6755,6 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -[[package]] -name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" -dependencies = [ - "bitflags 2.6.0", - "libc", - "libgit2-sys", - "log", - "url", -] - [[package]] name = "gl_generator" version = "0.14.0" @@ -8208,18 +8195,6 @@ dependencies = [ "cc", ] -[[package]] -name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - [[package]] name = "libloading" version = "0.7.4" @@ -11667,7 +11642,7 @@ dependencies = [ "tokio", "url", "uuid", - "vergen-git2", + "vergen", "webbrowser", ] @@ -11771,7 +11746,7 @@ dependencies = [ "anyhow", "lazy_static", "uuid", - "vergen-git2", + "vergen", ] [[package]] @@ -12284,7 +12259,7 @@ dependencies = [ "typed-path", "url", "uuid", - "vergen-git2", + "vergen", "which 5.0.0", "windows 0.48.0", "zip 0.5.13", @@ -12631,9 +12606,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rustyline" @@ -13006,7 +12981,7 @@ dependencies = [ "serde", "serde_json", "thiserror 1.0.69", - "time 0.3.36", + "time 0.3.37", "url", "uuid", ] @@ -13160,7 +13135,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.36", + "time 0.3.37", ] [[package]] @@ -13380,7 +13355,7 @@ dependencies = [ "num-bigint", "num-traits", "thiserror 1.0.69", - "time 0.3.36", + "time 0.3.37", ] [[package]] @@ -14843,9 +14818,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa 1.0.14", @@ -14866,9 +14841,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -15404,7 +15379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b1f47d22deb79c3f59fcf2a1f00f60cbdc05462bf17d1cd356c1fefa3f444bd" dependencies = [ "nu-ansi-term 0.50.1", - "time 0.3.36", + "time 0.3.37", "tracing", "tracing-core", "tracing-subscriber", @@ -16194,9 +16169,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "9.0.2" +version = "9.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f25fc8f8f05df455c7941e87f093ad22522a9ff33d7a027774815acf6f0639" +checksum = "e0d2f179f8075b805a43a2a21728a46f0cc2921b3c58695b28fa8817e103cd9a" dependencies = [ "anyhow", "cargo_metadata", @@ -16204,22 +16179,7 @@ dependencies = [ "regex", "rustc_version 0.4.1", "rustversion", - "time 0.3.36", - "vergen-lib", -] - -[[package]] -name = "vergen-git2" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e63e069d8749fead1e3bab7a9d79e8fb90516b2ec66fc2243a798ecdc1a31d7" -dependencies = [ - "anyhow", - "derive_builder 0.20.2", - "git2", - "rustversion", - "time 0.3.36", - "vergen", + "time 0.3.37", "vergen-lib", ] @@ -17100,7 +17060,7 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror 1.0.69", - "time 0.3.36", + "time 0.3.37", ] [[package]] @@ -17288,7 +17248,7 @@ dependencies = [ "rand", "sha1", "thiserror 2.0.3", - "time 0.3.36", + "time 0.3.37", "zeroize", "zopfli", "zstd", diff --git a/docker/dev-full/README.md b/docker/dev-full/README.md index 4369d71f47..e6979a0955 100644 --- a/docker/dev-full/README.md +++ b/docker/dev-full/README.md @@ -50,3 +50,26 @@ docker compose -f docker/dev-full/docker-compose.yml logs rivet-server | grep -B Logs for `rivet-server` and `rivet-client` can also be configured via the environment. See [here](/docs/self-hosting/client-config) for more information. +## Troubleshooting + +### `Illegal instruction` during `apt-get install` on macOS + +If you see this output: + +``` +Updating certificates in /etc/ssl/certs... +Illegal instruction +Illegal instruction +dpkg: error processing package ca-certificates (--configure): + installed ca-certificates package post-installation script subprocess returned error exit status 132 +Setting up libgssapi-krb5-2:amd64 (1.20.1-2+deb12u2) ... +Setting up libcurl4:amd64 (7.88.1-10+deb12u8) ... +Setting up curl (7.88.1-10+deb12u8) ... +Processing triggers for libc-bin (2.36-9+deb12u9) ... +Errors were encountered while processing: + ca-certificates +E: Sub-process /usr/bin/dpkg returned an error code (1) +``` + +Try changing your Docker VM to _Docker VMM_. See [here](https://github.com/docker/for-mac/issues/7255#issuecomment-2567154899) for more information. + diff --git a/docker/dev-full/docker-compose.yml b/docker/dev-full/docker-compose.yml index ec9d9e13ca..bcc4dacdfe 100644 --- a/docker/dev-full/docker-compose.yml +++ b/docker/dev-full/docker-compose.yml @@ -49,6 +49,7 @@ services: build: context: ../.. dockerfile: docker/universal/Dockerfile + target: server-full restart: unless-stopped command: sleep infinity environment: diff --git a/docker/monolith/build-scripts/install.sh b/docker/monolith/build-scripts/install.sh index f55d72210a..ec0b0a6763 100755 --- a/docker/monolith/build-scripts/install.sh +++ b/docker/monolith/build-scripts/install.sh @@ -3,10 +3,15 @@ set -euf -o pipefail TARGET_ARCH=$(uname -m | sed 's/aarch64/arm64/' | sed 's/x86_64/amd64/') +apt-get update + +# Fixes "Failed to fetch" error +apt-get install --reinstall -y apt-transport-https + # Install required packages # # The FDB version should match `cluster::workflows::server::install::install_scripts::components::fdb::FDB_VERSION` -apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + apt-get install -y \ libclang-dev \ ca-certificates \ openssl \ @@ -18,12 +23,15 @@ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ apt-transport-https \ dirmngr \ netcat-openbsd \ - procps && \ - (curl -L https://github.com/golang-migrate/migrate/releases/download/v4.18.1/migrate.linux-${TARGET_ARCH}.tar.gz | tar xvz) && \ - mv migrate /usr/local/bin/migrate && \ - curl -fsSL https://deno.land/x/install/install.sh | sh && \ - ln -s /root/.deno/bin/deno /usr/local/bin/deno && \ - curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so" + procps + +(curl -L https://github.com/golang-migrate/migrate/releases/download/v4.18.1/migrate.linux-${TARGET_ARCH}.tar.gz | tar xvz) +mv migrate /usr/local/bin/migrate + +curl -fsSL https://deno.land/x/install/install.sh | sh +ln -s /root/.deno/bin/deno /usr/local/bin/deno + +curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so" # === Traefik === curl -sSLf https://github.com/traefik/traefik/releases/download/v${TRAEFIK_VERSION}/traefik_v${TRAEFIK_VERSION}_linux_${TARGET_ARCH}.tar.gz | \ @@ -45,7 +53,7 @@ useradd -m -s /bin/bash clickhouse && \ curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg && \ echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | tee /etc/apt/sources.list.d/clickhouse.list && \ apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y clickhouse-client clickhouse-server + apt-get install -y clickhouse-client clickhouse-server # === NATS === useradd -m -s /bin/bash nats && \ diff --git a/docker/universal/Dockerfile b/docker/universal/Dockerfile index 848219e2f9..23fad9f370 100644 --- a/docker/universal/Dockerfile +++ b/docker/universal/Dockerfile @@ -4,8 +4,9 @@ # TODO(RVT-4168): Compile libfdb from scratch for ARM FROM --platform=linux/amd64 rust:1.82.0-bookworm AS builder -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y && \ + apt-get install -y \ curl \ g++ \ git \ @@ -25,8 +26,17 @@ RUN apt-get update && \ pkg-config \ protobuf-compiler \ wget && \ + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ + apt-get install -y nodejs && \ + corepack enable && \ curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so" +# Disable interactive prompt +ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 + +# TODO: REMOVE +ENV FONTAWESOME_PACKAGE_TOKEN=E7A94808-3467-4150-B90D-EABDAEB9E0B4 + WORKDIR /app COPY . . @@ -38,28 +48,35 @@ RUN \ --mount=type=cache,target=/usr/local/cargo/git,id=univseral-cargo-git \ --mount=type=cache,target=/usr/local/cargo/registry,id=univseral-cargo-registry \ --mount=type=cache,target=/app/target,id=univseral-target \ - RUSTFLAGS="--cfg tokio_unstable" cargo build -vv --bin rivet-server --bin rivet-client --bin rivet-isolate-v8-runner --bin rivet-container-runner && \ + --mount=type=cache,target=/app/node_modules,id=universal-node-modules \ + --mount=type=cache,target=/app/.turbo,id=universal-turbo \ + --mount=type=cache,target=/root/.cache,id=universal-user-cache \ + --mount=type=cache,target=/root/.npm,id=universal-user-npm \ + --mount=type=cache,target=/root/.yarn,id=universal-user-yarn \ + RUSTFLAGS="--cfg tokio_unstable" cargo build --bin rivet-server --bin rivet-client --bin rivet-isolate-v8-runner --bin rivet-container-runner && \ mkdir /app/dist/ && \ - mv target/debug/rivet-server target/debug/rivet-client target/debug/rivet-isolate-v8-runner target/debug/rivet-container-runner /app/dist/ + cp target/debug/rivet-server target/debug/rivet-client target/debug/rivet-isolate-v8-runner target/debug/rivet-container-runner /app/dist/ # MARK: Server (Full) -FROM debian:12.1-slim AS server-full +FROM debian:12.9-slim AS server-full +ENV DEBIAN_FRONTEND=noninteractive # - Install curl for health checks # - Install go-migrate for running migrations # - Install database clients to be able to run `rivet db shell ...` (Redis, Postgres, ClickHouse) -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ +RUN apt-get update -y && \ + apt-get install -y \ ca-certificates \ openssl \ curl \ redis-tools \ postgresql-client \ - gpg && \ + gpg \ + dirmngr && \ curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg && \ echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | tee /etc/apt/sources.list.d/clickhouse.list && \ - apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y clickhouse-client && \ + apt-get update -y && \ + apt-get install -y clickhouse-client && \ (curl -L https://github.com/golang-migrate/migrate/releases/download/v4.18.1/migrate.linux-amd64.tar.gz | tar xvz) && \ mv migrate /usr/local/bin/migrate && \ apt-get clean && \ @@ -70,10 +87,11 @@ COPY --from=builder /app/dist/rivet-server /usr/bin/rivet-server CMD ["/usr/bin/rivet-server"] # MARK: Server (Slim) -FROM debian:12.1-slim AS server-slim +FROM debian:12.9-slim AS server-slim -RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && \ - apt-get install -y --no-install-recommends ca-certificates openssl && \ +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y && \ + apt-get install -y ca-certificates openssl && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -82,9 +100,10 @@ COPY --from=builder /app/dist/rivet-server /usr/bin/rivet-server CMD ["/usr/bin/rivet-server"] # MARK: Runner base -FROM --platform=linux/amd64 debian:12.1-slim AS base-runner -RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && \ - apt-get install -y --no-install-recommends ca-certificates openssl curl && \ +FROM --platform=linux/amd64 debian:12.9-slim AS base-runner +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y && \ + apt-get install -y ca-certificates openssl curl && \ curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so" # MARK: Runner (Full) @@ -103,7 +122,8 @@ COPY --from=builder /app/dist/rivet-container-runner /usr/local/bin/ ENTRYPOINT ["rivet-client"] # MARK: Monlith -FROM --platform=linux/amd64 debian:12.1-slim AS monolith +FROM --platform=linux/amd64 debian:12.9-slim AS monolith +ENV DEBIAN_FRONTEND=noninteractive ARG TRAEFIK_VERSION=3.2.1 ARG COCKROACHDB_VERSION=24.2.3 diff --git a/docs-internal/development/TROUBLESHOOTING.md b/docs-internal/development/TROUBLESHOOTING.md index bdf0e49cd0..1f71719822 100644 --- a/docs-internal/development/TROUBLESHOOTING.md +++ b/docs-internal/development/TROUBLESHOOTING.md @@ -27,5 +27,5 @@ The following indicates that the process was force killed (`signal 9`), which us 55.35 error: could not compile `rivet-server` (bin "rivet-server") due to 1 previous error ``` -If you're using `docker-compose up --build`, try building one service at a time. Building multiple Rust binaries at the same time will eat a lot of memory. +If you're using `docker compose up --build`, try building one service at a time. Building multiple Rust binaries at the same time will eat a lot of memory. diff --git a/docs-internal/infrastructure/fdb/AVX.md b/docs-internal/infrastructure/fdb/AVX.md index 2572591a9b..5186e8254f 100644 --- a/docs-internal/infrastructure/fdb/AVX.md +++ b/docs-internal/infrastructure/fdb/AVX.md @@ -9,7 +9,7 @@ Even versions of FoundationDB are compiled without AVX. Odd versions are compile For example, [7.1.61](https://github.com/apple/foundationdb/releases/tag/7.1.61) is the AVX version of [7.1.60](https://github.com/apple/foundationdb/releases/tag/7.1.60). -Make sure to pay attention to if you're using a versino of FDB with AVX. +Make sure to pay attention to if you're using a version of FDB with AVX. ## When to use AVX @@ -17,7 +17,7 @@ Use AVX on production Linux servers. ## When not to use AVX -Don't use AVX for Docker images, since QEMU can't emulate AVX and will crash ([source](https://github.com/apple/foundationdb/issues/4111#issuecomment-1284040423)). Tihs will prevent ARM users from being able to run FoundationDB. +Don't use AVX for Docker images, since QEMU can't emulate AVX and will crash ([source](https://github.com/apple/foundationdb/issues/4111#issuecomment-1284040423)). This will prevent ARM users from being able to run FoundationDB. This might be easy to fix if we build a Docker image built on the prebuilt AMD & ARM binaries on GitHub. diff --git a/frontend/apps/hub/README.md b/frontend/apps/hub/README.md new file mode 100644 index 0000000000..92fc3dd743 --- /dev/null +++ b/frontend/apps/hub/README.md @@ -0,0 +1,22 @@ +# Rivet Hub + +[hub.rivet.gg](https://hub.rivet.gg) + +## Developing + +```bash +cd frontend/apps/hub +yarn install +yarn dev +``` + +Open [http://localhost:5080](http://localhost:5080) in your browser to view the website. + +## Configuring + +Create a file called `.env.local` to override properties. + +## License + +This site template is a commercial product and is licensed under the [Tailwind UI license](https://tailwindui.com/license). + diff --git a/frontend/apps/hub/src/components/dialogs/secret-dialog.tsx b/frontend/apps/hub/src/components/dialogs/secret-dialog.tsx index 2b39dc558a..c365afc836 100644 --- a/frontend/apps/hub/src/components/dialogs/secret-dialog.tsx +++ b/frontend/apps/hub/src/components/dialogs/secret-dialog.tsx @@ -26,10 +26,7 @@ export default function SecretDialogContent(props: ContentProps) { Rivet 2.0
- {__APP_GIT_BRANCH__}@ - {__APP_GIT_COMMIT__} -
- {__APP_RIVET_NAMESPACE__ || "unknown"} + {__APP_BUILD_ID__}
{ export const changelogQueryOptions = () => { return queryOptions({ - queryKey: ["changelog", __APP_GIT_COMMIT__], + queryKey: ["changelog", __APP_BUILD_ID__], staleTime: timing.hours(1), queryFn: async () => { const response = await fetch("https://rivet.gg/changelog.json"); diff --git a/frontend/apps/hub/src/main.tsx b/frontend/apps/hub/src/main.tsx index 3c5df27eb3..c90c44d4e9 100644 --- a/frontend/apps/hub/src/main.tsx +++ b/frontend/apps/hub/src/main.tsx @@ -10,7 +10,7 @@ initThirdPartyProviders(); rivetClient.cloud .bootstrap() .then((response) => { - run({ cacheKey: [response.deployHash, __APP_GIT_COMMIT__].join("-") }); + run({ cacheKey: [response.deployHash, __APP_BUILD_ID__].join("-") }); }) .catch(() => { run(); diff --git a/frontend/apps/hub/src/vite-env.d.ts b/frontend/apps/hub/src/vite-env.d.ts index 2149392f56..3155e77625 100644 --- a/frontend/apps/hub/src/vite-env.d.ts +++ b/frontend/apps/hub/src/vite-env.d.ts @@ -1,8 +1,6 @@ /// -declare const __APP_GIT_BRANCH__: string; -declare const __APP_GIT_COMMIT__: string; -declare const __APP_RIVET_NAMESPACE__: string; +declare const __APP_BUILD_ID__: string; declare module "vite-plugin-favicons-inject" { import type { Plugin } from "vite"; diff --git a/frontend/apps/hub/vite.config.ts b/frontend/apps/hub/vite.config.ts index 2cc197f253..b8baaf7697 100644 --- a/frontend/apps/hub/vite.config.ts +++ b/frontend/apps/hub/vite.config.ts @@ -1,4 +1,4 @@ -import { execSync } from "node:child_process"; +import * as crypto from "node:crypto"; import path from "node:path"; import { sentryVitePlugin } from "@sentry/vite-plugin"; import { transformerNotationFocus } from "@shikijs/transformers"; @@ -8,13 +8,9 @@ import * as shiki from "shiki"; import { type Plugin, defineConfig } from "vite"; import vitePluginFaviconsInject from "vite-plugin-favicons-inject"; -const GIT_BRANCH = - process.env.CF_PAGES_BRANCH || - execSync("git rev-parse --abbrev-ref HEAD").toString().trim(); - -const GIT_SHA = - process.env.CF_PAGES_COMMIT_SHA || - execSync("git rev-parse HEAD").toString().trim(); +// These are only needed in CI. They'll be undefined in dev. +const GIT_BRANCH = process.env.CF_PAGES_BRANCH; +const GIT_SHA = process.env.CF_PAGES_COMMIT_SHA; // https://vitejs.dev/config/ export default defineConfig({ @@ -44,9 +40,10 @@ export default defineConfig({ port: 5080, }, define: { - __APP_GIT_BRANCH__: JSON.stringify(GIT_BRANCH), - __APP_GIT_COMMIT__: JSON.stringify(GIT_SHA), - __APP_RIVET_NAMESPACE__: JSON.stringify(process.env.CF_PAGES_BRANCH), + // Provide a unique build ID for cache busting + __APP_BUILD_ID__: JSON.stringify( + `${new Date().toISOString()}@${crypto.randomUUID()}`, + ), }, resolve: { alias: { diff --git a/justfile b/justfile index 3f04abc947..351aa6d1f4 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,5 @@ -docker_compose := "docker compose -f docker/dev-full/docker-compose.yml" +# `--parallel 1` because apt has issues when pulling too many containers in parallel +docker_compose := "docker compose -f docker/dev-full/docker-compose.yml --progress=plain --parallel 1" [group('rust')] watch: @@ -11,7 +12,7 @@ cli *ARGS: [group('dev')] dev-compose *ARGS: - {{docker_compose}} up -d --build {{ARGS}} + {{docker_compose}} {{ARGS}} [group('dev')] dev-up-all: diff --git a/packages/api/ui/src/route.rs b/packages/api/ui/src/route.rs index 7cc6a214f5..fb716e1ed8 100644 --- a/packages/api/ui/src/route.rs +++ b/packages/api/ui/src/route.rs @@ -10,16 +10,16 @@ impl Router { ) -> GlobalResult> { let content_str = std::str::from_utf8(content)?; - let replacement_count = content_str.matches("__VITE_APP_API_URL__").count(); + let replacement_count = content_str.matches("__APP_API_URL__").count(); ensure!( replacement_count > 0, - "Expected at least one occurrence of __VITE_APP_API_URL__, found {}", + "Expected at least one occurrence of __APP_API_URL__, found {}", replacement_count ); let public_origin = util::url::to_string_without_slash(&config.server()?.rivet.api_public.public_origin()); - let replaced_content = content_str.replace("__VITE_APP_API_URL__", &public_origin); + let replaced_content = content_str.replace("__APP_API_URL__", &public_origin); Ok(replaced_content.into_bytes()) } diff --git a/packages/common/env/Cargo.toml b/packages/common/env/Cargo.toml index 4faa3a671b..562735dbf3 100644 --- a/packages/common/env/Cargo.toml +++ b/packages/common/env/Cargo.toml @@ -8,8 +8,7 @@ edition.workspace = true [dependencies] lazy_static = "1.5.0" uuid = { version = "1.11.0", features = ["v4"] } -vergen-git2 = "1.0.1" [build-dependencies] anyhow = "1.0.90" -vergen-git2 = "1.0.1" +vergen = "9.0.4" diff --git a/packages/common/env/build.rs b/packages/common/env/build.rs index c6f52aecc7..4d9921b924 100644 --- a/packages/common/env/build.rs +++ b/packages/common/env/build.rs @@ -1,10 +1,8 @@ use anyhow::Result; -use vergen_git2::{Emitter, Git2Builder}; +use vergen::Emitter; fn main() -> Result<()> { - Emitter::default() - .add_instructions(&Git2Builder::default().sha(true).build()?)? - .emit()?; + Emitter::default().emit()?; Ok(()) } diff --git a/packages/common/env/src/lib.rs b/packages/common/env/src/lib.rs index ba2a8c6e6c..a6ef192574 100644 --- a/packages/common/env/src/lib.rs +++ b/packages/common/env/src/lib.rs @@ -8,7 +8,7 @@ lazy_static! { static ref SERVICE_INSTANCE: String = env::var("RIVET_SERVICE_INSTANCE").unwrap_or_else(|_| Uuid::new_v4().to_string()); static ref SOURCE_HASH: String = - env::var("RIVET_SOURCE_HASH").unwrap_or_else(|_| env!("VERGEN_GIT_SHA").to_string()); + env::var("RIVET_SOURCE_HASH").unwrap_or_else(|_| "unknown".to_string()); } /// Generic name used to differentiate pools of servers. diff --git a/packages/common/hub-embed/build.rs b/packages/common/hub-embed/build.rs index c780197c75..a88da627af 100644 --- a/packages/common/hub-embed/build.rs +++ b/packages/common/hub-embed/build.rs @@ -1,6 +1,13 @@ -use std::{env, fs, path::Path, process::Command, path::PathBuf}; +use std::{env, fs, path::Path, path::PathBuf, process::Command}; fn main() -> Result<(), Box> { + // Check if yarn is installed + let yarn_check = Command::new("yarn").arg("--version").status(); + assert!( + yarn_check.is_ok() && yarn_check.unwrap().success(), + "yarn is not installed, please install yarn to build this project" + ); + // Get the output directory from the cargo environment variable let target_dir = env::var("OUT_DIR")?; let manifest_dir = env::var("CARGO_MANIFEST_DIR")?; @@ -11,29 +18,34 @@ fn main() -> Result<(), Box> { // Build hub println!("Running yarn install"); - let status = Command::new("yarn") + let output = Command::new("yarn") .arg("install") .arg("--immutable") .current_dir(&hub_path) - .status()?; - assert!(status.success(), "yarn install failed"); + .output()?; + println!("stdout:\n{}", String::from_utf8_lossy(&output.stdout)); + println!("stderr:\n{}", String::from_utf8_lossy(&output.stderr)); + assert!(output.status.success(), "yarn install failed",); println!("Running yarn build"); - let status = Command::new("yarn") + let output = Command::new("yarn") .current_dir(&hub_path) .args(["dlx", "turbo", "run", "build:embedded"]) - // This will be substituted at runtime - .env("VITE_APP_API_URL", "__APP_API_URL__") - .status()?; - assert!(status.success(), "hub build failed"); + .env("VITE_APP_API_URL", "__APP_API_URL__") + .output()?; + println!("stdout:\n{}", String::from_utf8_lossy(&output.stdout)); + println!("stderr:\n{}", String::from_utf8_lossy(&output.stderr)); + assert!(output.status.success(), "hub build failed",); // Copy dist directory to out_dir let dist_path = hub_path.join("dist"); - fs::create_dir_all(out_dir)?; + if out_dir.exists() { + fs::remove_dir_all(out_dir)?; + } fs_extra::dir::copy( - dist_path, + dist_path.clone(), out_dir, - &fs_extra::dir::CopyOptions::new().overwrite(true), + &fs_extra::dir::CopyOptions::new().content_only(true), )?; // Set the path in the env diff --git a/packages/toolchain/actors-sdk-embed/build.rs b/packages/toolchain/actors-sdk-embed/build.rs index f014da6b23..482c9b5ec0 100644 --- a/packages/toolchain/actors-sdk-embed/build.rs +++ b/packages/toolchain/actors-sdk-embed/build.rs @@ -37,22 +37,26 @@ async fn main() -> Result<()> { } // Build manager dependencies (required for building the manager itself) - let status = tokio::process::Command::new("yarn") + let output = tokio::process::Command::new("yarn") .arg("install") .arg("--immutable") .current_dir(&manager_path) - .status() + .output() .await?; - ensure!(status.success(), "yarn install failed"); + println!("stdout:\n{}", String::from_utf8_lossy(&output.stdout)); + println!("stderr:\n{}", String::from_utf8_lossy(&output.stderr)); + ensure!(output.status.success(), "yarn install failed"); - let status = tokio::process::Command::new("yarn") + let output = tokio::process::Command::new("yarn") .arg("run") .arg("build") .arg("--filter=@rivet-gg/actor-manager") .current_dir(&project_root) - .status() + .output() .await?; - ensure!(status.success(), "yarn build failed"); + println!("stdout:\n{}", String::from_utf8_lossy(&output.stdout)); + println!("stderr:\n{}", String::from_utf8_lossy(&output.stderr)); + ensure!(output.status.success(), "yarn build failed"); // Build manager using Rivet build script (not using tsup/turbo because this includes custom // polyfill functionality) diff --git a/packages/toolchain/cli/Cargo.toml b/packages/toolchain/cli/Cargo.toml index 152693f3fb..c7fb2a6564 100644 --- a/packages/toolchain/cli/Cargo.toml +++ b/packages/toolchain/cli/Cargo.toml @@ -38,8 +38,8 @@ nix = { version = "0.27", default-features = false, features = ["user", "signal" [build-dependencies] anyhow = "1.0" -[build-dependencies.vergen-git2] -version = "1.0.0" +[build-dependencies.vergen] +version = "9.0.4" features = [ "build", "cargo", diff --git a/packages/toolchain/cli/build.rs b/packages/toolchain/cli/build.rs index c03a04c7c2..d1680c352e 100644 --- a/packages/toolchain/cli/build.rs +++ b/packages/toolchain/cli/build.rs @@ -1,11 +1,10 @@ use anyhow::Result; -use vergen_git2::{BuildBuilder, CargoBuilder, Emitter, Git2Builder, RustcBuilder}; +use vergen::{BuildBuilder, CargoBuilder, Emitter, RustcBuilder}; fn main() -> Result<()> { Emitter::default() .add_instructions(&BuildBuilder::all_build()?)? .add_instructions(&CargoBuilder::all_cargo()?)? - .add_instructions(&Git2Builder::default().sha(true).branch(true).build()?)? .add_instructions(&RustcBuilder::all_rustc()?)? .emit()?; diff --git a/packages/toolchain/cli/src/main.rs b/packages/toolchain/cli/src/main.rs index 1ea67b7d66..b2a86a699c 100644 --- a/packages/toolchain/cli/src/main.rs +++ b/packages/toolchain/cli/src/main.rs @@ -15,11 +15,10 @@ const STYLES: styling::Styles = styling::Styles::styled() #[clap( author = "Rivet Gaming, Inc. ", about = "https://rivet.gg/", - version = concat!(env!("CARGO_PKG_VERSION"), " (", env!("VERGEN_GIT_SHA"), ")"), + version = env!("CARGO_PKG_VERSION"), long_version = concat!( "\n\n", "version: ", env!("CARGO_PKG_VERSION"), "\n", - "git sha: ", env!("VERGEN_GIT_SHA"), "\n", "build timestamp: ", env!("VERGEN_BUILD_TIMESTAMP"), "\n", "build target: ", env!("VERGEN_CARGO_TARGET_TRIPLE"), "\n", "build debug: ", env!("VERGEN_CARGO_DEBUG"), "\n", diff --git a/packages/toolchain/cli/src/util/telemetry.rs b/packages/toolchain/cli/src/util/telemetry.rs index 6dc0883b3e..b790ccb291 100644 --- a/packages/toolchain/cli/src/util/telemetry.rs +++ b/packages/toolchain/cli/src/util/telemetry.rs @@ -89,8 +89,6 @@ where // Helps us understand what version of the CLI is being used. let version = json!({ - "git_sha": env!("VERGEN_GIT_SHA"), - "git_branch": env!("VERGEN_GIT_BRANCH"), "build_semver": env!("CARGO_PKG_VERSION"), "build_timestamp": env!("VERGEN_BUILD_TIMESTAMP"), "build_target": env!("VERGEN_CARGO_TARGET_TRIPLE"), diff --git a/packages/toolchain/toolchain/Cargo.toml b/packages/toolchain/toolchain/Cargo.toml index 40e98bf975..09cb6f864c 100644 --- a/packages/toolchain/toolchain/Cargo.toml +++ b/packages/toolchain/toolchain/Cargo.toml @@ -52,5 +52,5 @@ assert_cmd = "2.0" [build-dependencies] anyhow = "1.0" -vergen-git2 = "1.0.0" +vergen = "9.0.4" diff --git a/packages/toolchain/toolchain/build.rs b/packages/toolchain/toolchain/build.rs index c6f52aecc7..668110f521 100644 --- a/packages/toolchain/toolchain/build.rs +++ b/packages/toolchain/toolchain/build.rs @@ -1,10 +1,8 @@ use anyhow::Result; -use vergen_git2::{Emitter, Git2Builder}; +use vergen_git2::Emitter; fn main() -> Result<()> { - Emitter::default() - .add_instructions(&Git2Builder::default().sha(true).build()?)? - .emit()?; + Emitter::default().emit()?; Ok(()) } diff --git a/packages/toolchain/toolchain/src/toolchain_ctx.rs b/packages/toolchain/toolchain/src/toolchain_ctx.rs index 1ef5fcd7ab..4622df32af 100644 --- a/packages/toolchain/toolchain/src/toolchain_ctx.rs +++ b/packages/toolchain/toolchain/src/toolchain_ctx.rs @@ -10,8 +10,7 @@ pub const VERSION: &str = { const MAJOR: u32 = pkg_version_major!(); const MINOR: u32 = pkg_version_minor!(); const PATCH: u32 = pkg_version_patch!(); - const GIT_SHA: &str = env!("VERGEN_GIT_SHA"); - const_format::formatcp!("{MAJOR}.{MINOR}.{PATCH} ({GIT_SHA})") + const_format::formatcp!("{MAJOR}.{MINOR}.{PATCH}") }; pub fn user_agent() -> String { diff --git a/site/public/rss/.gitignore b/site/public/rss/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/site/public/rss/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/site/src/content/docs/self-hosting/docker-compose.mdx b/site/src/content/docs/self-hosting/docker-compose.mdx index 62f36c0e49..769009a031 100644 --- a/site/src/content/docs/self-hosting/docker-compose.mdx +++ b/site/src/content/docs/self-hosting/docker-compose.mdx @@ -29,7 +29,7 @@ The following ports need to be open before running Rivet: Start the cluster with: ```bash -docker compose -f docker/dev-full/docker-compose.yml up -d --build +docker compose -f docker/dev-full/docker-compose.yml up -d --build --parallel 1 ``` This will start the cluster in detached mode. Once complete, visit the dashboard at diff --git a/site/src/generated/.gitignore b/site/src/generated/.gitignore deleted file mode 100644 index 6a2cf2371d..0000000000 --- a/site/src/generated/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!.gitignore -!errorPages.json -!apiPages.json -!meta.json