Skip to content

Instantly share code, notes, and snippets.

@ScalaWilliam
Created October 8, 2016 03:39
Show Gist options
  • Select an option

  • Save ScalaWilliam/4786ecd9ee66a663d564ee5fc53989a7 to your computer and use it in GitHub Desktop.

Select an option

Save ScalaWilliam/4786ecd9ee66a663d564ee5fc53989a7 to your computer and use it in GitHub Desktop.
useradd -m work
ln -s /home/work/config/nginx.work.conf /etc/nginx/conf.d/nginx.work.conf
server {
listen 80;
listen 443 ssl http2;
ssl on;
ssl_certificate /etc/letsencrypt/live/git.work/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.work/privkey.pem;
server_name git.work;
index index.html;
root /home/work/www;
location / {
}
location ~ /\.git {
deny all;
}
}
sudo -u work vim /home/work/config/nginx.work.conf
systemctl stop nginx && certbot certonly --standalone -d git.work ; systemctl start nginx
sudo -u work mkdir -p /home/work/{config,www}/
setfacl -m u:nginx:x /home/work/
setfacl -R -m u:nginx:xr /home/work/{config,www}
sudo -u nginx ls /home/work/www/
sudo -u work touch /home/work/www/index.html
curl https://git.work/
curl -i https://git.work/
HTTP/1.1 200 OK
Server: nginx/1.10.1
Date: Sat, 08 Oct 2016 03:33:46 GMT
Content-Type: text/html
Content-Length: 0
Last-Modified: Sat, 08 Oct 2016 03:33:40 GMT
Connection: keep-alive
ETag: "57f86914-0"
Accept-Ranges: bytes
sudo -u work -i
git clone https://github.com/ScalaWilliam/git-work-content.git www/x/
mv www/x/* www/
mv www/x/.git www/.git
exit
cd /home/work/www/
make rpm-setup
sudo -u work -i
npm install -g gitwatch-client
git-watch \
--url=https://git.watch/github/ScalaWilliam/git-work-content \
--push-execute='
ref="%ref%"
if [ "$ref" = "refs/heads/master" ]; then
cd /home/work/www/ &&
git pull origin $ref &&
make build &&
echo "Updated $ref"
fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment