From 9ed2011b33da75c1a9316d62bae6325355aa35aa Mon Sep 17 00:00:00 2001 From: notnull Date: Thu, 2 Nov 2023 20:50:45 -0400 Subject: [PATCH] docs/index.md cleanup --- docs/index.md | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/index.md b/docs/index.md index 7c172c0..b136a59 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,8 +2,6 @@ The goal is to test creating a git hook on serge. -# steps - ## Create new user on serge that belongs to www-data and git groups: useradd -G www-data git -M mkdocs @@ -16,20 +14,34 @@ The goal is to test creating a git hook on serge. ## Serve website with Nginx +Set up site with /var/www/services.anarchyplanet.org/public_html as root + vim /etc/nginx/sites-available/services.anarchyplanet.org - `# set up site with /var/www/services.anarchyplanet.org/public_html as root` +Enable Site in nginx ln -s /etc/nginx/sites-available/services.anarchyplanet.org /etc/nginx/sites-enabled nginx -t && nginx -s reload +## Protect directory with password + +Per the [docs](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/): + +Create .htpasswd file + + htpasswd -c /var/www/services.anarchyplanet.org/.htpasswd admin + +Make .htpasswd not world-readable + + chown mkdocs:mkdocs .htpasswd; chmod 640 .htpasswd + +Add the config to the nginx config and restart nginx + ## Clone repository into website directory su mkdocs cd /var/www git clone /srv/git/repositories/notnull/git-hooks-demo.git services.anarchyplanet.org -This made file permissions all mkdocs:mkdocs so I changed them back to mkdocs:www-data - ## Install mkdocs and mkdocs-material I wasn't sure the best way to do this so I just installed globally: @@ -38,7 +50,6 @@ I wasn't sure the best way to do this so I just installed globally: ## Write script to build docs - ```shell #!/bin/bash # /var/www/services.anarchyplanet.org/update.sh @@ -77,7 +88,7 @@ I guess the only remaining thing to do is try it! ### there are unstashed changes in website directory -So it looks like the hook sends the log of the hook to the local stdout, which is cool! I had some files in it and so it looks like the pull didn't work, but it still built the documents. Might want to build in some error handling, but for now going to try again! +So it looks like the hook sends the log of the remote hook to the local stdout, which is cool! I had some files in it and so it looks like the pull didn't work, but it still built the documents. Might want to build in some error handling, but for now going to try again! ```shell remote: From /srv/git/repositories/notnull/git-hooks-demo @@ -96,18 +107,14 @@ remote: INFO - Building documentation to directory: /var/www/services.anarch remote: INFO - Documentation built in 0.54 seconds ``` -### if files in the website directory have changed - -When I stashed all the changes in the directory, this meant there was no update.sh. The script should pull before building; not sure why it didn't? - -I'll try changing it to use && - ### the update script doesn't exist until I pull changes -and the update-script is what the git hook runs. whoops! +and the update script is what the git hook runs. whoops! For now I'm going to just pull it once from the website directory. ### script permissions I realized that the script was not executable so i fixed this, then pulled from teh remote repository again + +