summaryrefslogtreecommitdiff
path: root/topics/ci-cd
diff options
context:
space:
mode:
authorPjotr Prins2023-12-03 09:48:09 -0600
committerPjotr Prins2023-12-03 09:48:09 -0600
commit13919b0b61ca7c7204222a988673929a96fd52db (patch)
treeba36633b9d9391608ae8bc19eea8da58e739c9e1 /topics/ci-cd
parentbaeafc5ccc4a9893d22e6629db97720e3fa6d3ae (diff)
downloadgn-gemtext-13919b0b61ca7c7204222a988673929a96fd52db.tar.gz
Rename
Diffstat (limited to 'topics/ci-cd')
-rw-r--r--topics/ci-cd/utility-scripts.gmi63
1 files changed, 63 insertions, 0 deletions
diff --git a/topics/ci-cd/utility-scripts.gmi b/topics/ci-cd/utility-scripts.gmi
new file mode 100644
index 0000000..fb95526
--- /dev/null
+++ b/topics/ci-cd/utility-scripts.gmi
@@ -0,0 +1,63 @@
+# Utility Scripts
+
+Sometimes we need to run some utility scripts manually to set up certain things that do not render themselves to automation very well.
+
+This is especially relevant for any script that might need to interact with the SQLite database.
+
+This document notes some gotchas that you might run into trying to run
+=> ./topics/authentication/cli_utility_scripts the utility scripts.
+
+## Register System Administrator
+
+Start by getting a shell into the CI/CD container:
+
+```
+sudo guix container exec <PID> /run/current-system/profile/bin/bash --login
+```
+
+replacing =<PID>= with the process ID of the container.
+
+Now stop GN3:
+
+```
+herd stop genenetwork3
+```
+
+In a separate terminal on the *host* system, change the owner of the directory
+and file:
+```
+sudo chown -R fredm /export/data/genenetwork-sqlite
+```
+
+Now start a guix shell in the *genenetwork3* repository (on the host) and run
+the utility script(s) you need to run:
+
+```
+$ cd /home/fredm/genenetwork3
+$ guix shell --container --network --share=/export/data/genenetwork-sqlite \
+ --development --file=guix.scm
+[env] $ python3 -m scripts.register_sys_admin \
+ /export/data/genenetwork-sqlite/auth.db
+```
+
+Once you have run (all) the utility script(s) you needed to run, you can exit
+the shell and restore the file user:
+```
+sudo chown -R guixbuilder13 /export/data/genenetwork-sqlite
+```
+
+now go back to the CI/CD container shell and restart genenetwork3:
+```
+herd start genenetwork3
+```
+then exit the shell.
+
+### Failed Attempts
+
+Tried
+```
+mount --bind -o rw,umask=0002,gid=1000,uid=1000 \
+ /home/frederick/genenetwork/local-ci-cd/data/genenetwork-sqlite \
+ /home/frederick/genenetwork/ci-cd-container-dirs
+```
+but the file (and mount target) retain the original permissions.