commit 3ad4d78023fff38a4f4c7a63607ffb12b542c246 Author: Jun-te Kim Date: Sat Nov 15 13:19:21 2025 +0000 add the first few files for insight diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..bc99d8b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,53 @@ +FROM library/python:3.12-bullseye + +ARG USER=vscode +ARG DEBIAN_FRONTEND=noninteractive + +# DO NOT PUSH IMAGE TO ECR!!! as anyone with access to image can log on to our aws +# Will log on as aws Jun-te account, change in the future to development account +ENV AWS_ACCESS_KEY_ID=AKIAU5A36PPNK7RXX52V +ENV AWS_SECRET_ACCESS_KEY=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 +ENV AWS_DEFAULT_REGION=eu-west-2 + +# Install system dependencies in a single layer +RUN apt update && apt install -y --no-install-recommends \ + sudo jq vim curl\ + && apt autoremove -y \ + && rm -rf /var/lib/apt/lists/* + +# Create the user and grant sudo privileges +RUN useradd -m -s /usr/bin/bash ${USER} \ + && echo "${USER} ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/${USER} \ + && chmod 0440 /etc/sudoers.d/${USER} + +# Install Poetry +RUN pip install --no-cache-dir poetry + + +# Install Node.js 22 (from NodeSource) +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt install -y nodejs \ + && node -v \ + && npm -v + + +# Install aws +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +RUN unzip awscliv2.zip +RUN ./aws/install + +# Install terraform +RUN apt-get update && sudo apt-get install -y gnupg software-properties-common +RUN wget -O- https://apt.releases.hashicorp.com/gpg | \ +gpg --dearmor | \ +sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null +RUN echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ +https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ +tee /etc/apt/sources.list.d/hashicorp.list +RUN apt update +RUN apt-get install terraform +RUN terraform -install-autocomplete + + +# Set the working directory +WORKDIR /workspaces/insight \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..110a5d6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +{ + "name": "Basic Python", + "dockerComposeFile": "docker-compose.yml", + "service": "insight", + "remoteUser": "vscode", + "workspaceFolder": "/workspaces/insight", + "postStartCommand": "bash .devcontainer/post-install.sh", + + "features": { + // "ghcr.io/devcontainers/features/ssh-agent:1": {} + }, + + "mounts": [ + // Optional convenience mount + "source=${localEnv:HOME},target=/workspaces/home,type=bind" + ], + + "customizations": { + "vscode": { + "settings": { + "files.defaultWorkspace": "/workspaces/insight" + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "mechatroner.rainbow-csv", + "ms-toolsai.datawrangler", + "lindacong.vscode-book-reader", + "4ops.terraform", + "fabiospampinato.vscode-todo-plus", + "jgclark.vscode-todo-highlight", + "corentinartaud.pdfpreview" + ] + } + } +} + diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..82c39a8 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,50 @@ +version: '3.8' + +services: + insight: + user: "${UID}:${GID}" + build: + context: .. + dockerfile: .devcontainer/Dockerfile + command: sleep infinity + env_file: + - ../.db-env + volumes: + - ..:/workspaces/insight + depends_on: + - db + networks: + - survey-net + + db: + image: postgres:17.4 + restart: unless-stopped + ports: + - 5432:5432 + env_file: + - ../.db-env + volumes: + - postgres-data:/var/lib/postgresql/data + networks: + - survey-net + + pgadmin: + image: dpage/pgadmin4 + hostname: pgadmin + ports: + - 5555:80 + env_file: + - ../.db-env + restart: unless-stopped + depends_on: + - db + networks: + - survey-net + +networks: + survey-net: + driver: bridge + +volumes: + postgres-data: + diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh new file mode 100644 index 0000000..473e420 --- /dev/null +++ b/.devcontainer/post-install.sh @@ -0,0 +1,27 @@ +#!/bin/bash +poetry install; + +# Get the Poetry virtual environment path +VENV_PATH=$(poetry env info --path 2>/dev/null) + +if [ -z "$VENV_PATH" ]; then + echo "No Poetry environment found. Did you run 'poetry install'?" + exit 1 +fi + +# Ensure VS Code settings directory exists +SETTINGS_DIR="/home/vscode/.vscode-server/data/Machine" +SETTINGS_FILE="$SETTINGS_DIR/settings.json" + +mkdir -p "$SETTINGS_DIR" + +# If settings.json doesn't exist, create a default one +if [ ! -f "$SETTINGS_FILE" ]; then + echo "{}" > "$SETTINGS_FILE" +fi + +# Update VS Code settings to use the Poetry virtual environment +jq --arg venv "$VENV_PATH/bin/python" '.["python.defaultInterpreterPath"] = $venv' \ + "$SETTINGS_FILE" > "$SETTINGS_FILE.tmp" && mv "$SETTINGS_FILE.tmp" "$SETTINGS_FILE" + +echo "✅ Updated VS Code to use Poetry environment: $VENV_PATH" diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..27782c1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "jupyter.interactiveWindow.textEditor.executeSelection": true, + "python.REPL.sendToNativeREPL": true, + "notebook.output.scrolling": true, + "terminal.integrated.defaultProfile.linux": "bash", + "editor.rulers": [67], + "terminal.integrated.profiles.linux": { + "bash": { + "path": "/bin/bash" + } + }, + + // Hot reload setting that needs to be in user settings + // "jupyter.runStartupCommands": [ + // "%load_ext autoreload", "%autoreload 2" + // ] + + +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3df5106 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +Initial Project spec + +Single dashboard with: + + [Typhaine] Weekly planned numbers + [Typhaine] Weekly completed numbers + [Typhaine] Ideally covers a couple of weeks + + Note: We may not feasibly be able to do this with just HubSpot tracking and so we may require a script to complete this with the data being pushed to a database. Build a dashboard (dash?). + + Work type, Last week [planned], Last week [completed], Next week [planned], Next week [completed] + ECO4, 72, 48, 90, - + WH coordination, 18, 20, 20, - + + + +Deploy: Render?< + +Data store: +s3 bucket/date/all_data.json [<1mb] +Frontend: +boto3 to grab the data from s3 and present it back + +Monorepo with frontend & backend +Stack: Dash + Github actions for re-reruns + S3 for data-storage [don't set up a DB!] + +--- +Technical Scope: + +Junte: + - Typhaine will need a linux machine to connect to do this + - I've set up a temporary computer so that she can learn how to do this first + _ Ask khalim which is better for now + - Set up a basic devcontianer with python and poetry + +Dash + Github Actions (etl of hubspot) + S3 ( data stroage) + devcontainer for typhaine \ No newline at end of file