Skip to content

Commit

Permalink
Release 0.2.6 (#24)
Browse files Browse the repository at this point in the history
* Added docker-compose for dev. Added dev build build and push job for dockerhub

* Moved cors layer to check if /api now is not guarded

* Added logging for error in response

* Removed too strict validation rules for credentials

* fix: x-subdmain was overwritten on correct request. Updated nginx-template and nginx now waits for server

* proxy-fix: New nginx config as the previous one failed with subdomain

* archive-fix: Remove skipping first component in path of entry. Zip archive should not containt root folder.

* assets-fix: Remove root folder inside zips to pass tests. The root dir is not skipped now due to previous commit

* tests-fix: enable logging to see error message in gh actions. Lokal tests work fine

* fmt: for tests

* tests-fix: disable logging to see error message in gh actions. That was gh issue

* fmt: remove unused import

* openapi-client: add build and publih with gh actions

* fix-deploy: nginx now waits for server in dev also

* fix-deploy: publsh to pypi
  • Loading branch information
clowzed authored Aug 5, 2024
1 parent b22e881 commit a86f6ba
Show file tree
Hide file tree
Showing 36 changed files with 1,411 additions and 1,338 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Test"

on:
push:
branches:
- "dev" # matches every branch

jobs:
push-to-registry:
name: "Build and push Docker image to Docker Hub"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3

- name: "Log in to Docker Hub"
uses: "docker/login-action@v2"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: "Build and push Docker image"
uses: "docker/build-push-action@v3"
with:
context: .
push: true
tags: clowzed/sero:dev-unstable
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,53 @@ jobs:
push: true
tags: clowzed/sero:v${{ needs.get-tag.outputs.pkg-version }}
labels: ${{ steps.meta.outputs.labels }}
upload-openapi-client:
needs:
- "push-to-registry"
name: "Build and upload openapi python client"
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install OpenAPI Generator CLI
run: |
npm install @openapitools/openapi-generator-cli -g
- name: Extract version from OpenAPI spec
id: extract_version
run: |
VERSION=$(jq -r '.info.version' openapi.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Generate Python client from OpenAPI spec
run: |
openapi-generator-cli generate -i openapi.json -g python -o seroapi --additional-properties=packageName=seroapi,packageVersion=${{ env.VERSION }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
cd seroapi
poetry install
- name: Publish to Test PyPI
run: |
cd seroapi
poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --build
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sero"
version = "0.2.5"
version = "0.2.6"
edition = "2021"
authors = ["clowzed <[email protected]>"]
description = "Muiltidomain static site hosting"
Expand Down
Binary file modified assets/zips/correct-1.zip
Binary file not shown.
Binary file modified assets/zips/correct-2.zip
Binary file not shown.
Binary file modified assets/zips/correct-3.zip
Binary file not shown.
Binary file modified assets/zips/correct-with-404.html.zip
Binary file not shown.
Binary file modified assets/zips/correct-with-503.html.zip
Binary file not shown.
Binary file modified assets/zips/correct-without-404.html.zip
Binary file not shown.
Binary file modified assets/zips/correct-without-503.html.zip
Binary file not shown.
69 changes: 69 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: "3"

services:
database:
image: postgres:16
user: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=sero
- POSTGRES_PASSWORD=1234

healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data


proxy:
image: nginx:alpine3.18-slim
environment:
- DOLLAR=$
- SERVER_PORT=8080
- SERVER=server
# Edit this
- DOMAIN=
- ZONE=
# End of edit
volumes:
- ./nginx-templates:/etc/nginx/templates
ports:
- 443:443
- 80:80
links:
- server
depends_on:
- server

server:
image: clowzed/sero:dev-unstable
build: .
depends_on:
database:
condition: service_healthy
volumes:
- server-files:/app/sites-uploads
ports:
- 8080:8080
environment:
- DATABASE_URL=postgresql://postgres:1234@database/sero
- PORT=8080
# You can edit this section
# Empty means no limits
- MAX_USERS=1
- MAX_SITES_PER_USER=100
- MAX_BODY_LIMIT_SIZE=10000000 # 10mb
- RUST_LOG=none,sero=trace
- JWT_SECRET=mysuperstrongjwtscret
# end of section
- JWT_TTL_SECONDS=120
- SQLX_LOGGING=true
- UPLOAD_FOLDER=./sites-uploads


volumes:
server-files:
pgdata:
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ services:
- 80:80
links:
- server
depends_on:
- server

server:
image: clowzed/sero
Expand Down
20 changes: 16 additions & 4 deletions nginx-templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
map $http_host $subdomain {
~^(?<subdomain>[a-zA-Z0-9-]+)\.${DOMAIN}\.${ZONE}${DOLLAR} $subdomain;
}

server {
listen 80;
server_name ~^(?<subdomain>[a-zA-Z0-9-]+)\.${DOMAIN}\.${ZONE}${DOLLAR};

location / {
proxy_set_header X-Subdomain $subdomain;
proxy_pass http://${SERVER}:${SERVER_PORT};
}
}

server {
listen 80;
server_name ~^(?<subdomain>\w*)\.${DOMAIN}.${ZONE}${DOLLAR};
server_name ${DOMAIN}.${ZONE};

location / {
# Always set the X-subdomain header with the value from the subdomain in the URL
proxy_set_header x-subdomain $subdomain;
proxy_pass http://${SERVER}:${SERVER_PORT}/;
proxy_pass http://${SERVER}:${SERVER_PORT};
}
}
Loading

0 comments on commit a86f6ba

Please sign in to comment.