/
prepare_instance.sh
81 lines (60 loc) · 2.1 KB
/
prepare_instance.sh
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
# Change this to where you want to install. $HOME
# is probably a bad choice if it needs to be maintained
# by a group of people
# This was developed on Ubuntu 18.04 LTS minimal on Google Cloud with 100GB disk
INSTALL_ROOT=$HOME
# Prepare instance (or machine) with Docker, docker-compose, python
sudo apt-get update > /dev/null
sudo apt-get install -y git \
build-essential \
nginx \
vim \
python-dev
# Needed module for system python
wget https://bootstrap.pypa.io/get-pip.py
sudo /usr/bin/python get-pip.py
sudo pip install ipaddress
sudo pip install oauth2client
# Install Docker dependencies
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# Add docker key server
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# OK
# $ sudo apt-key fingerprint 0EBFCD88
# pub rsa4096 2017-02-22 [SCEA]
# 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
# uid [ unknown] Docker Release (CE deb) <docker@docker.com>
# sub rsa4096 2017-02-22 [S]
# Add stable repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Install Docker!
sudo apt-get update &&
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# test, you will still need sudo
sudo docker run hello-world
# Docker group should already exist
# sudo groupadd docker
#make sure to add all users that will maintain / use the registry
sudo usermod -aG docker $USER
# Docker-compose
sudo apt -y install docker-compose
# Note that you will need to log in and out for changes to take effect
if [ ! -d $INSTALL_ROOT/freegenes ]; then
cd $INSTALL_ROOT
# if you need to install a specific branch
# git clone -b <branch> https://www.github.com/vsoch/freegenes.git
# otherwise production
git clone https://www.github.com/vsoch/freegenes.git
cd freegenes
docker build -t quay.io/vsoch/freegenes .
# docker-compose up -d
fi