Initial commit
This commit is contained in:
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[build]
|
||||||
|
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||||
12
.devcontainer/.env
Normal file
12
.devcontainer/.env
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
RUST_BACKTRACE=full
|
||||||
|
RUST_LIB_BACKTRACE=1
|
||||||
|
|
||||||
|
POSTGRES_USER=postgres
|
||||||
|
POSTGRES_PASSWORD=postgres
|
||||||
|
POSTGRES_DB=postgres
|
||||||
|
POSTGRES_HOSTNAME=localhost
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOSTNAME}:${POSTGRES_PORT}/${POSTGRES_DB}
|
||||||
|
|
||||||
|
PGADMIN_DEFAULT_EMAIL=admin@example.com
|
||||||
|
PGADMIN_DEFAULT_PASSWORD=password
|
||||||
7
.devcontainer/Dockerfile
Normal file
7
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye
|
||||||
|
|
||||||
|
# Include lld linker to improve build times either by using environment variable
|
||||||
|
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
|
||||||
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install clang lld \
|
||||||
|
&& apt-get autoremove -y && apt-get clean -y
|
||||||
31
.devcontainer/devcontainer.json
Normal file
31
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/rust-postgres
|
||||||
|
{
|
||||||
|
"name": "Rust and PostgreSQL",
|
||||||
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
|
"service": "app",
|
||||||
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
|
||||||
|
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {},
|
||||||
|
"ghcr.io/nikobockerman/devcontainer-features/fish-persistent-data:2": {}
|
||||||
|
},
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
// "features": {},
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
"forwardPorts": [
|
||||||
|
80
|
||||||
|
],
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "cargo install diesel_cli",
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"inferrinizzard.prettier-sql-vscode"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
||||||
46
.devcontainer/docker-compose.yml
Normal file
46
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
devcontainer-scraper-rs-postgres-data:
|
||||||
|
devcontainer-scraper-rs-cargo-cache:
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
env_file:
|
||||||
|
# Ensure that the variables in .env match the same variables in devcontainer.json
|
||||||
|
- .env
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ../..:/workspaces:cached
|
||||||
|
- devcontainer-scraper-rs-cargo-cache:/usr/local/cargo
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||||
|
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: pgvector/pgvector:pg17
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- devcontainer-scraper-rs-postgres-data:/var/lib/postgresql/data
|
||||||
|
env_file:
|
||||||
|
# Ensure that the variables in .env match the same variables in devcontainer.json
|
||||||
|
- .env
|
||||||
|
|
||||||
|
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||||
|
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||||
|
|
||||||
|
pgadmin:
|
||||||
|
image: dpage/pgadmin4:8.13.0
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: service:db
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for more information:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
# https://containers.dev/guide/dependabot
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "devcontainers"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Prettier-SQL.commaPosition": "before",
|
||||||
|
"Prettier-SQL.expressionWidth": 30,
|
||||||
|
"Prettier-SQL.keywordCase": "upper",
|
||||||
|
"Prettier-SQL.SQLFlavourOverride": "postgresql",
|
||||||
|
"Prettier-SQL.logicalOperatorNewline": "before",
|
||||||
|
"Prettier-SQL.tabulateAlias": true,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user