Skip to content

Commit

Permalink
feat: fix everything, basically (maybe)
Browse files Browse the repository at this point in the history
  • Loading branch information
OptimusCrime committed Sep 24, 2024
1 parent 0f0e04e commit 9920861
Show file tree
Hide file tree
Showing 111 changed files with 10,404 additions and 12,452 deletions.
37 changes: 12 additions & 25 deletions .github/workflows/youkok2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: youkok2
on:
push:
branches: master
branches: main
pull_request:

jobs:
Expand All @@ -14,7 +14,8 @@ jobs:
##############################################################

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get release version
id: get_version
run: echo "name=RELEASE_VERSION::$(echo $GITHUB_SHA | cut -c1-8)" >> $GITHUB_ENV
Expand All @@ -24,18 +25,20 @@ jobs:
##############################################################

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '12.x'
node-version-file: ./frontend/.nvmrc

- name: Build site frontend
run: |
cd frontend
npm ci
npm i --force
npm run build:production
- name: Build admin frontend
run: |
cd frontend-admin
npm ci
npm i --force
npm run build:production
##############################################################
Expand All @@ -45,8 +48,9 @@ jobs:
- name: Setup PHP with specific version of PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.3.11'
tools: composer

- name: Install site backend dependencies
run: |
cd youkok2
Expand All @@ -68,6 +72,7 @@ jobs:
dockerfile: docker_nginx.Dockerfile
buildargs: ENV
tags: "latest,${{ env.RELEASE_VERSION }}"

- name: Build and publish php to Registry
uses: elgohr/Publish-Docker-Github-Action@master
env:
Expand All @@ -79,21 +84,3 @@ jobs:
dockerfile: docker_php.Dockerfile
buildargs: ENV,COMPOSER_ALLOW_SUPERUSER
tags: "latest,${{ env.RELEASE_VERSION }}"
- name: Build and publish db to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: optimuscrime/youkok2-migrations
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: docker_migrations.Dockerfile
tags: "latest,${{ env.RELEASE_VERSION }}"

# Uncomment to build new database image
#- name: Build and publish db to Registry
# uses: elgohr/Publish-Docker-Github-Action@master
# with:
# name: optimuscrime/youkok2-db
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# dockerfile: docker_db.Dockerfile
# tags: "latest,${{ env.RELEASE_VERSION }}"
27 changes: 20 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
Youkok2 - 6.0.0-pl (?????)
=================================
Youkok2 - 6.0.0-pl (23. september 2024)
=======================================

- [Info] Overhaul
- [Change] Erstatte MySQL med Postgres
- [Upgrade] PHP 8.3
- [Upgrade] Slim4
- [Upgrade] Node18
- [Info] Fixxes
- [Change] MySQL -> Postgres
- [Upgrade] PHP 7.4 -> PHP 8.3
- [Upgrade] Slim 3 -> Slim 4
- [Upgrade] Node 12 -> Node 18 (kunne godt ha oppgradert mer, men fikk problemer med noen deps)
- [Removal] Fjernet oppsettet med migrasjoner helt, fordi det ikke var nødvendig.
- [Removal] Fjernet pools, som var totalt unødvendig.
- [Removal] Alle spørringer henter nå alle attributter i `elements`-tabellen.
- [Removal] Variabler på model-klassene, som bare lagde problemer.
- [Improvement] Forbedret logging av feilmeldinger i stede for å legge exceptions til default error
- handler.
- [Improvement] Forenklet caching drastisk.
- [Improvement] Caching av hele output-payload, for å redusere unødvendig arbeid.
- [Change] Drastisk forenklet og redusert hvordan vi logger nedlastninger, som gjør at databasen
blir mye mindre, og spørringene blir enklere.
- [Fix] Antall nedlastninger per fag reflekteres nå i sanntid.
- [New] Implementert enklere system for å logge antall nedlastninger per dag, uke, mnd, og år.
- [New] Nedtelling på toppen av siden til sunset av Youkok2.com.

Youkok2 - 5.0.1-pl (3. mars 2021)
=================================
Expand Down
31 changes: 31 additions & 0 deletions _docker/db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE TABLE element (
id serial PRIMARY KEY,
name TEXT NOT NULL,
slug TEXT NULL DEFAULT NULL,
uri TEXT NULL,
parent INT NULL,
empty BOOL NOT NULL,
checksum TEXT NULL,
size INT NULL,
directory BOOL NOT NULL,
pending BOOL NOT NULL,
deleted BOOL NOT NULL,
link TEXT NULL,
added timestamptz NOT NULL DEFAULT now(),
requested_deletion BOOL NOT NULL,
downloads_today INT NOT NULL DEFAULT 0,
downloads_week INT NOT NULL DEFAULT 0,
downloads_month INT NOT NULL DEFAULT 0,
downloads_year INT NOT NULL DEFAULT 0,
downloads_all INT NOT NULL DEFAULT 0,
last_visited timestamptz NULL DEFAULT NULL,
last_downloaded timestamptz NULL DEFAULT NULL
);

CREATE TABLE download (
element INT NOT NULL,
date DATE NOT NULL,
downloads INT NOT NULL
);

ALTER TABLE download ADD PRIMARY KEY (element, date);
29 changes: 27 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,33 @@ services:
container_name: "youkok2_php_dev"
ports:
- "9000"
env_file:
- env_php_dev.env
environment:
DEV: 'true'
SSL: 'false'

DIRECTORY_TEMPLATE: '/code/site/templates/'
DIRECTORY_FILES: '/code/files/'

DB_HOST: 'youkok2-db'
DB_USER: 'youkok2'
DB_PASSWORD: 'youkok2'
DB_DATABASE: 'postgres'

REDIS_HOST: 'youkok2-cache'
REDIS_PORT: '6379'

FILE_UPLOAD_MAX_SIZE_IN_BYTES: '10000000'
FILE_UPLOAD_ALLOWED_TYPES: 'pdf,txt,java,py,html,htm,sql'

ADMIN_COOKIE: 'foobar'

# Password is admin for the first input field, and the other fields are empty
ADMIN_PASS1: '$$2y$$10$$HQw8J9SNuqTb6s3YSdto9OWPaNORYkIRypJ8uX5UkKS5Fn32Yzwmu'
ADMIN_PASS2: '$$2y$$10$$wht6JZryFVCUMUi9qmPegOaETImo64e0oTrUMkWExslBVzoNecqC2'
ADMIN_PASS3: '$$2y$$10$$wht6JZryFVCUMUi9qmPegOaETImo64e0oTrUMkWExslBVzoNecqC2'
ADMIN_PASS4: '$$2y$$10$$wht6JZryFVCUMUi9qmPegOaETImo64e0oTrUMkWExslBVzoNecqC2'
ADMIN_PASS5: '$$2y$$10$$wht6JZryFVCUMUi9qmPegOaETImo64e0oTrUMkWExslBVzoNecqC2'
ADMIN_PASS6: '$$2y$$10$$wht6JZryFVCUMUi9qmPegOaETImo64e0oTrUMkWExslBVzoNecqC2'
volumes:
- ./youkok2:/code/site
- ./_docker/files:/code/files
Expand Down
7 changes: 0 additions & 7 deletions env_db_dev.env

This file was deleted.

13 changes: 0 additions & 13 deletions env_php_dev.env

This file was deleted.

16 changes: 1 addition & 15 deletions frontend-admin/.babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": "58",
"ie": "11"
}
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
"presets": ["@babel/env", "@babel/react"]
}
1 change: 1 addition & 0 deletions frontend-admin/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.12.0
Loading

0 comments on commit 9920861

Please sign in to comment.