From 777fbb151dba1ebf6058377e31ee1d391cc37125 Mon Sep 17 00:00:00 2001 From: Murasko Date: Thu, 8 Feb 2024 18:25:37 +0100 Subject: [PATCH 1/4] added devcontainer added postgresql and some nice to have extensions --- .cargo/config.toml | 2 ++ .devcontainer/.env | 5 +++++ .devcontainer/Dockerfile | 7 ++++++ .devcontainer/devcontainer.json | 22 +++++++++++++++++++ .devcontainer/docker-compose.yml | 37 ++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .devcontainer/.env create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..678266e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["-C", "link-arg=-fuse-ld=lld"] \ No newline at end of file diff --git a/.devcontainer/.env b/.devcontainer/.env new file mode 100644 index 0000000..e4f79bd --- /dev/null +++ b/.devcontainer/.env @@ -0,0 +1,5 @@ +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_DB=postgres +POSTGRES_HOSTNAME=localhost +POSTGRES_PORT=5432 \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..9ca17a6 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..8e6a6f1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "name": "Lum", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + + // Comment out the extensions you do not want to install + "customizations":{ + "vscode": { + "extensions": [ + "github.copilot-chat", + "github.copilot", + "JScearcy.rust-doc-viewer", + "swellaby.vscode-rust-test-adapter", + "Gruntfuggly.todo-tree", + "usernamehw.errorlens" + ] + } + }, + + "remoteUser": "vscode" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..5c16f9c --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3.8' + +volumes: + postgres-data: + +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 + + # 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: postgres:14.1 + restart: unless-stopped + volumes: + - 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.) \ No newline at end of file From 22c8742fc8c0cb4099b16dac070a705805795204 Mon Sep 17 00:00:00 2001 From: Murasko Date: Sat, 17 Feb 2024 20:41:46 +0100 Subject: [PATCH 2/4] removed clang to fix pipelines --- .cargo/config.toml | 2 -- .devcontainer/Dockerfile | 1 - 2 files changed, 3 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 678266e..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -rustflags = ["-C", "link-arg=-fuse-ld=lld"] \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9ca17a6..90b4ce9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,5 +3,4 @@ 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 From 1172c3ff32c8bb06a2d94e49621c92c7ea240867 Mon Sep 17 00:00:00 2001 From: Marco Murawski Date: Sat, 17 Feb 2024 20:45:18 +0100 Subject: [PATCH 3/4] Update .devcontainer/devcontainer.json Co-authored-by: Torben Schweren --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8e6a6f1..4266384 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Lum", + "name": "lum", "dockerComposeFile": "docker-compose.yml", "service": "app", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", From 49cf7646395d987da91fd94c06cc21799abe5e11 Mon Sep 17 00:00:00 2001 From: Marco Murawski Date: Sat, 17 Feb 2024 20:45:23 +0100 Subject: [PATCH 4/4] Update .devcontainer/docker-compose.yml Co-authored-by: Torben Schweren --- .devcontainer/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 5c16f9c..2605b33 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -25,7 +25,7 @@ services: # (Adding the "ports" property to this file will not forward from a Codespace.) db: - image: postgres:14.1 + image: postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data