diff options
-rwxr-xr-x | etc/auth.db | bin | 0 -> 14548992 bytes | |||
-rw-r--r-- | etc/gn-auth-secrets.py | 8 | ||||
-rw-r--r-- | etc/gn2-secrets.py | 3 | ||||
-rw-r--r-- | etc/gn3-secrets.py | 6 | ||||
-rwxr-xr-x | genenetwork-local-container.sh | 52 |
5 files changed, 67 insertions, 2 deletions
diff --git a/etc/auth.db b/etc/auth.db Binary files differnew file mode 100755 index 0000000..5d6d7f6 --- /dev/null +++ b/etc/auth.db diff --git a/etc/gn-auth-secrets.py b/etc/gn-auth-secrets.py new file mode 100644 index 0000000..0478bcf --- /dev/null +++ b/etc/gn-auth-secrets.py @@ -0,0 +1,8 @@ +SECRET_KEY = "qQIrgiK29kXZU6v8D09y4uw_sk8I4cqgNZniYUrRoUk" +SMTP_TIMEOUT = 200 +SMTP_HOST = "smtp.XXXX.XXX" +SMTP_PORT = 587 +SMTP_USER = "XXXX" +SMTP_PASSWORD = "XXXX" +EMAIL_ADDRESS = "XXXX@XXXX.com" +EMAIL_DISPLAY_NAME = "GeneNetwork: Local Server" diff --git a/etc/gn2-secrets.py b/etc/gn2-secrets.py new file mode 100644 index 0000000..76c8592 --- /dev/null +++ b/etc/gn2-secrets.py @@ -0,0 +1,3 @@ +SECRET_KEY="NiHykhng7kECUcWA0YhYry2ILgM3yvyAI2hmtKwGn14" +OAUTH2_CLIENT_ID="0bbfca82-d73f-4bd4-a140-5ae7abb4a64d" +OAUTH2_CLIENT_SECRET="qQIrgiK29kXZU6v8D09y4uw_sk8I4cqgNZniYUrRoUk" diff --git a/etc/gn3-secrets.py b/etc/gn3-secrets.py new file mode 100644 index 0000000..3992693 --- /dev/null +++ b/etc/gn3-secrets.py @@ -0,0 +1,6 @@ +SECRET_KEY="random-key" +OAUTH2_CLIENT_ID="0bbfca82-d73f-4bd4-a140-5ae7abb4a64d" +OAUTH2_CLIENT_SECRET="yadabadaboo" +SPARQL_USER="dba" +SPARQL_PASSWORD="dba" +SPARQL_AUTH_URI="http://localhost:7082/sparql-auth/" diff --git a/genenetwork-local-container.sh b/genenetwork-local-container.sh index ca67d4a..8d5cdf4 100755 --- a/genenetwork-local-container.sh +++ b/genenetwork-local-container.sh @@ -33,6 +33,7 @@ SYSTEM_DIRECTORIES=( "$BASE_DIR/var/lib/redis" "$BASE_DIR/var/lib/virtuoso" "$BASE_DIR/var/lib/xapian" + "$BASE_DIR/var/genenetwork/genotype-files" "$BASE_DIR/var/lib/genenetwork-sqlite" "$BASE_DIR/var/lib/genenetwork-gnqa" "/tmp/local-container" @@ -45,6 +46,14 @@ GN_PROJECTS=( "gn-docs:https://git.genenetwork.org/gn-docs" ) +# File mappings: source -> destination +declare -A FILE_MAPPINGS=( + ["etc/auth.db"]="$BASE_DIR/var/genenetwork/auth.db" + ["etc/gn2-secrets.py"]="$BASE_DIR/etc/genenetwork/conf/gn2/secrets.py" + ["etc/gn3-secrets.py"]="$BASE_DIR/etc/genenetwork/conf/gn3/secrets.py" + ["etc/gn-auth-secrets.py"]="$BASE_DIR/etc/genenetwork/conf/secrets.py" +) + CONTAINER_SCM="genenetwork-local-container.scm" CONTAINER_BIN="/usr/local/bin/genenetwork-local-container" GC_ROOT="/var/guix/gcroots/genenetwork-local-container" @@ -56,7 +65,7 @@ log() { } # Check dependencies -for cmd in git guix sudo; do +for cmd in git guix sudo diff cp; do if ! command -v "$cmd" &>/dev/null; then log "ERROR" "Required command '$cmd' not found" exit 1 @@ -76,7 +85,8 @@ for dir in "${SYSTEM_DIRECTORIES[@]}"; do if [ -w "$dir" ]; then log "DEBUG" "Directory exists and is writable: $dir" else - log "WARNING" "Directory exists but is not writable: $dir" + log "WARNING" "Directory exists but is not writable: $dir. Making this writable" + sudo chown -R "$USER" "$dir" fi continue fi @@ -102,6 +112,44 @@ for dir in "${SYSTEM_DIRECTORIES[@]}"; do fi done +# Check and copy configuration files +log "INFO" "Checking and copying configuration files..." +for src in "${!FILE_MAPPINGS[@]}"; do + dest="${FILE_MAPPINGS[$src]}" + log "INFO" "Processing $src -> $dest" + + # Check if source file exists + if [ ! -f "$src" ]; then + log "ERROR" "Source file does not exist: $src" + exit 1 + fi + + # Check if destination file exists + if [ ! -f "$dest" ]; then + log "INFO" "Destination file does not exist, copying $src to $dest" + mkdir -p "$(dirname "$dest")" + if ! cp "$src" "$dest"; then + log "ERROR" "Failed to copy $src to $dest" + exit 1 + fi + continue + fi + + # Compare files using diff + log "INFO" "Comparing $src with $dest" + if diff_output=$(diff -u "$dest" "$src" 2>&1); then + log "INFO" "Files $src and $dest are identical" + else + log "INFO" "Differences found between $src and $dest:" + echo "$diff_output" >&2 + log "INFO" "Copying $src to $dest" + if ! cp "$src" "$dest"; then + log "ERROR" "Failed to copy $src to $dest" + exit 1 + fi + fi +done + is_git_repository() { local dir="$1" # Check for standard repository |