Skip to content

Commit 67ffa66

Browse files
author
Håkan Persson
committed
adds files from original repo.
1 parent 422a0ad commit 67ffa66

69 files changed

Lines changed: 2669 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Python
6+
__pycache__
7+
*.pyc
8+
*.pyo
9+
*.pyd
10+
.Python
11+
*.py[cod]
12+
*$py.class
13+
.codehub
14+
15+
# Environments
16+
.env
17+
.venv
18+
env/
19+
venv/
20+
21+
# VS Code
22+
.vscode
23+
24+
# Secrets and deployments (these will be mounted)
25+
secrets/*
26+
deployments/*
27+
28+
# OS
29+
.DS_Store

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# OS
2+
.DS_Store
3+
4+
# VS Code
5+
settings.json
6+
7+
# Deployments
8+
**/config/deployments/*
9+
10+
# Python
11+
__pycache__
12+
*.egg*
13+
14+
# GCP
15+
service-account.json
16+
cluster_ca_cert
17+
18+
# Secrets
19+
.secret_env
20+
21+
# Secrets
22+
**/secrets/*/*
23+
_CERTS
24+
25+
# Deployments
26+
**/deployments/*
27+
28+
!/**/.gitkeep
29+
30+
# pyenv
31+
.codehub
32+
33+
# LSP config
34+
pyrightconfig.json

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-ast
6+
- id: check-case-conflict
7+
- id: check-docstring-first
8+
- id: check-merge-conflict
9+
- id: mixed-line-ending
10+
#- id: check-yaml
11+
- id: end-of-file-fixer
12+
exclude: \.gitignore
13+
exclude_types:
14+
- yaml
15+
- id: trailing-whitespace
16+
exclude: \.gitignore
17+
exclude_types:
18+
- yaml
19+
- repo: https://github.com/pycqa/flake8
20+
rev: 6.0.0 # pick a git hash / tag to point to
21+
hooks:
22+
- id: flake8
23+
- repo: https://github.com/psf/black
24+
rev: 23.3.0
25+
hooks:
26+
- id: black
27+

Dockerfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
FROM python:3.9.10-slim
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y apt-utils && \
5+
DEBIAN_FRONTEND=noninteractive apt-get install --fix-missing -y \
6+
curl \
7+
apt-transport-https \
8+
gnupg \
9+
unzip \
10+
lsb-release \
11+
git \
12+
zsh \
13+
mc \
14+
nano \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Install OpenTofu
19+
RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \
20+
chmod +x install-opentofu.sh && \
21+
./install-opentofu.sh --install-method deb && \
22+
rm -f install-opentofu.sh
23+
24+
# Install kubectl from official source
25+
RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \
26+
chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \
27+
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list && \
28+
chmod 644 /etc/apt/sources.list.d/kubernetes.list && \
29+
apt-get update && apt-get install -y kubectl && \
30+
rm -rf /var/lib/apt/lists/*
31+
32+
# Install Helm using binary download
33+
RUN curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null && \
34+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list && \
35+
apt-get update && apt-get install -y helm && \
36+
rm -rf /var/lib/apt/lists/*
37+
38+
# Install Google Cloud CLI and gke-gcloud-auth-plugin
39+
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
40+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
41+
apt-get update && apt-get install -y \
42+
google-cloud-sdk \
43+
google-cloud-sdk-gke-gcloud-auth-plugin\
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Set up working directory
47+
WORKDIR /app
48+
49+
# Copy requirements
50+
COPY dev_requirements.txt .
51+
52+
# Install Python dependencies
53+
RUN pip install --no-cache-dir -r dev_requirements.txt
54+
55+
# Copy the rest of the application
56+
COPY . .
57+
RUN pip install -e .
58+
59+
# Create directories for mounted volumes
60+
RUN mkdir -p /app/deployments /app/secrets /app/codehub /app/utils
61+
62+
# Set up zsh as default shell
63+
RUN chsh -s /bin/zsh root && utils/mod_term.sh
64+
65+
# Set default command
66+
CMD ["/bin/zsh"]
67+
68+
# Volume configuration
69+
VOLUME ["/app/deployments", "/app/secrets"]

GCP_DEPLOY.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Python GCP deployment instructions
2+
3+
This assumes you have the following installed locally:
4+
* docker
5+
* helm (tested with v3)
6+
* kubectl
7+
* gcloud
8+
9+
---
10+
11+
### 1. Set up project:
12+
13+
1. Create GCP project
14+
2. Enable Kubernetes Engine
15+
3. Enable Cloud Filestore API
16+
17+
18+
### 2. Deploy
19+
20+
1. Create a new key on the service account `test-deploy` in the GCP project. Your JSON key-file will be automatically saved to your computer. Move it to `secrets/gcp`, rename it to `service-account.json` and authenticate your gcloud CLI with:
21+
```sh
22+
gcloud auth activate-service-account --key-file secrets/gcp/service-account.json
23+
```
24+
2. Create and enter conda environment:
25+
```sh
26+
conda env create -f dev_environment.yml
27+
conda activate codehub
28+
```
29+
3. Install CLI:
30+
```sh
31+
pip install --editable .
32+
```
33+
4. You can now use the CLI by typing:
34+
1. Create cluster
35+
```sh
36+
codehub createcluster -n <cluster-name>
37+
```
38+
2. Upgrade cluster
39+
```sh
40+
codehub upgradecluster -n <cluster-name>
41+
```
42+
3. Scale cluster
43+
```sh
44+
codehub scalecluster -n <cluster-name>
45+
```
46+
4. Delete cluster
47+
```sh
48+
codehub deletecluster -n <cluster-name>
49+
```
50+
5. Delete nfs
51+
```sh
52+
codehub deletefs -n <cluster-name>
53+
```
54+
6. Get cluster IP
55+
```sh
56+
codehub getip -n <cluster-name>
57+
```

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright © 2025 AMD Silo AI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the “Software”), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)