forked from reznikmm/learn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
185 lines (149 loc) · 5.1 KB
/
Copy pathVagrantfile
File metadata and controls
185 lines (149 loc) · 5.1 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
$frontend = <<-SHELL
#!/bin/sh -eux
# Enable the NodeSource repository
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
# Add yarn to apt-get
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# Install system deps
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 \
python3-pip \
python3-venv \
nodejs \
graphviz \
poppler-utils \
libjpeg-dev \
make \
gnat \
gprbuild \
yarn
# Install learn deps
python3 -m venv /vagrant/venv
source /vagrant/venv/bin/activate
pip3 install -r /vagrant/frontend/requirements.txt
cd /vagrant/frontend
yarn
SHELL
$epub = <<-SHELL
#!/bin/sh -eux
# Enable the NodeSource repository
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
# Add yarn to apt-get
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && sudo apt-get install yarn
# Install system deps
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 \
python3-pip \
python3-venv \
nodejs \
graphviz \
make \
yarn \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
latexmk \
texlive-xetex \
fonts-lmodern \
fonts-open-sans \
fonts-dejavu \
poppler-utils \
libjpeg-dev \
build-essential \
ca-certificates \
git \
libdbus-1-3 \
libfontconfig \
libx11-xcb-dev \
wget \
libc6-dev
# Install GNAT Community
git clone https://github.com/AdaCore/gnat_community_install_script.git /gnat_installer/script \
&& wget -q https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin -O /gnat_installer/actual \
&& sh /gnat_installer/script/install_package.sh /gnat_installer/actual /gnat com.adacore.spark2014_discovery,com.adacore.gnat \
&& rm -rf /gnat_installer
echo 'export PATH="/gnat/bin:${PATH}"' >> /home/vagrant/.bashrc
source /home/vagrant/.bashrc
# Install learn deps
python3 -m venv /vagrant/venv
source /vagrant/venv/bin/activate
pip3 install -r /vagrant/frontend/requirements.txt
# Install Calibre
sudo -v && \
wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | \
sudo sh /dev/stdin version=5.29.0
cd /vagrant/frontend
yarn
SHELL
$backend = <<-SHELL
#!/bin/sh -eux
# Get docker apt repos
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Install system deps
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 \
python3-pip \
python3-venv \
make \
rabbitmq-server \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common \
docker-ce \
docker-ce-cli \
containerd.io
# Add vagrant user to docker to allow interactive container
# groupadd docker
usermod -aG docker vagrant
# Install code_examples_server deps
python3 -m venv /vagrant/venv
source /vagrant/venv/bin/activate
pip3 install -r /vagrant/REQUIREMENTS.txt
cd /vagrant/infrastructure
# stop previous containers
docker stop $(docker ps -a -q)
# remove all images/containers on system
docker system prune -a -f
# Build docker image
docker build -t "safecontainer" .
SHELL
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.define "web" do |web|
web.vm.box = "bento/ubuntu-18.04"
web.vm.network "forwarded_port", guest: 8080, host: 8080, host_ip: "127.0.0.1"
web.vm.synced_folder './frontend', '/vagrant/frontend'
web.vm.synced_folder './content', '/vagrant/content'
web.vm.provision :shell, inline: $frontend
end
config.vm.define "epub" do |epub|
epub.vm.box = "bento/ubuntu-21.04"
epub.vm.synced_folder './frontend', '/vagrant/frontend'
epub.vm.synced_folder './content', '/vagrant/content'
epub.vm.provision :shell, inline: $epub
end
config.vm.define "server" do |server|
server.vm.box = "bento/ubuntu-18.04"
server.vm.network "forwarded_port", guest: 8000, host: 8000, host_ip: "127.0.0.1"
server.vm.network "forwarded_port", guest: 6379, host: 6379, host_ip: "127.0.0.1"
server.vm.synced_folder './backend', '/vagrant'
server.vm.provision :shell, inline: $backend
end
end