aboutsummaryrefslogtreecommitdiff
path: root/genenetwork-local-container.sh
blob: 07d06628410ef46d21b00bb77305e1a750b92734 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /bin/sh -e

# genenetwork-machines --- Guix configuration for genenetwork machines
# Copyright © 2025 Munyoki Kilyungi <me@bonfacemunyoki.com>
#
# This file is part of genenetwork-machines.
#
# genenetwork-machines is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# genenetwork-machines is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with genenetwork-machines.  If not, see
# <https://www.gnu.org/licenses/>.

# Build and install genenetwork production container on tux02.

system_directories=("$HOME"/genenetwork/var/log
		    "$HOME"/genenetwork/var/genenetwork
		    "$HOME"/genenetwork/etc/genenetwork/conf
		    "$HOME"/genenetwork/etc/genenetwork
		    "$HOME"/genenetwork/var/lib/redis
		    "$HOME"/genenetwork/var/lib/virtuoso
		    "$HOME"/genenetwork/var/lib/xapian
		    "$HOME"/genenetwork/var/lib/genenetwork-sqlite
		    "$HOME"/genenetwork/var/lib/genenetwork-gnqa
		    /tmp/local-container)

for dir in "${system_directories[@]}"; do
    if [[ ! -d $dir ]]; then
	mkdir -p $dir
    fi
done

gn_projects=(genenetwork2 genenetwork3)
for project in "${gn_projects[@]}"; do
    dir="${HOME}/genenetwork/${project}"
    if [[ ! -d $dir ]]; then
	git clone "git@github.com:genenetwork/${project}" $dir
    fi
done

if [[ ! -d "${HOME}/genenetwork/gn-auth" ]]; then
    git clone "https://git.genenetwork.org/gn-auth" "${HOME}/genenetwork/gn-auth"
fi

if [[ ! -d "${HOME}/genenetwork/gn-docs" ]]; then
    git clone --bare "https://git.genenetwork.org/gn-docs" "${HOME}/genenetwork/gn-docs"
fi

container_script=$(guix system container \
			--network \
			--load-path=. \
			--verbosity=3 \
			--share="$HOME"/genenetwork/var/log=/var/log \
			--share="$HOME"/genenetwork/var/genenetwork=/var/genenetwork \
			--share="$HOME"/genenetwork/etc/genenetwork/conf=/etc/genenetwork/conf \
			--share="$HOME"/genenetwork/etc/genenetwork=/etc/genenetwork \
			--share="$HOME"/genenetwork/var/lib/redis=/var/lib/redis \
			--share="$HOME"/genenetwork/var/lib/virtuoso/=/var/lib/virtuoso \
			--share="$HOME"/genenetwork/genenetwork2=/genenetwork2 \
			--share="$HOME"/genenetwork/genenetwork3=/genenetwork3 \
			--share="$HOME"/genenetwork/gn-auth=/gn-auth \
			--share="$HOME"/genenetwork/var/lib/xapian=/var/lib/xapian \
			--share="$HOME"/genenetwork/var/lib/genenetwork-sqlite=/var/lib/genenetwork-sqlite \
			--share="$HOME"/genenetwork/var/lib/genenetwork-gnqa=/var/lib/genenetwork-gnqa \
			--share=/tmp/local-container=/tmp \
			--share="$HOME"/genenetwork/gn-docs=/var/lib/gn-docs \
			--share=/run/mysqld=/run/mysqld \
			genenetwork-local-container.scm)

echo $container_script
sudo ln --force --symbolic $container_script /usr/local/bin/genenetwork-local-container
sudo ln --force --symbolic /usr/local/bin/genenetwork-local-container /var/guix/gcroots