From 27aeb82c4bcde0b2a3dea7c209e0fcaa056d4e2c Mon Sep 17 00:00:00 2001 From: Prabhat Sharma Date: Tue, 14 Mar 2023 08:48:52 +0530 Subject: [PATCH] Added devcontainers for easy development (#275) --- .devcontainer/Dockerfile | 12 ++++++++++++ .devcontainer/devcontainer.json | 33 +++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 6 +++--- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..a22ccfd132 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,12 @@ +# FROM mcr.microsoft.com/devcontainers/base:bullseye +FROM public.ecr.aws/docker/library/rust:buster + +RUN apt-get update +RUN apt-get install -y protobuf-compiler +RUN apt-get install -y cmake curl + +# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN rustup toolchain install nightly-2023-01-26 +RUN rustup default nightly-2023-01-26 +RUN rustup target add x86_64-unknown-linux-gnu + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..09f475028a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "build": { + "dockerfile": "Dockerfile" + // Update 'VARIANT' to pick a Node version: 16, 14, 12. + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + // "args": { + // "VARIANT": "bullseye" + // } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/rust:1": {}, + "devwasm.azurecr.io/dev-wasm/dev-wasm-feature/rust-wasi:0": {} + }, + + // 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": [ 5080, 8081 ] + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 716f8a0c30..c09f225b7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,8 @@ You must have follwing installed: 2. Rust & Cargo 1.61.0 + (We recommend 1.66+), 3. nodejs v14+ and npm v6+ +Alternatively you can use pre-configured devcontainer in VS code to get up and running quickly. + ## Building from source code ### Lets clone the repo and get started @@ -56,11 +58,9 @@ There are 2 areas of development. ### Server ```shell -cargo run +ZO_ROOT_USER_EMAIL=root@example.com ZO_ROOT_USER_PASSWORD=Complexpass#123 cargo run ``` -Please note by default user 'admin' with password 'Complexpass#123' is created - This will start the zincobserve API server on port 5080 environment variables ZO_ROOT_USER_EMAIL and ZO_ROOT_USER_PASSWORD can be used first time to configure default admin user when zincobserve is started.