Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Establish the recipes bmc #24

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 32 additions & 28 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Cargo config file.
# See: https://doc.rust-lang.org/cargo/reference/config.html

[env]
RUST_LOG = "recipya=debug,lib_core=debug,lib_web=debug,lib_auth=debug,lib_utils=debug"

DATABASE_URL = "postgres://postgres:postgres@localhost:5432/recipya"

SERVICE_EMAIL_FROM = "[email protected]"
SERVICE_EMAIL_SENDGRID_API_KEY = "YOUR_API_KEY"

SERVICE_INTEGRATIONS_AZURE_DI_ENDPOINT = ""
SERVICE_INTEGRATIONS_AZURE_DI_KEY = ""

SERVICE_ADDRESS_URL = "http://0.0.0.0:7324"
SERVICE_AUTOLOGIN = "false"
SERVICE_BYPASS_GUIDE = "false"
SERVICE_DEMO = "false"
SERVICE_NO_SIGNUPS = "false"
SERVICE_PRODUCTION = "false"

# Run `cargo run -p recipya-genkey` twice and paste the b64u encoded keys, once for the password and the other the token.
SERVICE_PASSWORD_KEY = "CKUGFOD9_2Qf6Pn3ZFRYgPYb8ht4vKqEG9PGMXTB7497bT0367DjoaD6ydFnEVaIRda0kKeBZVCT5Hb62m2sCA"
SERVICE_TOKEN_KEY = "MN2z8mZgRymm0iojkVm1zkhnAXgXyhRdl6R2ODWST8LOIGS1ImV6sUvEDUncc0izt9xCzju2sGcEdGfSj23B0w"
SERVICE_TOKEN_DURATION_SEC = "1800"

SERVICE_DOCS_FOLDER = "web/docs/public"
SERVICE_WEB_FOLDER = "web/static"
# Cargo config file.
# See: https://doc.rust-lang.org/cargo/reference/config.html

[env]
RUST_LOG = "recipya=debug,lib_core=debug,lib_web=debug,lib_auth=debug,lib_utils=debug"

DATABASE_URL = "postgres://postgres:postgres@localhost:5432/recipya"

SERVICE_EMAIL_FROM = "[email protected]"
SERVICE_EMAIL_SENDGRID_API_KEY = "YOUR_API_KEY"

SERVICE_INTEGRATIONS_AZURE_DI_ENDPOINT = ""
SERVICE_INTEGRATIONS_AZURE_DI_KEY = ""

SERVICE_ADDRESS_URL = "http://0.0.0.0:7324"
SERVICE_AUTOLOGIN = "false"
SERVICE_BYPASS_GUIDE = "false"
SERVICE_DEMO = "false"
SERVICE_NO_SIGNUPS = "false"
SERVICE_PRODUCTION = "false"

# Run `cargo run -p recipya-genkey` twice and paste the b64u encoded keys, once for the password and the other the token.
SERVICE_PASSWORD_KEY = "CKUGFOD9_2Qf6Pn3ZFRYgPYb8ht4vKqEG9PGMXTB7497bT0367DjoaD6ydFnEVaIRda0kKeBZVCT5Hb62m2sCA"
SERVICE_TOKEN_KEY = "MN2z8mZgRymm0iojkVm1zkhnAXgXyhRdl6R2ODWST8LOIGS1ImV6sUvEDUncc0izt9xCzju2sGcEdGfSj23B0w"
SERVICE_TOKEN_DURATION_SEC = "1800"

SERVICE_DOCS_FOLDER = "web/docs/public"
SERVICE_WEB_FOLDER = "web/static"

[target.x86_64-pc-windows-msvc.pq]
rustc-link-search = ["C:\\Program Files\\PostgreSQL\\12\\lib"]
rustc-link-lib = ["libpq"]
30 changes: 15 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM mcr.microsoft.com/devcontainers/rust:latest

RUN apt-get update && apt-get install -y curl hugo && apt-get -y install --no-install-recommends postgresql-client \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

ENV NVM_DIR /usr/local/nvm
RUN mkdir -p $NVM_DIR
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
ENV NODE_VERSION v22.6.0
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install 22 && nvm use --delete-prefix 22"
ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH

RUN npm install -g @go-task/cli
RUN cargo install diesel_cli
FROM mcr.microsoft.com/devcontainers/rust:latest
RUN apt-get update && apt-get install -y curl hugo && apt-get -y install --no-install-recommends postgresql-client \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
ENV NVM_DIR /usr/local/nvm
RUN mkdir -p $NVM_DIR
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
ENV NODE_VERSION v22.6.0
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install 22 && nvm use --delete-prefix 22"
ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH
RUN npm install -g @go-task/cli
RUN cargo install diesel_cli
40 changes: 20 additions & 20 deletions .devcontainer/clean_test_dbs.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash

# About this script:
# You might sometimes have some leaking databases after running tests that interact
# with the PostgreSQL database. This script deletes them all to ensure cleanliness.

PREFIX='test_db'
export PGPASSWORD=postgres
export PGUSER=postgres
export PGHOST=localhost
export PGPORT=5432

TEST_DB_LIST=$(psql -l | awk '{ print $1 }' | grep '^[a-z]' | grep -v template | grep -v postgres)
for TEST_DB in $TEST_DB_LIST ; do
if [ $(echo $TEST_DB | sed "s%^$PREFIX%%") != $TEST_DB ]
then
echo "Dropping $TEST_DB"
dropdb --if-exists $TEST_DB
fi
done
#!/bin/bash
# About this script:
# You might sometimes have some leaking databases after running tests that interact
# with the PostgreSQL database. This script deletes them all to ensure cleanliness.
PREFIX='test_db'
export PGPASSWORD=postgres
export PGUSER=postgres
export PGHOST=localhost
export PGPORT=5432
TEST_DB_LIST=$(psql -l | awk '{ print $1 }' | grep '^[a-z]' | grep -v template | grep -v postgres)
for TEST_DB in $TEST_DB_LIST ; do
if [ $(echo $TEST_DB | sed "s%^$PREFIX%%") != $TEST_DB ]
then
echo "Dropping $TEST_DB"
dropdb --if-exists $TEST_DB
fi
done
68 changes: 34 additions & 34 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"name": "Recipya Rust",
"dockerComposeFile": "docker-compose.yaml",
"service": "app",
"workspaceFolder": "/workspace",
"forwardPorts": [7324, 5432],
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"vadimcn.vscode-lldb",
"fill-labs.dependi",
"bierner.docs-view",
"usernamehw.errorlens",
"tamasfe.even-better-toml",
"rust-lang.rust-analyzer",
"gruntfuggly.todo-tree"
],
"settings": {
"sqltools.connections": [
{
"name": "Container database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "recipya",
"username": "postgres",
"password": "postgres"
}
]
}
}
}
{
"name": "Recipya Rust",
"dockerComposeFile": "docker-compose.yaml",
"service": "app",
"workspaceFolder": "/workspace",
"forwardPorts": [7324, 5432],
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"vadimcn.vscode-lldb",
"fill-labs.dependi",
"bierner.docs-view",
"usernamehw.errorlens",
"tamasfe.even-better-toml",
"rust-lang.rust-analyzer",
"gruntfuggly.todo-tree"
],
"settings": {
"sqltools.connections": [
{
"name": "Container database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "recipya",
"username": "postgres",
"password": "postgres"
}
]
}
}
}
}
54 changes: 27 additions & 27 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
services:
app:
build:
context: ..
dockerfile: ./.devcontainer/Dockerfile
depends_on:
- db
volumes:
- ..:/workspace:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: recipya
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

volumes:
services:
app:
build:
context: ..
dockerfile: ./.devcontainer/Dockerfile
depends_on:
- db
volumes:
- ..:/workspace:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db
db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: recipya
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
postgres-data:
Loading
Loading