-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using a local git server we can deploy ocm applications without network access to github. This is useful for demos when the network is unreliable, for example in a conference. Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Setting up a local git server | ||
|
||
## Initial setup | ||
|
||
1. Install lighttpd | ||
|
||
``` | ||
sudo dnf install lighttpd | ||
``` | ||
|
||
1. Create the git repo | ||
|
||
Create a directory where the git repositories will be served: | ||
|
||
``` | ||
sudo mkdir /var/www/gitlap | ||
cd /var/www/gitlap | ||
sudo git clone --bare https://github.com/nirs/ocm-kubevirt-samples.git | ||
``` | ||
|
||
Set git repo permissions so you can push changes, and the web server | ||
can serve the repo. | ||
|
||
``` | ||
sudo chown -R $USER:lighttpd /var/www/gitlap | ||
``` | ||
|
||
1. Copy the vhost configuration | ||
|
||
``` | ||
sudo cp gitlap.conf /etc/lighttpd/vhosts.d/ | ||
``` | ||
|
||
1. Uncomment the vhost include in /etc/lighttpd/lighttpd.conf | ||
|
||
``` | ||
include conf_dir + "/vhosts.d/*.conf" | ||
``` | ||
|
||
1. Enable and start the service | ||
|
||
``` | ||
sudo systemctl enable --now lighttpd | ||
``` | ||
|
||
1. Allow http access in the libvirt zone | ||
|
||
``` | ||
sudo firewall-cmd --zone=libvirt --add-service=http --permanent | ||
sudo firewall-cmd --reload | ||
``` | ||
|
||
## Testing the server | ||
|
||
1. Add entry in /etc/hosts for testing locally | ||
|
||
``` | ||
192.168.122.1 host.minikube.internal | ||
``` | ||
|
||
1. Check that git clone works | ||
|
||
``` | ||
git clone http://host.minikube.internal/ocm-kubevirt-samples.git | ||
rm -rf ocm-kubevirt-samples | ||
``` | ||
|
||
1. Check git clone in a minikube cluster | ||
|
||
``` | ||
minikube ssh -p dr1 | ||
git clone http://host.minikube.internal/ocm-kubevirt-samples.git | ||
rm -rf ocm-kubevirt-samples | ||
``` | ||
|
||
## Updating the git repo | ||
|
||
1. Add a remote to your working repo | ||
|
||
``` | ||
git remote add gitlap file:///var/www/gitlap/ocm-kubevirt-samples.git | ||
``` | ||
|
||
1. Push changes to the remote | ||
|
||
``` | ||
git push -f gitlap main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Minimal configuration for local git server for minikube clusters. | ||
# | ||
# For more options see: | ||
# https://redmine.lighttpd.net/projects/lighttpd/wiki/How_to_set_up_a_git_server_over_http(s) | ||
|
||
server.modules += ("mod_setenv", "mod_cgi", "mod_alias") | ||
|
||
# `host.minikube.internal` is a special DNS name injected by minikube to all clusters. | ||
# https://minikube.sigs.k8s.io/docs/handbook/host-access/ | ||
$HTTP["host"] == "host.minikube.internal" { | ||
alias.url = ( "" => "/usr/libexec/git-core/git-http-backend" ) | ||
setenv.set-environment = ( | ||
"GIT_PROJECT_ROOT" => "/var/www/gitlap/", | ||
"GIT_HTTP_EXPORT_ALL" => "1" | ||
) | ||
cgi.assign = ( "" => "" ) | ||
} |