housekeep: remove PHP implementation

removal of the PHP codebase

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-04-28 16:10:32 +02:00
parent 97d0eac303
commit 8ca63075e9
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
128 changed files with 27 additions and 16046 deletions

View file

@ -55,8 +55,7 @@ can proceed.
### Querying the RPC
The Fast (Python) API runs on Port 8444, while the legacy PHP version runs
on 8443. You can query one like so:
The Fast (Python) API runs on Port 8444. You can query one like so:
```sh
curl -k "https://localhost:8444/rpc/?v=5&type=search&arg=python"

View file

@ -27,10 +27,6 @@ http {
server fastapi:8000;
}
upstream cgit-php {
server cgit-php:3000;
}
upstream cgit-fastapi {
server cgit-fastapi:3000;
}
@ -39,54 +35,6 @@ http {
server unix:/var/run/smartgit/smartgit.sock;
}
server {
listen 8443 ssl http2;
server_name localhost default_server;
ssl_certificate /etc/ssl/certs/web.cert.pem;
ssl_certificate_key /etc/ssl/private/web.key.pem;
root /aurweb/web/html;
index index.php;
location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
include uwsgi_params;
uwsgi_pass smartgit;
uwsgi_modifier1 9;
uwsgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
uwsgi_param PATH_INFO /aur.git/$3;
uwsgi_param GIT_HTTP_EXPORT_ALL "";
uwsgi_param GIT_NAMESPACE $1;
uwsgi_param GIT_PROJECT_ROOT /aurweb;
}
location ~ ^/cgit {
include uwsgi_params;
rewrite ^/cgit/([^?/]+/[^?]*)?(?:\?(.*))?$ /cgit.cgi?url=$1&$2 last;
uwsgi_modifier1 9;
uwsgi_param CGIT_CONFIG /etc/cgitrc;
uwsgi_pass uwsgi://cgit-php;
}
location ~ ^/[^/]+\.php($|/) {
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(/[^/]+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
location ~ .+\.(css|js?|jpe?g|png|svg|ico)/?$ {
try_files $uri =404;
}
location ~ .* {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
server {
listen 8444 ssl http2;
server_name localhost default_server;

View file

@ -1,2 +0,0 @@
#!/bin/bash
exec pgrep memcached

View file

@ -1,2 +0,0 @@
#!/bin/bash
exec printf "" >>/dev/tcp/127.0.0.1/9000

View file

@ -12,7 +12,7 @@ while ! mysqladmin ping 2>/dev/null; do
done
# Configure databases.
DATABASE="aurweb" # Persistent database for fastapi/php-fpm.
DATABASE="aurweb" # Persistent database for fastapi.
echo "Taking care of primary database '${DATABASE}'..."
mysql -u root -e "CREATE USER IF NOT EXISTS 'aur'@'localhost' IDENTIFIED BY 'aur';"

View file

@ -1,32 +0,0 @@
#!/bin/bash
set -eou pipefail
for archive in packages pkgbase users packages-meta-v1.json packages-meta-ext-v1.json; do
ln -vsf /var/lib/aurweb/archives/${archive}.gz /aurweb/web/html/${archive}.gz
done
# Setup database.
NO_INITDB=1 /docker/mariadb-init-entrypoint.sh
# Setup some other options.
aurweb-config set options cache 'memcache'
aurweb-config set options aur_location "$AURWEB_PHP_PREFIX"
aurweb-config set options git_clone_uri_anon "${AURWEB_PHP_PREFIX}/%s.git"
aurweb-config set options git_clone_uri_priv "${AURWEB_SSHD_PREFIX}/%s.git"
# Listen on :9000.
sed -ri 's/^(listen).*/\1 = 0.0.0.0:9000/' /etc/php/php-fpm.d/www.conf
sed -ri 's/^;?(clear_env).*/\1 = no/' /etc/php/php-fpm.d/www.conf
# Log to stderr. View logs via `docker-compose logs php-fpm`.
sed -ri 's|^(error_log) = .*$|\1 = /proc/self/fd/2|g' /etc/php/php-fpm.conf
sed -ri 's|^;?(access\.log) = .*$|\1 = /proc/self/fd/2|g' \
/etc/php/php-fpm.d/www.conf
sed -ri 's/^;?(extension=pdo_mysql)/\1/' /etc/php/php.ini
sed -ri 's/^;?(open_basedir).*$/\1 = \//' /etc/php/php.ini
# Use the sqlite3 extension line for memcached.
sed -ri 's/^;(extension)=sqlite3$/\1=memcached/' /etc/php/php.ini
exec "$@"

View file

@ -15,9 +15,8 @@ pacman -Sy --noconfirm --noprogressbar archlinux-keyring
pacman -Syu --noconfirm --noprogressbar \
--cachedir .pkg-cache git gpgme nginx redis openssh \
mariadb mariadb-libs cgit-aurweb uwsgi uwsgi-plugin-cgi \
php php-fpm memcached php-memcached python-pip pyalpm \
python-srcinfo curl libeatmydata cronie python-poetry \
python-poetry-core step-cli step-ca asciidoc \
python-pip pyalpm python-srcinfo curl libeatmydata cronie \
python-poetry python-poetry-core step-cli step-ca asciidoc \
python-virtualenv python-pre-commit
exec "$@"

View file

@ -1,2 +0,0 @@
#!/bin/bash
exec /usr/bin/memcached -u memcached -m 64 -c 1024 -l 0.0.0.0

View file

@ -5,8 +5,6 @@ echo
echo " Services:"
echo " - FastAPI : https://localhost:8444/"
echo " (cgit) : https://localhost:8444/cgit/"
echo " - PHP : https://localhost:8443/"
echo " (cgit) : https://localhost:8443/cgit/"
echo
echo " Note: Copy root CA (./data/ca.root.pem) to ca-certificates or browser."
echo

View file

@ -1,4 +0,0 @@
#!/bin/bash
set -eou pipefail
exec php-fpm --fpm-config /etc/php/php-fpm.conf --nodaemonize