Skip to content

Commit 9fb443f

Browse files
authored
Renovation (#52)
* Add initial set of files * Add webapp packages * basic migration * refactoring controllers, services and templates * refactor tag controller * refactor filter controller * cleanup warnings * fix createClient in Tests and add config for production * remove old app * update gitignore * update gitignore * update gitignore * update envtest * create db before running tests * typo * use default config for tests * cleanup and README * add config for production * Update renovate.json
1 parent 3f77419 commit 9fb443f

File tree

231 files changed

+12616
-35620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+12616
-35620
lines changed

.env

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=d2d042ee55407f84e3c67959d5cb7d74
20+
###< symfony/framework-bundle ###
21+
22+
###> doctrine/doctrine-bundle ###
23+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
24+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
25+
#
26+
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
27+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
28+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
29+
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
30+
###< doctrine/doctrine-bundle ###
31+
32+
###> symfony/messenger ###
33+
# Choose one of the transports below
34+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
35+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
36+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
37+
###< symfony/messenger ###
38+
39+
###> symfony/mailer ###
40+
MAILER_DSN=null://null
41+
###< symfony/mailer ###

.env.prod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='${APP_PROD_SECRET}'
4+
DATABASE_URL="${DATABASE_PROD_URL"

.env.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER='max[total]=320'
5+
DATABASE_URL="sqlite:///%kernel.project_dir%/var/testdata.db"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.3'
23+
extensions: mbstring, intl, pdo_mysql
24+
ini-values: post_max_size=256M, upload_max_filesize=256M, memory_limit=2G
25+
coverage: none
26+
27+
- name: Install dependencies
28+
run: composer install --prefer-dist --no-progress --no-suggest
29+
30+
- name: create test database
31+
run: php bin/console doctrine:schema:create --env=test
32+
33+
- name: Run tests
34+
run: vendor/bin/phpunit
35+
36+
deploy:
37+
runs-on: ubuntu-latest
38+
needs: test
39+
if: github.ref == 'refs/heads/main'
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Set up PHP
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: '8.3'
49+
extensions: mbstring, intl, pdo_mysql
50+
ini-values: post_max_size=256M, upload_max_filesize=256M, memory_limit=2G
51+
coverage: none
52+
53+
- name: Install dependencies
54+
run: composer install --no-dev --optimize-autoloader
55+
56+
- name: Set up environment
57+
run: cp .env.prod .env
58+
59+
- name: Build assets
60+
run: php bin/console assets:install
61+
62+
- name: Clear and warm up cache
63+
run: |
64+
php bin/console cache:clear --env=prod
65+
php bin/console cache:warmup --env=prod
66+
67+
- name: Publish
68+
uses: nogsantos/[email protected]
69+
with:
70+
src: ./public/*
71+
host: ${{ secrets.SSH_HOST }}
72+
remote: ${{ secrets.SSH_DIR }}
73+
port: ${{ secrets.SSH_PORT }}
74+
user: ${{ secrets.SSH_USER }}
75+
key: ${{ secrets.SSH_KEY }}

.github/workflows/php.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.gitignore

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,55 @@
1-
.DS_Store
2-
.idea
3-
/web/bundles/
4-
/app/bootstrap.php.cache
1+
# Cache and logs (Symfony2)
52
/app/cache/*
6-
/app/config/parameters.yml
73
/app/logs/*
84
!app/cache/.gitkeep
95
!app/logs/.gitkeep
10-
/build/
6+
7+
# Email spool folder
8+
/app/spool/*
9+
10+
# Cache, session files and logs (Symfony3)
11+
/var/cache/*
12+
/var/logs/*
13+
/var/sessions/*
14+
!var/cache/.gitkeep
15+
!var/logs/.gitkeep
16+
!var/sessions/.gitkeep
17+
18+
# Logs (Symfony4)
19+
/var/log/*
20+
!var/log/.gitkeep
21+
22+
# Parameters
23+
/app/config/parameters.yml
24+
/app/config/parameters.ini
25+
26+
# Managed by Composer
27+
/app/bootstrap.php.cache
28+
/var/bootstrap.php.cache
29+
/bin/*
30+
!bin/console
31+
!bin/symfony_requirements
1132
/vendor/
12-
/bin/
33+
/assets/vendor
34+
35+
# Assets and user uploads
36+
/web/bundles/
37+
/web/uploads/
38+
39+
# PHPUnit
40+
/app/phpunit.xml
41+
/phpunit.xml
42+
43+
# Build data
44+
/build/
45+
46+
# Composer PHAR
1347
/composer.phar
14-
/app/linksink.sqlite3
15-
/web/css/semantic.css
16-
/web/js/semantic.js
17-
/web/css/selectize.css
18-
/web/js/selectize.min.js
19-
/web/js/jquery-3.1.1.js
20-
/web/js/eafcfb3_link_forms_2.js
21-
/web/js/5b9502f.js
22-
/web/js/b52b22d.js
23-
/web/js/e099042_link_forms_2.js
24-
/web/js/ef25d48.js
25-
/web/js/695a482_links_2.js
26-
/web/js/695a482_link_forms_1.js
27-
/web/js/e099042.js
28-
/web/js/e099042_links_3.js
29-
/web/js/ef25d48_links_1.js
30-
/web/js/eafcfb3.js
31-
/web/js/selectize.js
32-
/web/js/e099042_jquery-ui.min_1.js
33-
/web/js/695a482.js
34-
/web/js/eafcfb3_links_1.js
48+
49+
# Backup entities generated with doctrine:generate:entities command
50+
**/Entity/*~
51+
52+
# Embedded web-server pid file
53+
/.web-server-pid
54+
55+
.idea

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

INSTALL.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 19 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
1-
Freifunk LinkSink
2-
=================
1+
# linksink
32

4-
Mit diesem Dienst ist es möglich, Links zu sammeln, zu kategorisieren und mit Hilfe von Tags verschiedenen Themengebieten zuzuordnen. Somit ist es möglich, Links aus verschiedenen Quellen zusammenzutragen und damit z.B. einen Pressespiegel zu erstellen. Ein weiterer Anwendungsfall ist das Sammeln von Podcasts, die zu einem neuen Feed zusammengeführt werden.
3+
## Requirements
54

6-
Nach Kategorien, Erscheinungsjahr oder Tags kann gefiltert werden. Aus diesen Filterergebnissen lassen sich RSS-Feeds ableiten.
5+
- PHP 8.0 or higher
6+
- Composer
7+
- SQLite (or another database supported by Doctrine)
78

8-
Installation
9-
------------
9+
## Installation
1010

11-
siehe INSTALL.md
11+
1. Clone the repository:
12+
```sh
13+
git clone https://github.com/freifunk/linksink.git
14+
cd linksink
15+
```
1216

13-
mögliche Abfragerouten
14-
----------------------
17+
2. Install PHP dependencies:
18+
```sh
19+
composer install
20+
```
1521

16-
Die Suchabfragen lassen sich auch direkt per URL aufrufen. Das Format ist optional und kann rss oder html sein, für Kategorien oder Tags werden die Namen in URL-tauglicher Form in der Datenbank abgelegt
22+
## Initializing the Database
1723

18-
* ```/kategorie/s/{category}.{format}```: Suche nach Kategorie
19-
* ```/kategorie/s/{category}/{year}.{format}```: Suche nach Kategorie und Jahr
20-
* ```/kategorie/s/{category}/{year}/{tag}.{format}```: Suche nach Kategorie, Jahr und Tag
21-
* ```/kategorie/s/{category}/{tag}.{format}```: Suche nach Kategorie und Tag
22-
* ```/tags/{tag}.{format}```: Suche nach Tag
24+
1. Create the database schema:
25+
```sh
26+
php bin/console doctrine:schema:create
27+
```
2328

24-
weitere Routen
25-
--------------
29+
## Running Tests
2630

27-
* ```/kategorie```: Kategorieverwaltung
28-
* ```/kategorie/neu```: neue Kategorie anlegen
29-
* ```/links/neu```: neuen Link anlegen
31+
1. Run PHPUnit tests:
32+
```sh
33+
./vendor/bin/phpunit
34+
```
35+
36+
## Additional Commands
37+
38+
- To clear the cache:
39+
```sh
40+
php bin/console cache:clear
41+
```
42+
43+
- To run the development server:
44+
```sh
45+
php bin/console server:run
46+
```

app/.htaccess

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/AppCache.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)