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

Feat/pacsight #1012

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
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
d26ca1a
feat(parser): replace with new srcinfo parser
saenai255 Sep 16, 2024
de64462
feat: add missing fields
saenai255 Sep 17, 2024
375a8af
feat: update client models
saenai255 Sep 17, 2024
580f242
lint: code styles
saenai255 Sep 17, 2024
3cf80f7
fix: repology api recipe url
saenai255 Sep 17, 2024
c3890ec
upd(Dockerfile): remove no-longer-needed dependency
Elsie19 Sep 18, 2024
cb00700
feat: add git version
saenai255 Sep 18, 2024
5abd301
feat: fix repology exporter and default package update status
saenai255 Sep 18, 2024
c567f40
Merge branch 'master' into feat/replace-legacy-parser-with-srcinfo
saenai255 Sep 18, 2024
4bc3088
fix: allow longer versions on package search page
saenai255 Sep 20, 2024
ded6a9c
Merge branch 'feat/replace-legacy-parser-with-srcinfo' of https://git…
saenai255 Sep 20, 2024
080be6b
fix: add pkgrel to git version
saenai255 Sep 20, 2024
1c8f324
Merge branch 'master' into feat/replace-legacy-parser-with-srcinfo
saenai255 Sep 20, 2024
63e9250
Merge branch 'master' into feat/replace-legacy-parser-with-srcinfo
saenai255 Sep 21, 2024
b516196
fix: git version channel never exhausted
saenai255 Sep 21, 2024
a708073
feat: reorganize packages
saenai255 Sep 23, 2024
f881c79
chore: remove discord logs
saenai255 Sep 23, 2024
f35d8cc
chore: update docker compose
saenai255 Sep 23, 2024
a708d3a
chore: update infra and repology caching
saenai255 Sep 25, 2024
be33c9f
chore: remove unused env var
saenai255 Sep 25, 2024
bf83aad
refactor: Remove unnecessary log statements and improve error handlin…
saenai255 Sep 26, 2024
b992f8e
Merge branch 'master' of https://github.com/pacstall/website into fea…
saenai255 Sep 26, 2024
29e0a6b
Merge branch 'master' into feat/pacsight
saenai255 Sep 26, 2024
d4a0e93
Merge branch 'master' into feat/pacsight
oklopfer Oct 5, 2024
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
25 changes: 18 additions & 7 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.PUBLISH_PACKAGE_PAT }}

- name: Build Docker Images
- name: Build PacNexus Docker Images
run: |
docker build --build-arg version="${SHORT_SHA}-dev" --no-cache -t webserver .
docker tag webserver "ghcr.io/pacstall/webserver:$SHORT_SHA"
docker tag webserver ghcr.io/pacstall/webserver:development
docker build --build-arg version="${SHORT_SHA}-dev" --no-cache -t pacnexus pacnexus.Dockerfile
docker tag pacnexus "ghcr.io/pacstall/pacnexus:$SHORT_SHA"
docker tag pacnexus ghcr.io/pacstall/pacnexus:development

- name: Push Images
- name: Push PacNexus Images
run: |
docker push "ghcr.io/pacstall/webserver:$SHORT_SHA"
docker push ghcr.io/pacstall/webserver:development
docker push "ghcr.io/pacstall/pacnexus:$SHORT_SHA"
docker push ghcr.io/pacstall/pacnexus:development

- name: Build PacSight Docker Images
run: |
docker build --build-arg version="${SHORT_SHA}-dev" --no-cache -t pacsight pacsight.Dockerfile
docker tag pacsight "ghcr.io/pacstall/pacsight:$SHORT_SHA"
docker tag pacsight ghcr.io/pacstall/pacsight:development

- name: Push PacSight Images
run: |
docker push "ghcr.io/pacstall/pacsight:$SHORT_SHA"
docker push ghcr.io/pacstall/pacsight:development
25 changes: 18 additions & 7 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.PUBLISH_PACKAGE_PAT }}

- name: Build Docker image
- name: Build PacNexus Docker image
run: |
docker build --build-arg VITE_VERSION="${{ github.event.inputs.version }}" --no-cache -t webserver .
docker tag webserver "ghcr.io/pacstall/webserver:${{ github.event.inputs.version }}"
docker tag webserver ghcr.io/pacstall/webserver:latest
docker build --build-arg VITE_VERSION="${{ github.event.inputs.version }}" --no-cache -t pacnexus pacnexus.Dockerfile
docker tag pacnexus "ghcr.io/pacstall/pacnexus:${{ github.event.inputs.version }}"
docker tag pacnexus ghcr.io/pacstall/pacnexus:latest

- name: Push Image
- name: Build PacSight Docker image
run: |
docker push "ghcr.io/pacstall/webserver:${{ github.event.inputs.version }}"
docker push ghcr.io/pacstall/webserver:latest
docker build --build-arg VITE_VERSION="${{ github.event.inputs.version }}" --no-cache -t pacsight pacsight.Dockerfile
docker tag pacsight "ghcr.io/pacstall/pacsight:${{ github.event.inputs.version }}"
docker tag pacsight ghcr.io/pacstall/pacsight:latest

- name: Push PacNexus Image
run: |
docker push "ghcr.io/pacstall/pacnexus:${{ github.event.inputs.version }}"
docker push ghcr.io/pacstall/pacnexus:latest

- name: Push PacSight Image
run: |
docker push "ghcr.io/pacstall/pacsight:${{ github.event.inputs.version }}"
docker push ghcr.io/pacstall/pacsight:latest
18 changes: 14 additions & 4 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
version: '3.2'

services:

mariadb:
image: mariadb
# inherited from docker-compose.yml
webserver:
pacnexus:
# overrides the image used from docker-compose.yml
build:
context: .
dockerfile: pacnexus.Dockerfile
args:
VITE_VERSION: "${VITE_VERSION}"
environment:
PACSTALL_LOG_LEVEL: "debug"
# inherited from docker-compose.yml
pacsight:
# overrides the image used from docker-compose.yml
build:
context: .
dockerfile: Dockerfile
dockerfile: pacsight.Dockerfile
args:
VITE_VERSION: "${VITE_VERSION}"
environment:
PACSTALL_LOG_LEVEL: "debug"
# inherited from docker-compose.yml

matomo:
Expand Down
31 changes: 23 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.2'

services:

mariadb:
Expand All @@ -14,7 +12,7 @@ services:
- target: 3306
published: 3306

webserver:
pacnexus:
image: ghcr.io/pacstall/webserver:latest
depends_on:
- mariadb
Expand All @@ -28,10 +26,8 @@ services:
max-file: "5"
max-size: "10m"
environment:
PACSTALL_DISCORD_TOKEN: ""
PACSTALL_DISCORD_CHANNEL_ID: ""
PACSTALL_DISCORD_ENABLED: "false"
PACSTALL_DISCORD_TAGS: "" # See https://discord.com/developers/docs/reference#message-formatting
PACSTALL_PACSIGHT_PORT: 3301
PACSTALL_PACSIGHT_HOST: pacsight
PACSTALL_DATABASE_HOST: mariadb
PACSTALL_DATABASE_USER: root
PACSTALL_DATABASE_PASSWORD: changeme
Expand All @@ -40,7 +36,25 @@ services:
PACSTALL_MATOMO_ENABLED: "true"
MATOMO_DOMAIN: "http://matomo"
MATOMO_SITE_ID: "1"
PACSTALL_PROGRAMS_GIT_BRANCH: "master"
PACSTALL_LOG_LEVEL: "info"

pacsight:
image: ghcr.io/pacstall/pacsight:latest
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
environment:
PACSTALL_PACSIGHT_PORT: 3301
PACSTALL_REPOLOGY_CACHE_PATH: "/var/cache/pacsight"
PACSTALL_LOG_LEVEL: "info"
deploy:
resources:
limits:
memory: 6g
volumes:
- pacsight_cache:/var/cache/pacsight

matomo:
image: matomo
Expand All @@ -60,3 +74,4 @@ services:
volumes:
db:
matomo:
pacsight_cache:
2 changes: 1 addition & 1 deletion Dockerfile → pacnexus.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ WORKDIR /root/dist/

RUN ls -al /root/dist

CMD echo "Starting webserver in a few seconds..." && sleep 3 && "./webserver"
CMD echo "Starting pacnexus in a few seconds..." && sleep 3 && "./pacnexus"
EXPOSE 3300
31 changes: 31 additions & 0 deletions pacsight.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1.23-alpine AS server

ARG VITE_VERSION
ENV VITE_VERSION="${VITE_VERSION}"
ENV NODE_ENV="production"

WORKDIR /root/

COPY ./server ./server

RUN apk add --no-cache make gcc musl-dev

WORKDIR /root/server
RUN make dist/pacsight

FROM ubuntu:22.04
WORKDIR /root/

RUN apt update
RUN apt install wget curl -y

COPY --from=server /root/server/dist/ /root/server/dist/

RUN apt update && apt install make git jq -y

WORKDIR /root/server/dist

RUN ls -al /root/server/dist

CMD "./pacsight"
EXPOSE 8080
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tmp/
dist/
programs/
main
repology_cache.json
82 changes: 29 additions & 53 deletions server/Makefile
Original file line number Diff line number Diff line change
@@ -1,69 +1,45 @@
LDFLAGS= \
-w \
-s \
-X 'pacstall.dev/webserver/config/build.UpdateInterval=900' \
-X 'pacstall.dev/webserver/config/build.TempDir=./tmp' \
-X 'pacstall.dev/webserver/config/build.MaxOpenFiles=100' \
-X 'pacstall.dev/webserver/config/build.Port=3300' \
-X 'pacstall.dev/webserver/config/build.PublicDir=./public' \
-X 'pacstall.dev/webserver/config/build.Production=true' \
-X 'pacstall.dev/webserver/config/build.GitURL=https://github.com/pacstall/pacstall-programs.git' \
-X 'pacstall.dev/webserver/config/build.GitClonePath=./programs' \
-X 'pacstall.dev/webserver/config/build.Version=${VERSION}'
-X 'pacstall.dev/webserver/pkg/common/config/build.Production=true' \
-X 'pacstall.dev/webserver/pkg/common/config/build.Version=${VERSION}'

all: dist/webserver
all: dist/pacnexus dist/pacsight

test:
PACSTALL_DATABASE_HOST=localhost \
PACSTALL_DATABASE_PORT=3306 \
PACSTALL_DATABASE_USER=root \
PACSTALL_DATABASE_PASSWORD=changeme \
PACSTALL_DATABASE_NAME=pacstall \
PACSTALL_DISCORD_ENABLED=false \
PACSTALL_DISCORD_TOKEN="" \
PACSTALL_DISCORD_CHANNEL_ID="" \
PACSTALL_DISCORD_TAGS="" \
PACSTALL_MATOMO_ENABLED="false" \
PACSTALL_REPOLOGY_ENABLED="false" \
PACSTALL_PROGRAMS_GIT_BRANCH="master" \
GO_ENV=test go test -v types/pac/parser/parse_test.go

test_internal:
PACSTALL_DATABASE_HOST=localhost \
PACSTALL_DATABASE_PORT=3306 \
PACSTALL_DATABASE_USER=root \
PACSTALL_DATABASE_PASSWORD=changeme \
PACSTALL_DATABASE_NAME=pacstall \
PACSTALL_DISCORD_ENABLED=false \
PACSTALL_DISCORD_TOKEN="" \
PACSTALL_DISCORD_CHANNEL_ID="" \
PACSTALL_DISCORD_TAGS="" \
PACSTALL_MATOMO_ENABLED="false" \
PACSTALL_REPOLOGY_ENABLED="false" \
PACSTALL_PROGRAMS_GIT_BRANCH="master" \
GO_ENV=test go test -v types/pac/parser/pacsh/internal/git_version_test.go

run:
(cd .. && docker compose up -d mariadb)
run-database:
@(cd .. && docker compose up -d mariadb)

PACSTALL_DATABASE_HOST=localhost \
PACSTALL_DATABASE_PORT=3306 \
PACSTALL_DATABASE_USER=root \
PACSTALL_DATABASE_PASSWORD=changeme \
PACSTALL_DATABASE_NAME=pacstall \
PACSTALL_DISCORD_ENABLED=false \
PACSTALL_DISCORD_TOKEN="" \
PACSTALL_DISCORD_CHANNEL_ID="" \
PACSTALL_DISCORD_TAGS="" \
PACSTALL_MATOMO_ENABLED="false" \
PACSTALL_REPOLOGY_ENABLED="false" \
PACSTALL_PROGRAMS_GIT_BRANCH="master" \
go run bin/webserver/main.go
run-pacnexus: run-database
@go run cmd/pacnexus/main.go

run-pacsight:
@go run cmd/pacsight/main.go


run:
@trap 'kill 0' SIGINT; \
$(MAKE) run-pacsight | sed 's/^/[pacsight] /' & \
$(MAKE) run-pacnexus | sed 's/^/[pacnexus] /' & \
wait
@echo "Both executables completed or interrupted."

dist/pacnexus: $(shell find . -not \( -path ./tmp -prune \) -not \( -path ./dist -prune \) -type f)
CGO_ENABLED=0 go build -o dist/pacnexus -ldflags "${LDFLAGS}" cmd/pacnexus/main.go

dist/pacsight: $(shell find . -not \( -path ./tmp -prune \) -not \( -path ./dist -prune \) -type f)
CGO_ENABLED=0 go build -o dist/pacsight -ldflags "${LDFLAGS}" cmd/pacsight/main.go

dist/webserver: $(shell find . -not \( -path ./tmp -prune \) -not \( -path ./dist -prune \) -type f)
CGO_ENABLED=0 go build -o dist/webserver -ldflags "${LDFLAGS}" bin/webserver/main.go
clean:
[ -d ./dist ] && rm -r dist || :
@[ -d ./dist ] && rm -rf dist || :
@[ -d ./programs ] && rm -rf programs || :
@[ -d ./tmp ] && rm -rf tmp || :
@echo "Cleaned up."

fmt:
go fmt ./...
84 changes: 0 additions & 84 deletions server/bin/webserver/main.go

This file was deleted.

Loading