Compare commits
No commits in common. "903ef732804ba9d0b9bf2a414697d62cb9c696db" and "837721fd7b41c7a2b09ec17c09c4bad4e1a937b7" have entirely different histories.
903ef73280
...
837721fd7b
@ -1,42 +0,0 @@
|
|||||||
# Maintainer: samicrusader <hi@samicrusader.me>
|
|
||||||
# Maintainer: Oscar Krause <oscar.krause@collinwebdesigns.de>
|
|
||||||
|
|
||||||
pkgname=fastapi-dls
|
|
||||||
pkgver=1.0
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc='NVIDIA DLS server implementation with FastAPI'
|
|
||||||
arch=('any')
|
|
||||||
url='https://git.collinwebdesigns.de/oscar.krause/fastapi-dls'
|
|
||||||
license=('MIT')
|
|
||||||
depends=('python' 'python-jose' 'python-starlette' 'python-httpx' 'python-fastapi' 'python-dotenv' 'python-dateutil' 'python-sqlalchemy' 'python-pycryptodome' 'uvicorn' 'python-markdown' 'openssl')
|
|
||||||
provider=("$pkgname")
|
|
||||||
install="$pkgname.install"
|
|
||||||
source=('git+file:///builds/oscar.krause/fastapi-dls' # https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
|
|
||||||
"$pkgname.default"
|
|
||||||
"$pkgname.service")
|
|
||||||
sha256sums=('SKIP'
|
|
||||||
'd8b2216b67a2f8f35ad6f07c825839794f7c34456a72caadd9fc110810348d90'
|
|
||||||
'10cb98d64f8bf37b11a60510793c187cc664e63c895d1205781c21fa2e703f32')
|
|
||||||
|
|
||||||
check() {
|
|
||||||
cd "$srcdir/$pkgname/test"
|
|
||||||
mkdir "$srcdir/$pkgname/app/cert"
|
|
||||||
openssl genrsa -out "$srcdir/$pkgname/app/cert/instance.private.pem" 2048
|
|
||||||
openssl rsa -in "$srcdir/$pkgname/app/cert/instance.private.pem" -outform PEM -pubout -out "$srcdir/$pkgname/app/cert/instance.public.pem"
|
|
||||||
python "$srcdir/$pkgname/test/main.py"
|
|
||||||
rm -rf "$srcdir/$pkgname/app/cert"
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
install -d "$pkgdir/usr/share/doc/$pkgname"
|
|
||||||
install -d "$pkgdir/var/lib/$pkgname/cert"
|
|
||||||
cp -r "$srcdir/$pkgname/doc"/* "$pkgdir/usr/share/doc/$pkgname/"
|
|
||||||
install -Dm644 "$srcdir/$pkgname/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
|
|
||||||
|
|
||||||
sed -i "s/README.md/\/usr\/share\/doc\/$pkgname\/README.md/g" "$srcdir/$pkgname/app/main.py"
|
|
||||||
sed -i "s/join(dirname(__file__), 'cert\//join('\/var\/lib\/$pkgname', 'cert\//g" "$srcdir/$pkgname/app/main.py"
|
|
||||||
install -Dm755 "$srcdir/$pkgname/app/main.py" "$pkgdir/opt/$pkgname/main.py"
|
|
||||||
install -Dm755 "$srcdir/$pkgname/app/orm.py" "$pkgdir/opt/$pkgname/orm.py"
|
|
||||||
install -Dm644 "$srcdir/$pkgname.default" "$pkgdir/etc/default/$pkgname"
|
|
||||||
install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
# Toggle FastAPI debug mode
|
|
||||||
DEBUG=false
|
|
||||||
|
|
||||||
# Where the client can find the DLS server
|
|
||||||
## DLS_URL should be a hostname
|
|
||||||
DLS_URL="localhost.localdomain"
|
|
||||||
DLS_PORT=8443
|
|
||||||
CORS_ORIGINS="https://$DLS_URL:$DLS_PORT"
|
|
||||||
|
|
||||||
# Lease expiration in days
|
|
||||||
LEASE_EXPIRE_DAYS=90
|
|
||||||
|
|
||||||
# Database location
|
|
||||||
## See https://dataset.readthedocs.io/en/latest/quickstart.html for details
|
|
||||||
DATABASE="sqlite:////var/lib/fastapi-dls/db.sqlite"
|
|
||||||
|
|
||||||
# UUIDs for identifying the instance
|
|
||||||
SITE_KEY_XID="<<sitekey>>"
|
|
||||||
INSTANCE_REF="<<instanceref>>"
|
|
||||||
|
|
||||||
# Site-wide signing keys
|
|
||||||
INSTANCE_KEY_RSA="/var/lib/fastapi-dls/instance.private.pem"
|
|
||||||
INSTANCE_KEY_PUB="/var/lib/fastapi-dls/instance.public.pem"
|
|
@ -1,14 +0,0 @@
|
|||||||
post_install() {
|
|
||||||
sed -i "s/<<sitekey>>/$(uuidgen)/" /etc/default/fastapi-dls
|
|
||||||
sed -i "s/<<instanceref>>/$(uuidgen)/" /etc/default/fastapi-dls
|
|
||||||
|
|
||||||
echo 'The environment variables for this server can be edited at: /etc/default/fastapi-dls'
|
|
||||||
echo 'The server can be started with: systemctl start fastapi-dls.service'
|
|
||||||
echo
|
|
||||||
echo 'A valid HTTPS certificate needs to be installed to /var/lib/fastapi-dls/cert/webserver.{crt,key}'
|
|
||||||
echo 'A self-signed certificate can be generated with: openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /var/lib/fastapi-dls/cert/webserver.key -out /var/lib/fastapi-dls/cert/webserver.crt'
|
|
||||||
echo
|
|
||||||
echo 'The signing keys for your instance need to be generated as well. Generate them with these commands:'
|
|
||||||
echo 'openssl genrsa -out /var/lib/fastapi-dls/instance.private.pem 2048'
|
|
||||||
echo 'openssl rsa -in /var/lib/fastapi-dls/instance.private.pem -outform PEM -pubout -out /var/lib/fastapi-dls/instance.public.pem'
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=FastAPI-DLS
|
|
||||||
Documentation=https://git.collinwebdesigns.de/oscar.krause/fastapi-dls
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
EnvironmentFile=/etc/default/fastapi-dls
|
|
||||||
ExecStart=/usr/bin/python /opt/fastapi-dls/main.py
|
|
||||||
WorkingDir=/opt/fastapi-dls
|
|
||||||
Restart=on-abort
|
|
||||||
User=root
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -15,15 +15,17 @@ build:docker:
|
|||||||
- docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
- docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
||||||
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
||||||
|
|
||||||
build:apt:
|
build:package:
|
||||||
|
# debian:bullseye-slim
|
||||||
image: debian:bookworm-slim # just to get "python3-jose" working
|
image: debian:bookworm-slim # just to get "python3-jose" working
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -qq && apt-get install -qq -y build-essential
|
- apt-get update -qq && apt-get install -qq -y build-essential
|
||||||
|
- chmod 0755 -R .
|
||||||
# create build directory for .deb sources
|
# create build directory for .deb sources
|
||||||
- mkdir build
|
- mkdir build
|
||||||
# copy install instructions
|
# copy install instructions
|
||||||
- cp -r .DEBIAN build/DEBIAN
|
- cp -r DEBIAN build/
|
||||||
# copy app into "/usr/share/fastapi-dls" as "/usr/share/fastapi-dls/app" & copy README.md and version.env
|
# copy app into "/usr/share/fastapi-dls" as "/usr/share/fastapi-dls/app" & copy README.md and version.env
|
||||||
- mkdir -p build/usr/share/fastapi-dls
|
- mkdir -p build/usr/share/fastapi-dls
|
||||||
- cp -r app build/usr/share/fastapi-dls
|
- cp -r app build/usr/share/fastapi-dls
|
||||||
@ -40,31 +42,6 @@ build:apt:
|
|||||||
paths:
|
paths:
|
||||||
- build/build.deb
|
- build/build.deb
|
||||||
|
|
||||||
build:pamac:
|
|
||||||
image: archlinux:base-devel
|
|
||||||
stage: build
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == "archlinux-makepkg"
|
|
||||||
before_script:
|
|
||||||
- pacman -Syu --noconfirm git
|
|
||||||
# "makepkg" don't likes root user
|
|
||||||
- useradd --no-create-home --shell=/bin/false build && usermod -L build
|
|
||||||
- 'echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
|
||||||
- 'echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
|
||||||
- chown -R build:build .
|
|
||||||
# move .PKGBUILD contents to root directory
|
|
||||||
- mv .PKGBUILD/* .
|
|
||||||
script:
|
|
||||||
- pwd
|
|
||||||
# download dependencies
|
|
||||||
- source PKGBUILD && pacman -Syu --noconfirm --needed --asdeps "${makedepends[@]}" "${depends[@]}"
|
|
||||||
# build
|
|
||||||
- sudo -u build makepkg -s
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- "*.pkg.tar.zst"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: python:3.10-slim-bullseye
|
image: python:3.10-slim-bullseye
|
||||||
stage: test
|
stage: test
|
||||||
@ -83,7 +60,7 @@ test:
|
|||||||
.test:linux:
|
.test:linux:
|
||||||
stage: test
|
stage: test
|
||||||
needs:
|
needs:
|
||||||
- job: build:apt
|
- job: build:package
|
||||||
artifacts: true
|
artifacts: true
|
||||||
variables:
|
variables:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
@ -143,17 +120,17 @@ deploy:docker:
|
|||||||
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION}
|
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION}
|
||||||
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest
|
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest
|
||||||
|
|
||||||
deploy:apt:
|
deploy:debian:
|
||||||
# doc: https://git.collinwebdesigns.de/help/user/packages/debian_repository/index.md#install-a-package
|
# doc: https://git.collinwebdesigns.de/help/user/packages/debian_repository/index.md#install-a-package
|
||||||
image: debian:bookworm-slim
|
image: debian:bookworm-slim
|
||||||
stage: deploy
|
stage: deploy
|
||||||
rules:
|
rules:
|
||||||
#- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
#- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
- changes:
|
- changes:
|
||||||
- .DEBIAN/**/*
|
- DEBIAN/**/*
|
||||||
- app/**/*
|
- app/**/*
|
||||||
needs:
|
needs:
|
||||||
- job: build:apt
|
- job: build:package
|
||||||
artifacts: true
|
artifacts: true
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -qq && apt-get install -qq -y curl lsb-release
|
- apt-get update -qq && apt-get install -qq -y curl lsb-release
|
||||||
|
Loading…
Reference in New Issue
Block a user