Skip to content

Commit

Permalink
Merge pull request #113 from ritual-net/docker-compose-sveltekit-env
Browse files Browse the repository at this point in the history
Docker Compose setup: include default environment variables in `.env.docker`
  • Loading branch information
arshan-ritual authored Oct 30, 2024
2 parents b7dec2f + 8c966df commit e619f74
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .env.docker.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ EDGEDB_SERVER_PASSWORD=secret
# A SendGrid API Key used to authenticate the SendGrid email relay service (https://www.twilio.com/docs/sendgrid/api-reference).
# To use a different email relay service, modify the environment variables in docker-compose.yml found at services › smtp › environment.
SENDGRID_KEY=SG.xx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# ---

# Variables shared by EdgeDB and SvelteKit – do not edit
EDGEDB_HOST=edgedb
EDGEDB_PORT=5656
EDGEDB_BRANCH=main
EDGEDB_SERVER_PROTOCOL=http
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ To access the Infernet Cloud UI from a different machine, you will need to set u
Find more commands and their definitions in the `scripts` section of [`package.json`](package.json).
## Docker Compose setup (recommended for production)
## Docker Compose setup
1. Install [Docker Compose](https://docs.docker.com/compose/install).
Expand Down
7 changes: 5 additions & 2 deletions dbschema/bootstrap/auth.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ext::auth::AuthConfig::token_time_to_live := <duration>"24 hours";
CONFIGURE CURRENT BRANCH SET
ext::auth::AuthConfig::allowed_redirect_urls := {
# Local setup
'http://localhost:5173',
'http://localhost:4173',

# Local setup (dev)
# 'http://localhost:5173',

# Docker Compose setup
# 'http://localhost:3000',
Expand All @@ -25,7 +28,7 @@ INSERT ext::auth::EmailPasswordProviderConfig {

# SMTP Configuration
CONFIGURE CURRENT BRANCH SET
ext::auth::SMTPConfig::sender := 'infernet-cloud@ritual.net';
ext::auth::SMTPConfig::sender := 'your-sender-email@example.com';
CONFIGURE CURRENT BRANCH SET
ext::auth::SMTPConfig::host := 'smtp';
CONFIGURE CURRENT BRANCH SET
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"docker:clean": "docker system prune -f",
"docker:server:restart": "pnpm run docker:clean && pnpm run docker-compose up --build --no-deps --detach server",
"docker:edgedb:init": "pnpm run docker:edgedb:init:auth",
"docker:edgedb:init:auth": "pnpm run docker-compose up edgedb --wait && pnpm run docker:edgedb:cli query -f ./dbschema/bootstrap/auth.edgeql",
"docker:edgedb:init:auth": "pnpm run docker-compose up edgedb --wait && sh -c '. .env.docker && printf \"%s\\n\" \"$EDGEDB_SERVER_PASSWORD\" | pnpm run docker-compose exec -T edgedb edgedb --tls-security insecure --password-from-stdin query -f ./dbschema/bootstrap/auth.edgeql'",
"docker:edgedb:restart": "pnpm run docker:clean && pnpm run docker-compose up --build --no-deps --detach edgedb",
"docker:edgedb:backup": "cp -r edgedb-data \"edgedb-data.backup.$(date +%s)\"",
"docker:edgedb:destroy": "sh -c 'read -p \"Destroy EdgeDB Docker volume? (y/N): \" confirm && case $confirm in y|Y) pnpm run docker-compose down edgedb && rm -rf edgedb-data ;; *) echo \"Operation cancelled\" ;; esac'",
Expand Down
3 changes: 3 additions & 0 deletions server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ FROM base AS build

COPY .env.docker .env.docker

# Also copy to .env to allow SvelteKit to read as $env/static/private
COPY .env.docker .env

# pnpm install
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<ul class="row">
<li class="row">
<a
href="https://docs.ritual.net/infernet/about"
href="https://docs.ritual.net/infernet/general/introduction"
target="_blank"
>
Infernet Docs
Expand Down

0 comments on commit e619f74

Please sign in to comment.