Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta Incl. new UI and slight API modifications #32

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/betaci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions

name: Beta CI

concurrency:
group: ci
cancel-in-progress: true

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ beta ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Builds docker images and pushes them to GHCR
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and push API dev-env image
uses: docker/[email protected]
with:
push: true
context: api
tags: ghcr.io/uccnetsoc/cloud-api:beta-dev-env, ghcr.io/uccnetsoc/cloud-api:${{ github.sha }}-beta-dev-env
target: dev

- name: Build and push API prod image
uses: docker/[email protected]
with:
push: true
context: api
tags: ghcr.io/uccnetsoc/cloud-api:beta, ghcr.io/uccnetsoc/cloud-api:beta-${{ github.sha }}

- name: Build and push UI dev-env image
uses: docker/[email protected]
with:
push: true
context: ui
tags: ghcr.io/uccnetsoc/cloud-ui:beta-dev-env, ghcr.io/uccnetsoc/cloud-ui:${{ github.sha }}-beta-dev-env
target: dev

- name: Build and push UI prod image
uses: docker/[email protected]
with:
push: true
context: ui
tags: ghcr.io/uccnetsoc/cloud-ui:beta, ghcr.io/uccnetsoc/cloud-ui:beta-${{ github.sha }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
backing-services/freeipa/
home/
ui/node_modules
ui/package-lock.json
ui/yarn.lock

.vscode
bin/
Expand Down
Empty file modified api/prestart.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion api/v1/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

from v1 import models

config_path = Path(os.environ["CONFIG_FILE"] if "CONFIG_FILE" in os.environ else "/config.yml")
config_path = Path(os.environ["CONFIG_FILE"] if "CONFIG_FILE" in os.environ else "../config.yml")
config = models.config.Config.parse_obj(yaml.safe_load(config_path.read_text()))
2 changes: 1 addition & 1 deletion api/v1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def exception_handler(request: Request, e: Exception):
"""
api.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_origins=["http://localhost:3000", "https://beta.netsoc.cloud"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
7 changes: 6 additions & 1 deletion api/v1/models/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Specs(BaseModel):
# number of gb of disk
disk_space: int


# number of mb of ram
memory: int

Expand Down Expand Up @@ -224,4 +225,8 @@ class Instance(BaseModel):
# Remarks about the VM and it's configuration we return to the user
remarks: List[str] = []

status: Status
status: Status

disk: int
mem: int
uptime: int
15 changes: 12 additions & 3 deletions api/v1/providers/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,8 @@ def _read_instance_on_node(
elif current_status['status'] == 'stopped':
status = models.proxmox.Status.Stopped

print(current_status.keys())

instance = models.proxmox.Instance(
type=instance_type,
id=vmid,
Expand All @@ -787,7 +789,10 @@ def _read_instance_on_node(
specs=specs,
remarks=[],
status=status,
active=active
active=active,
mem=current_status["mem"],
disk=current_status["disk"],
uptime=current_status["uptime"],
)

# Build remarks about the vhosts
Expand Down Expand Up @@ -877,7 +882,10 @@ def _read_instance_on_node(
specs=specs,
remarks=[],
status=status,
active=active
active=active,
mem=current_status["mem"],
disk=current_status["disk"],
uptime=current_status["uptime"],
)

# Build remarks about the thing, problems, etc...
Expand Down Expand Up @@ -926,7 +934,7 @@ def read_instances_by_account(
ret = { }

lxcs_qemus = self.prox.cluster.resources.get(type="vm")

for entry in lxcs_qemus:
if 'name' in entry and entry['name'].endswith(self._get_instance_fqdn_for_account(instance_type, account, "")):
if ignore_errors == True:
Expand All @@ -938,6 +946,7 @@ def read_instances_by_account(
else:
instance = self._read_instance_on_node(instance_type, entry['node'], entry['vmid'])
ret[instance.hostname] = instance


return ret

Expand Down
2 changes: 0 additions & 2 deletions ui/.dockerignore

This file was deleted.

7 changes: 3 additions & 4 deletions ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[*.{js,jsx,ts,tsx,vue}]
# all files have 2-space tabs
[**/*.tsx,**.ts,*.js,*.jsx,*.json,*.html,*.css,*.scss,*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 2
2 changes: 0 additions & 2 deletions ui/.eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions ui/.eslintrc.js

This file was deleted.

32 changes: 17 additions & 15 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
.DS_Store
node_modules
/dist
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# local env files
# production
/build

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

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 0 additions & 2 deletions ui/.prettierrc.yml

This file was deleted.

14 changes: 7 additions & 7 deletions ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:13.10.1-alpine3.11 as dev
FROM node:14.2-alpine as dev

WORKDIR /app
COPY . .
Expand All @@ -10,16 +10,16 @@ WORKDIR /app

COPY --from=dev /app .

ENV VUE_APP_NETSOC_API_URL=https://api.netsoc.cloud
ENV VUE_APP_OIDC_AUTHORITY=https://keycloak.netsoc.co/auth/realms/freeipa
ENV VUE_APP_HCAPTCHA_SITE_KEY=0e8176fb-1fc2-4d51-a153-773cbd8b9837
ENV VUE_APP_SSH_URL=https://ssh.netsoc.cloud
ENV VUE_APP_SFTP_URL=https://sftp.netsoc.cloud
ENV REACT_APP_NETSOC_API_URL=https://api.beta.netsoc.cloud
ENV REACT_APP_OIDC_AUTHORITY=https://keycloak.netsoc.co/auth/realms/freeipa
ENV REACT_APP_HCAPTCHA_SITE_KEY=82ab2e7f-4765-4cff-ab41-648eb653ac11
ENV REACT_APP_SSH_URL=https://ssh.netsoc.cloud
ENV REACT_APP_SFTP_URL=https://sftp.netsoc.cloud

RUN npm run build

FROM nginx:1.18.0 AS prod

RUN mkdir /app
COPY --from=prod_builder /app/dist /app
COPY --from=prod_builder /app/build /app
COPY nginx.conf /etc/nginx/nginx.conf
75 changes: 46 additions & 29 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
# ui

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Run your unit tests
```
npm run test:unit
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
5 changes: 0 additions & 5 deletions ui/babel.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions ui/jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion ui/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ http {
root /usr/share/nginx/html;
}
}
}
}
Loading