Skip to content
Open

Dev #12

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
ce14ca2
Removed version validation on input
lucasprins May 22, 2023
0e58717
Merge pull request #3 from HR-Project-D/backend-database
The0Danktor May 22, 2023
5accce8
Create version.py
fabiothomas May 25, 2023
000ef37
Update .dockerignore
The0Danktor May 25, 2023
86fab16
Improved nextjs docker buildfile by using standalone output of nextjs
lucasprins May 25, 2023
0d96076
epic version
The0Danktor May 27, 2023
e19498d
Update scan.py
The0Danktor May 27, 2023
0e009fc
Update scan.py
The0Danktor May 27, 2023
3ffaa0f
Update 33.cyclonedx2.json
The0Danktor May 27, 2023
ee74312
test
The0Danktor May 27, 2023
ebc48c3
Front-end redesign
lucasprins May 27, 2023
dea99ea
Merge branch 'main' of https://github.com/HR-Project-D/dependify
lucasprins May 27, 2023
44183af
Create docker-build.yml
The0Danktor May 27, 2023
afdb8f6
Update docker-build.yml
The0Danktor May 27, 2023
b8b4b5a
Update docker-build.yml
The0Danktor May 27, 2023
8c65f66
Update docker-build.yml
The0Danktor May 27, 2023
16bf4c2
Fixed linting errors
lucasprins May 27, 2023
428352c
Merge pull request #4 from HR-Project-D/dev
The0Danktor May 27, 2023
8a919c1
vergaat de image naam
The0Danktor May 27, 2023
d0e3707
Update docker-build.yml
The0Danktor May 27, 2023
83b1798
exactmatch
The0Danktor May 27, 2023
5c9cb38
Create docker2
The0Danktor May 27, 2023
144c2c7
docker bullshit
The0Danktor May 27, 2023
16f7824
Added various components
lucasprins May 27, 2023
52e1198
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor May 27, 2023
c9ae4d9
Added various animations
lucasprins May 27, 2023
77e729b
Added a new header
lucasprins May 27, 2023
669a249
Update views.py
The0Danktor May 28, 2023
0a6531b
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor May 28, 2023
54021b2
Update views.py
The0Danktor May 28, 2023
415a486
Update views.py
The0Danktor May 28, 2023
11cc8eb
Added search result component and tooltips
lucasprins May 28, 2023
088e643
Added optional classname to tooltip component
lucasprins May 28, 2023
2c033df
Tooltip & checkbox QOL improvements
lucasprins May 28, 2023
a482cda
Changed header to be inline with the main nav
lucasprins May 28, 2023
3c1c86f
Made search results popup responsive
lucasprins May 28, 2023
2d0d220
Merge pull request #5 from HR-Project-D/dev
The0Danktor May 28, 2023
631d07b
Delete DataSourceRow.tsx
The0Danktor May 28, 2023
30313ce
Revert "Delete DataSourceRow.tsx"
The0Danktor May 28, 2023
b32ea54
Removed version from front-end
lucasprins May 31, 2023
0adc7b1
Fixed build errors
lucasprins May 31, 2023
c1ceacb
registation
The0Danktor May 31, 2023
b1af0fa
update
The0Danktor May 31, 2023
0468fd0
Update views.py
The0Danktor May 31, 2023
d276ea9
Update
lucasprins May 31, 2023
4f14c0d
updates
lucasprins May 31, 2023
2a36d69
Update
lucasprins May 31, 2023
79e43a4
update
lucasprins May 31, 2023
623ab4f
Update
lucasprins May 31, 2023
702c4b5
Added login/logout functionality and a dropdown menu on the header
lucasprins May 31, 2023
cfd5938
docker script fix
The0Danktor May 31, 2023
38ab1ef
Merge pull request #6 from HR-Project-D/dev
The0Danktor May 31, 2023
77c1c7e
Fixed an issue with the magic cards
lucasprins Jun 1, 2023
7f744d5
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
lucasprins Jun 1, 2023
47a3e92
page url
The0Danktor Jun 6, 2023
b4508c8
update
lucasprins Jun 6, 2023
7d9c5ff
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
lucasprins Jun 6, 2023
bc326c3
Create datasource.py
The0Danktor Jun 6, 2023
20b2faf
clone repository
The0Danktor Jun 6, 2023
0fd910e
update
lucasprins Jun 6, 2023
ea96cf4
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
lucasprins Jun 6, 2023
7bb5ec0
csv
lucasprins Jun 12, 2023
41c54d3
updates
The0Danktor Jun 13, 2023
501416f
Update Dockerfile
The0Danktor Jun 13, 2023
61ebbc0
Update apps.py
The0Danktor Jun 14, 2023
9bf7be1
asd
lucasprins Jun 14, 2023
89cfa04
Delete PDFDocument.tsx
lucasprins Jun 14, 2023
00fd828
Update apps.py
lucasprins Jun 14, 2023
a9a2bbd
test
The0Danktor Jun 14, 2023
be778ba
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor Jun 14, 2023
2e1c352
Update Dockerfile
The0Danktor Jun 14, 2023
0d5553f
Update apps.py
The0Danktor Jun 14, 2023
5239216
eindelijk goed in de hemel heeft mij zien smeken om vrijheid en hij z…
The0Danktor Jun 14, 2023
8bde550
Added data source creation to the front-end
lucasprins Jun 15, 2023
b0a633a
Update new.tsx
The0Danktor Jun 15, 2023
fae3451
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor Jun 15, 2023
1519a22
new datasource name verification
fabiothomas Jun 15, 2023
72380f5
empty
The0Danktor Jun 15, 2023
1022337
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor Jun 15, 2023
f29240d
Update .gitignore
The0Danktor Jun 15, 2023
d92d97a
Added validation to data source creation form
lucasprins Jun 15, 2023
b47cef7
django is goeie
The0Danktor Jun 15, 2023
4ff4857
Merge branch 'dev' of https://github.com/HR-Project-D/dependify into dev
The0Danktor Jun 15, 2023
5b0c817
puuuush
fabiothomas Jun 15, 2023
c003871
a
lucasprins Jun 15, 2023
bedc9c4
Update get data sources
lucasprins Jun 16, 2023
c0dbb64
Update views.py
lucasprins Jun 16, 2023
21d461d
delete and fetch data sources
lucasprins Jun 16, 2023
d12662c
revert
lucasprins Jun 16, 2023
1be24a2
hmmm, tempish solution
fabiothomas Jun 18, 2023
a640f83
major fixes to backend and scan
fabiothomas Jun 18, 2023
416332f
Update db.sqlite3
The0Danktor Jun 18, 2023
16bb1ee
Merge pull request #7 from HR-Project-D/dev
The0Danktor Jun 18, 2023
5f37135
Update version.txt
The0Danktor Jun 18, 2023
01f81f2
Merge branch 'main' of https://github.com/HR-Project-D/dependify
The0Danktor Jun 18, 2023
c530c44
docker kleiner maken
The0Danktor Jun 18, 2023
be41c42
Update .gitignore
The0Danktor Jun 19, 2023
f3d3a00
bugfixes
The0Danktor Jun 19, 2023
97fe3ad
jippy
The0Danktor Jun 19, 2023
2d727dd
Merge branch 'main' into dev
The0Danktor Jun 19, 2023
b6c982b
Merge pull request #8 from HR-Project-D/dev
The0Danktor Jun 19, 2023
331b4eb
Update Dockerfile
The0Danktor Jun 19, 2023
33a1184
bugfixes
The0Danktor Jun 19, 2023
8d669c0
Merge pull request #9 from HR-Project-D/dev
The0Danktor Jun 19, 2023
a11e87c
hoppelijk een fix
The0Danktor Jun 20, 2023
bc4324d
fix
The0Danktor Jun 20, 2023
b4f9db5
fixes
The0Danktor Jun 20, 2023
1c5c67f
version fix
fabiothomas Jun 20, 2023
74f5142
zonder print()
fabiothomas Jun 20, 2023
015698e
Merge branch 'main' into dev
The0Danktor Jun 20, 2023
51a84f4
inverted colors
lucasprins Jun 21, 2023
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
10 changes: 9 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@
*/*/.idea*
*/*/venv*
*/*/node_modules*
*/*/.next*
*/*/.next*
.gitignore
README.md
.dockerignore
.git

/backend/data/setup_key
/backend/data/keys*
/backend/data/sboms*
49 changes: 49 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docker Build

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update and upgrade packages
run: |
sudo apt-get update
sudo apt-get upgrade -y


- name: Remove conflicting packages
run: |
sudo apt-get remove -y moby-containerd containerd moby-runc runc

- name: Install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo systemctl start docker


- name: Build and push Docker image
env:
VERSION_FILE_PATH: 'version.txt' # Update with your version file path
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
VERSION=$(cat $VERSION_FILE_PATH)
TAG=latest

if [[ $VERSION != $TAG ]]; then
TAG=$VERSION
fi

docker build -t the0danktor/dependify:$TAG .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push the0danktor/dependify:$TAG
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

*.pyc
*.pyc
*.pyc
backend/.idea
*.pyc
*.pyc
backend/data/sboms
backend/data/keys
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"sqltools.connections": [
{
"previewLimit": 50,
"driver": "SQLite",
"name": "db",
"database": "${workspaceFolder:dependify}/backend/data/db.sqlite3"
}
],
"sqltools.useNodeRuntime": true
}
76 changes: 44 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,74 @@
# Stage 1: Node.js base image for Next.js
FROM node as nextjs
FROM node:18-alpine AS base

# Set the working directory
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Copy package.json and package-lock.json
COPY ./ui/package*.json ./
# Install dependencies based on the preferred package manager
COPY ui/package.json ui/yarn.lock* ui/package-lock.json* ui/pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi

# Install dependencies
RUN npm ci

# Copy the Next.js source code
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY ui/. .

# Build the Next.js application
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build

# Stage 2: Python base image for Django
FROM python as django

# Set the working directory
# Production image, copy all the files and run next
FROM nikolaik/python-nodejs:python3.8-nodejs18-slim AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# Copy requirements.txt
COPY ./backend/requirements.txt ./

# Copy the Django source code
COPY ./backend .

RUN apt-get update && apt-get install -y openssh-client && apt-get install -y git

RUN pip3 install -r requirements.txt

# Finally, combine the Next.js and Django stages
FROM node
VOLUME /app/data

# Expose the required ports (e.g., 3000 for Next.js, 8000 for Django)
EXPOSE 3000
EXPOSE 8000
# Set the working directory
WORKDIR /app

RUN apt-get update && apt-get install -y python3-pip

# Copy the built Next.js files from the "nextjs" stage
COPY --from=nextjs /app ./ui

# Copy the Django files from the "django" stage
COPY --from=django /app .

VOLUME /app/data

RUN pip3 install -r requirements.txt
ENV PORT 3000

COPY start_up.sh ./start_up.sh

RUN chmod +x ./start_up.sh

RUN python manage.py flush --no-input

# Start the Django server
#CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000" ,";","npm", "run", "start"]
CMD ./start_up.sh


CMD ./start_up.sh
29 changes: 26 additions & 3 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand All @@ -43,9 +43,9 @@
]

MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -85,6 +85,9 @@
}
}

# Authentication

AUTH_USER_MODEL = 'playground.CustomUser'

# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
Expand Down Expand Up @@ -127,6 +130,26 @@

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

CORS_ALLOWED_ORIGINS = [
# CORS

# CORS_ALLOWED_ORIGINS = [
# 'http://localhost:3000',
# 'http://127.0.0.1:3000',
# 'https://localhost:3000',
# 'https://127.0.0.1:3000',
# ]

CSRF_TRUSTED_ORIGINS = [
'http://localhost:3000',
'http://127.0.0.1:3000',
'https://localhost:3000',
'https://127.0.0.1:3000',
]

CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_CREDENTIALS = True

# Same site none
SESSION_COOKIE_SAMESITE = "Lax"

SESSION_COOKIE_SECURE = False
25 changes: 23 additions & 2 deletions backend/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,30 @@
from django.urls import path, include
from playground.views import Scan
from playground.views import Setup
from playground.views import SetupUserRegistration
from playground.views import UserRegistration
from playground.views import Login
from playground.views import Logout
from playground.views import User
from playground.views import IsSetup
from playground.views import Generate_datasource
from playground.views import Confirm_datasource
from playground.views import Get_datasource
from playground.views import Del_datasource

urlpatterns = [
path('admin/', admin.site.urls),
#path('admin/', admin.site.urls),
path ('api/scan/', Scan.as_view()),
path ('api/setup', Setup.as_view()),
path ('api/setup/', Setup.as_view()),
path ('api/setup_registration/', SetupUserRegistration.as_view()),
path ('api/registration/',UserRegistration.as_view()),
path ('api/login/',Login.as_view()),
path ('api/logout/',Logout.as_view()),
path ('api/user/',User.as_view()),
path ('api/is_setup/',IsSetup.as_view()),
path ('api/generate_datasource/',Generate_datasource.as_view()),
path ('api/confirm_datasource/',Confirm_datasource.as_view()),
path ('api/get_datasource/',Get_datasource.as_view()),
path ('api/del_datasource/',Del_datasource.as_view()),

]
Binary file modified backend/data/db.sqlite3
Binary file not shown.
1 change: 1 addition & 0 deletions backend/data/setup_key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lucaslucaslucas
22 changes: 22 additions & 0 deletions backend/functions/datasource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from git import Repo
import paramiko
from playground.models import newDataSource as DataSource
from django.apps import AppConfig

class FunctionsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'functions'

def ready(self):
clone_datasource('pw-demo-sboms')
def clone_datasource(name):
repo_path = '/data/sboms/'
datasource = DataSource.objects.get(name=name)
repo_url = datasource.url
key = datasource.key
repo = Repo.clone_from(repo_url, repo_path, key=key)


def fetch_datasource():
pass

Loading