mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
+ Mounted static files (at web/html) to /static. + Added AURWEB_VERSION to aurweb.config (this is used around HTML to refer back to aurweb's release on git.archlinux.org), so we need it easily accessible in the Python codebase. + Implemented basic Jinja2 partials to put together whole aurweb pages. This may be missing some things currently and is a WIP until this set is ready to be merged. + Added config [options] aurwebdir = YOUR_AUR_ROOT; this configuration option should specify the root directory of the aurweb project. It is used by various parts of the FastAPI codebase to target project directories. Added routes via aurweb.routers.html: * POST /language: Set your session language. * GET /favicon.ico: Redirect to /static/images/favicon.ico. * Some browsers always look for $ROOT/favicon.ico to get an icon for the page being loaded, regardless of a specified "shortcut icon" given in a <link> directive. * GET /: Home page; WIP. * Updated aurweb.routers.html.language passes query parameters to its next redirection. When calling aurweb.templates.render_template, the context passed should be formed via the aurweb.templates.make_context. See aurweb.routers.html.index for an example of this. Signed-off-by: Kevin Morris <kevr@0cost.org>
108 lines
3.9 KiB
Text
108 lines
3.9 KiB
Text
Setup on Arch Linux
|
|
===================
|
|
|
|
For testing aurweb patches before submission, you can use the instructions in
|
|
TESTING for testing the web interface only.
|
|
|
|
Note that you can only do limited testing using the PHP built-in web server.
|
|
In particular, the cgit interface will be unusable as well as the ssh+git
|
|
interface. For a detailed description on how to setup a full aurweb server,
|
|
read the instructions below.
|
|
|
|
1) Clone the aurweb project:
|
|
|
|
$ cd /srv/http/
|
|
$ git clone git://git.archlinux.org/aurweb.git
|
|
|
|
2) Setup a web server with PHP and MySQL. Configure the web server to redirect
|
|
all URLs to /index.php/foo/bar/. The following block can be used with nginx:
|
|
|
|
server {
|
|
listen 80;
|
|
server_name aur.local aur;
|
|
|
|
root /srv/http/aurweb/web/html;
|
|
index index.php;
|
|
|
|
location ~ ^/[^/]+\.php($|/) {
|
|
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
|
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 ~ .* {
|
|
rewrite ^/(.*)$ /index.php/$1 last;
|
|
}
|
|
}
|
|
|
|
Ensure to enable the pdo_mysql extension in php.ini.
|
|
|
|
3) Optionally copy conf/config.defaults to /etc/aurweb/. Create or copy
|
|
/etc/aurweb/config (this is expected to contain all configuration settings
|
|
if the defaults file does not exist) and adjust the configuration (pay
|
|
attention to disable_http_login, enable_maintenance and aur_location).
|
|
|
|
4) Install Python modules and dependencies:
|
|
|
|
# pacman -S python-mysql-connector python-pygit2 python-srcinfo python-sqlalchemy \
|
|
python-bleach python-markdown python-alembic hypercorn \
|
|
python-itsdangerous python-authlib python-httpx \
|
|
python-jinja python-aiofiles python-python-multipart \
|
|
python-requests
|
|
# python3 setup.py install
|
|
|
|
5) Create a new MySQL database and a user and import the aurweb SQL schema:
|
|
|
|
$ python -m aurweb.initdb
|
|
|
|
6) Create a new user:
|
|
|
|
# useradd -U -d /srv/http/aurweb -c 'AUR user' aur
|
|
|
|
7) Initialize the Git repository:
|
|
|
|
# mkdir /srv/http/aurweb/aur.git/
|
|
# cd /srv/http/aurweb/aur.git/
|
|
# git init --bare
|
|
# git config --local transfer.hideRefs '^refs/'
|
|
# git config --local --add transfer.hideRefs '!refs/'
|
|
# git config --local --add transfer.hideRefs '!HEAD'
|
|
# ln -s /usr/local/bin/aurweb-git-update hooks/update
|
|
# chown -R aur .
|
|
|
|
It is recommended to read doc/git-interface.txt for more information on the
|
|
administration of the package Git repository.
|
|
|
|
8) Configure sshd(8) for the AUR. Add the following lines at the end of your
|
|
sshd_config(5) and restart the sshd. Note that OpenSSH 6.9 or newer is
|
|
needed!
|
|
|
|
Match User aur
|
|
PasswordAuthentication no
|
|
AuthorizedKeysCommand /usr/local/bin/aurweb-git-auth "%t" "%k"
|
|
AuthorizedKeysCommandUser aur
|
|
AcceptEnv AUR_OVERWRITE
|
|
|
|
9) If you want to enable smart HTTP support with nginx and fcgiwrap, you can
|
|
use the following directives:
|
|
|
|
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))$" {
|
|
fastcgi_pass unix:/run/fcgiwrap.sock;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
|
|
fastcgi_param PATH_INFO /aur.git/$3;
|
|
fastcgi_param GIT_HTTP_EXPORT_ALL "";
|
|
fastcgi_param GIT_NAMESPACE $1;
|
|
fastcgi_param GIT_PROJECT_ROOT /srv/http/aurweb/;
|
|
}
|
|
|
|
Sample systemd unit files for fcgiwrap can be found under conf/.
|
|
|
|
10) If you want memcache to cache MySQL data.
|
|
|
|
# pacman -S php-memcached
|
|
|
|
And edit the configuration file to enabled memcache caching.
|