aboutsummaryrefslogtreecommitdiffstats
path: root/posts
diff options
context:
space:
mode:
authorFran├žois Kooman <fkooman@tuxed.net>2018-05-29 23:13:20 +0200
committerFran├žois Kooman <fkooman@tuxed.net>2018-05-29 23:13:20 +0200
commit1876b034d4d72d6338967f9b2ca78aedcb3dd63b (patch)
tree1c4f52814a2498bf10c0e2b4a27c74ad1a14b589 /posts
parenta843e055cf5744a7e40576a8a83a1120f96cb23f (diff)
downloadwww.tuxed.net-1876b034d4d72d6338967f9b2ca78aedcb3dd63b.zip
www.tuxed.net-1876b034d4d72d6338967f9b2ca78aedcb3dd63b.tar.gz
www.tuxed.net-1876b034d4d72d6338967f9b2ca78aedcb3dd63b.tar.xz
add post, update git post
Diffstat (limited to 'posts')
-rw-r--r--posts/git_server_centos.md8
-rw-r--r--posts/packagist_own_git_server.md73
2 files changed, 81 insertions, 0 deletions
diff --git a/posts/git_server_centos.md b/posts/git_server_centos.md
index 6538c65..ca3703c 100644
--- a/posts/git_server_centos.md
+++ b/posts/git_server_centos.md
@@ -138,6 +138,14 @@ Now restart Apache:
Now you can browse to `https://HOST/cgit` assuming you set up your HTTP server
with TLS.
+If you want to run cgit on its own (sub)domain, you can use the following
+configuration directives in the Apache virtual host, don't forget to update
+the `clone-url` as well:
+
+ DocumentRoot /usr/share/cgit
+ Alias /cgit-data /usr/share/cgit
+ ScriptAlias / /var/www/cgi-bin/cgit/
+
If you are playing with the configuration options, you may need to remove the
cache as cgit will cache the output it sends to the browser:
diff --git a/posts/packagist_own_git_server.md b/posts/packagist_own_git_server.md
new file mode 100644
index 0000000..447c72d
--- /dev/null
+++ b/posts/packagist_own_git_server.md
@@ -0,0 +1,73 @@
+---
+title: Packagist with your own Git Server
+published: 2018-05-29
+---
+
+The [Packagist](https://packagist.org/) service is used to make it possible to
+install PHP dependencies using the [Composer](https://getcomposer.org/) tool.
+It is very much "optimized" for GitHub, but using your own Git server is also
+supported, although it has some rough edges:
+
+1. Packagist is not able to connect to web servers using the
+[Modern compatibility](https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility)
+TLS configuration (issue [#918](https://github.com/composer/packagist/issues/918));
+2. Packagist's `update-package` hook requires the repository URL to have at
+least two path segments (issue [#917](https://github.com/composer/packagist/issues/917));
+3. Packgist's Git hook documentation could be more clear.
+
+It is not so difficult to work around these issues though. Hopefully these
+workarounds will not be required anymore in the future.
+
+### TLS
+
+You can use the
+[Intermediate compatibility](https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29)
+TLS configuration for your "git" virtual host.
+
+### Path Segments
+
+If you set up your Git server according to my previous blog post
+[here](git_server_centos.html), you will have the problem that the
+`update-package` Git hook to won't work with Packagist. The repository URL must
+contain at least two path segments. So, for example the repository URL
+`https://HOST/php-yubitwee` won't work, but
+`https://HOST/fkooman/php-yubitwee` will.
+
+In order to work around this, you can modify the `repo.url` and `repo.path`
+fields in `/etc/cgitrc`, e.g.:
+
+ repo.url=fkooman/php-yubitwee
+ repo.path=/var/lib/git/fkooman/php-yubitwee.git
+
+Then move the repository directory to `/var/lib/git/fkooman/php-yubitwee.git`
+from `/var/lib/git/php-yubitwee.git` as well. That should be sufficient.
+Don't forget to clear the cache as documented in the previous blog post.
+
+### Git Hook
+
+The Packagist Git hook configuration is more or less documented
+[here](https://packagist.org/about#how-to-update-packages).
+
+What I actually ended up doing is put the following script as `post-receive` in
+my Git repository `hooks` directory, e.g.
+`/var/lib/git/fkooman/php-yubitwee.git/hooks/post-receive`:
+
+ #!/bin/sh
+ API_TOKEN=12345abcde
+
+ /usr/bin/curl \
+ -s \
+ -X POST \
+ -H "Content-Type: application/json" \
+ "https://packagist.org/api/update-package?username=fkooman&apiToken=${API_TOKEN}" \
+ -d '{"repository":{"url":"https://HOST/fkooman/php-yubitwee"}}'
+
+Note that the `PACKAGIST_PACKAGE_URL` as mentioned on the Packagist
+documentation page is actually *your* Git repository URL.
+
+Make sure the file is executable:
+
+ $ chmod 0755 /var/lib/git/fkooman/php-yubitwee.git/hooks/post-receive
+
+You can actually run it directly to test it, otherwise it will be triggered
+when you push to your Git server.