Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoApp committed Dec 18, 2024
1 parent 37c0c38 commit 818973b
Show file tree
Hide file tree
Showing 102 changed files with 92 additions and 20,024 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# set ubuntu version to 20.04 - https://github.com/devcontainers/features/issues/372
FROM mcr.microsoft.com/vscode/devcontainers/base:0-ubuntu-20.04
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "GCP playground",
"image": "mcr.microsoft.com/vscode/devcontainers/python:3",
"features": {
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},
"settings": {
"extensions.ignoreRecommendations": true,
"workbench.startupEditor": "none",
"workbench.colorTheme": "Visual Studio Dark",
"workbench.colorCustomizations": {},
"workbench.welcomePage.walkthroughs.openOnInstall": false,
"workbench.welcomePage.experimental.videoTutorials": "off",
"github.codespaces.defaultExtensions": []
},
"postStartCommand": "bash -c .devcontainer/setup.sh"
}
20 changes: 4 additions & 16 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ export ENGINE_EVENT_ENDPOINT="${ENGINE_BASE_URL}/users/${WILCO_ID}/event"
# Update engine that codespace started for user
curl -L -X POST "${ENGINE_EVENT_ENDPOINT}" -H "Content-Type: application/json" --data-raw "{ \"event\": \"github_codespace_started\" }"

# Export backend envs when in codespaces
echo "export CODESPACE_BACKEND_HOST=\"${CODESPACE_BACKEND_HOST}\"" >> ~/.bashrc
echo "export CODESPACE_BACKEND_URL=\"${CODESPACE_BACKEND_URL}\"" >> ~/.bashrc
echo "export CODESPACE_WDS_SOCKET_PORT=443" >> ~/.bashrc

# Export welcome prompt in bash:
echo "printf \"\n\n☁️☁️☁️️ Anythink: Develop in the Cloud ☁️☁️☁️\n\"" >> ~/.bashrc
echo "printf \"\n\x1b[31m \x1b[1m👉 Type: \\\`docker compose up\\\` to run the project. 👈\n\n\"" >> ~/.bashrc

nohup bash -c "cd /wilco-agent && node agent.js &" >> /tmp/agent.log 2>&1

# Check if docker is installed
if command -v docker &> /dev/null
then
docker compose pull
fi
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update
sudo apt-get install -y google-cloud-sdk
3 changes: 0 additions & 3 deletions .github/pull_request_template.md

This file was deleted.

157 changes: 0 additions & 157 deletions .github/workflows/k8s.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/wilco-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
pull_request:
branches:
- main

jobs:
wilco:
runs-on: ubuntu-20.04
timeout-minutes: 10
name: Pr checks

steps:
- name: Check out project
uses: actions/checkout@v2

- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}

- name: Wilco checks
id: Wilco
uses: trywilco/actions@main
with:
engine: ${{ secrets.WILCO_ENGINE_URL }}
38 changes: 1 addition & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/backend/node_modules
/frontend/node_modules
/.wilco-helpers/node_modules
/tests/e2e/node_modules
/tests/frontend/node_modules/
/tests/frontend/test-results/
/tests/frontend/playwright-report/
/tests/frontend/playwright/.cache/

/.pnp
.pnp.js

# testing
/coverage

# production
/backend/build
/frontend/build

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

#IDEs
/.idea/
/.idea
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# gcp-playground
GCP playground
40 changes: 40 additions & 0 deletions create_wilco_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Variables
SERVICE_ACCOUNT_NAME="wilco-checks-service-account"
DESCRIPTION="Verify wilco actions"
DISPLAY_NAME="Wilco checks"
PROJECT_ID=$(gcloud config get-value project)
ROLE="roles/owner"
KEY_FILE_PATH="/tmp/wilco_creds.json"

# Create the service account
gcloud iam service-accounts create $SERVICE_ACCOUNT_NAME \
--description="$DESCRIPTION" \
--display-name="$DISPLAY_NAME"

# Assign the role to the service account
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:${SERVICE_ACCOUNT_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \
--role="$ROLE"

# Generate the key file for the service account
gcloud iam service-accounts keys create $KEY_FILE_PATH \
--iam-account "${SERVICE_ACCOUNT_NAME}@${PROJECT_ID}.iam.gserviceaccount.com"

gcloud services enable dataflow.googleapis.com

credentials="`cat $KEY_FILE_PATH`"
stringified_credentials="$(echo "$credentials" | jq -R -s .)"


WILCO_ID="`cat .wilco`"
export ENGINE_EVENT_ENDPOINT="${ENGINE_BASE_URL}/users/${WILCO_ID}/event"

# Update engine with service account credentials

curl -L -X POST "${ENGINE_EVENT_ENDPOINT}" -H "Content-Type: application/json" --data-raw "{ \"event\": \"gcp_service_account_created\", \"metadata\": {\"credentials\": $stringified_credentials, \"project_id\": \"$PROJECT_ID\" }}"

export GOOGLE_APPLICATION_CREDENTIALS=$KEY_FILE_PATH

echo "Service account created successfully"
2 changes: 0 additions & 2 deletions frontend/.eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions frontend/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions frontend/Dockerfile.aws

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/jest.config.js

This file was deleted.

Loading

0 comments on commit 818973b

Please sign in to comment.