back

pub / stagit-scripts

Building src.jayvii.de with stagit
git clone https://src.jayvii.de/pub/stagit-scripts.git
Home | Log | Files | Exports | Refs | README | RSS

Activity: Sep, 2021 - Nov, 2024

Less More

stagit-scripts

Please send patches or remarks to jayvii+stagit-scripts[AT]posteo[DOT]de

Some scripts and assets to run src.jayvii.de.

Structure

|- bin/
|  |- git_create_repo.sh        Creates A bare repository and HTML viewer
|  |- git_post_push.sh          Used as post-push hook in repositories
|  |- git_post_push_all.sh      Trigger post-update hook in all repositories
|  |- git_set_clone_url.sh      Sets necessary URL to clone via http(s)
|  |- git_update_index_html.sh  Updates the repository overview HTML page
|  |- git_update_repo_html.sh   Updates the respository HTML viewer pages
|  '- git_update_repo.sh        Updates git information to clone via http(s)
|
|- assets/
|  |- favicon.png               Favicon and Logo of the page
|  |- backicon.png              Logo for the "back" button in repos
|  |- style.css                 CSS for the HTML viewer
|  '- index.css                 CSS for the file index viewer
|
|- 404.html                     404 Page
|- index.html                   Index-Page for the Main site, redirects to /pub/
|- .htaccess                    htaccess file with defaults for security
'- .gitignore                   Files to be ignored when checking out git

There are additional links for CSS and icon files.

Setup

  1. Install https://www.codemadness.org/git/stagit/ on your Server

  2. Use this template:

git clone https://src.jayvii.de/pub/stagit-scripts.git /var/www/git.myserver.com
  1. Setup the HTML Root:
mkdir -p /var/www/git.myserver.com/{pub,priv}
  1. Setup git-user:
useradd -r -m -U -d /var/www/git.myserver.com -s /bin/sh -G www-data git

Private Repositories

Private repositories reside within /prv, while your public repositories are in /pub. Access to the private repositories is restricted via HTTP Basic Authentication.

A .htaccess file is provided within the /prv directory, however you also need to set up a user/password for the web-access, e.g. here for the user “username”:

sudo htpasswd -c /etc/apache2/.htpassword username 

Optional Tweaks

Set your stagit server’s URL via the “url” file:

echo "https://src.example.com" > /var/www/src.example.com/url

You may also setup SSH-credentials for the user or SSH-Auth keys.

You most likely want to setup a webserver (e.g. Apache2) with “/var/www/ git.myserver.com” (home of user “git”) as its root-dir.

As long as user “git” is in the group “www-data”, file permissions should generally be no problem. For good measure, you may however still set up cron-job that enforces file permissions every now and then. In crontab, use following entries (assuming your git-folder is located in “/var/www/src.example.com”):

0 0 * * * chown git:www-data -R /var/www/src.example.com
0 0 * * * chmod 770 -R /var/www/src.example.com

Examples

You’ll find a post-update hook example in the “examples/hooks/” directory.

examples/
|
'- hooks/
|- post-update.sample1    Automatic packaging and deployment
'- post-update.sample2    REUSE linting on push

Further notes

New repositories can be created via the webform in “/create_repo/index.html” or via an according GET request to that PHP-script:

curl https://src.example.com/create_repo/?name=test_repo&description=this%20is%20just%20a%20test%20repository&owner=me&type=pub

The “/create_repo/” endpoint is restricted to authenticated users via htaccess (just like the “/priv/” repositories). A GET request therefore has to supply the authentication credentials accordingly.

License

stagit-scripts is licensed under AGPL-3.0-or-later.

Bundled Assets

favicon.png & backicon.png are modified versions of materialdesignicons and are licensed under Apache-2.0.

stagit (https://www.codemadness.org/git/stagit) and some of its assets used here are licensed under MIT.


Clone this repository via:
git clone https://src.jayvii.de/pub/stagit-scripts.git