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

Merged
merged 16 commits into from
Feb 9, 2025
Merged
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
  •  
  •  
  •  
28 changes: 0 additions & 28 deletions .cargo/config.toml

This file was deleted.

27 changes: 12 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
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 curl -fsSL https://deb.nodesource.com/setup_23.x | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
nodejs \
&& npm install -g npm@latest \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

RUN cargo install diesel_cli
7 changes: 3 additions & 4 deletions .devcontainer/clean_test_dbs.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
# 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'
PREFIX='recipya_test'
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
if [[ $TEST_DB == recipya_test* && $TEST_DB != "recipya_test" ]]; then
echo "Dropping $TEST_DB"
dropdb --if-exists $TEST_DB
dropdb --if-exists "$TEST_DB"
fi
done
70 changes: 35 additions & 35 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_test",
"username": "postgres",
"password": "postgres"
}
]
}
}
}
}
52 changes: 24 additions & 28 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
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:
services:
app:
build:
context: ..
dockerfile: ./.devcontainer/Dockerfile
depends_on:
- db
volumes:
- ..:/workspace:cached
command: sleep infinity
network_mode: service:db

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

volumes:
postgres-data:
Loading