Skip to content

Commit fe20a3f

Browse files
committed
first commit
0 parents  commit fe20a3f

7 files changed

+173
-0
lines changed

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Diagnosis and Control of Clouds Laboratory
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

aptSetup.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
sudo apt update
3+
sudo apt upgrade -y
4+

changeShells.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
for user in $(ls /users)
3+
do
4+
sudo chsh $user --shell /bin/bash
5+
done
6+

dockerSetup.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
4+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
6+
apt-cache policy docker-ce
7+
sudo apt install -y docker-ce
8+
sudo systemctl status docker --no-pager
9+
10+
for user in $(ls /users)
11+
do
12+
sudo usermod -aG docker $user
13+
done
14+
15+
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
16+
sudo chmod +x /usr/local/bin/docker-compose
17+
sudo docker-compose --version
18+
sudo echo -e '\n\nexport PATH=$PATH:/usr/local/bin' >> .bashrc
19+
source .bashrc
20+
21+
docker
22+
docker-compose
23+
24+
sudo systemctl stop docker.service
25+
sudo systemctl stop docker.socket
26+
27+
SEARCH_STRING="ExecStart=/usr/bin/dockerd -H fd://"
28+
REPLACE_STRING="ExecStart=/usr/bin/dockerd -g /mydata/docker -H fd://"
29+
sudo sed -i "s#$SEARCH_STRING#$REPLACE_STRING#" /lib/systemd/system/docker.service
30+
31+
sudo mkdir -p /mydata/docker
32+
sudo rsync -aqxP /var/lib/docker/ /mydata/docker
33+
34+
sudo systemctl daemon-reload
35+
sudo systemctl start docker

profile.py

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
"""
2+
Setup script for deploying train-ticket on CloudLab
3+
"""
4+
5+
# Import the Portal object.
6+
import geni.portal as portal
7+
# Import the ProtoGENI library.
8+
import geni.rspec.pg as pg
9+
10+
# Create a portal context.
11+
pc = portal.Context()
12+
13+
# Create a Request object to start building the RSpec.
14+
request = pc.makeRequestRSpec()
15+
16+
# Pick your OS.
17+
imageList = [
18+
('default', 'Default Image'),
19+
('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD', 'UBUNTU 18.04'),
20+
('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD', 'UBUNTU 20.04'),
21+
('urn:publicid:IDN+emulab.net+image+emulab-ops//CENTOS7-64-STD', 'CENTOS 7'),
22+
('urn:publicid:IDN+emulab.net+image+emulab-ops//CENTOS8-64-STD', 'CENTOS 8'),
23+
('urn:publicid:IDN+emulab.net+image+emulab-ops//FBSD114-64-STD', 'FreeBSD 11.4'),
24+
('urn:publicid:IDN+emulab.net+image+emulab-ops//FBSD122-64-STD', 'FreeBSD 12.2')]
25+
26+
pc.defineParameter("osImage", "Select OS image",
27+
portal.ParameterType.IMAGE,
28+
imageList[0], imageList,
29+
longDescription="Most clusters have this set of images, " +
30+
"pick your favorite one.")
31+
32+
# Optional physical type for all nodes.
33+
pc.defineParameter("physType", "Optional physical node type",
34+
portal.ParameterType.STRING, "",
35+
longDescription="Specify a physical node type (pc3000,d710,etc) " +
36+
"instead of letting the resource mapper choose for you.")
37+
38+
# Optional ephemeral blockstore
39+
pc.defineParameter("tempFileSystemSize", "Temporary Filesystem Size",
40+
portal.ParameterType.INTEGER, 0,advanced=True,
41+
longDescription="The size in GB of a temporary file system to mount on each of your " +
42+
"nodes. Temporary means that they are deleted when your experiment is terminated. " +
43+
"The images provided by the system have small root partitions, so use this option " +
44+
"if you expect you will need more space to build your software packages or store " +
45+
"temporary files.")
46+
47+
# Instead of a size, ask for all available space.
48+
pc.defineParameter("tempFileSystemMax", "Temp Filesystem Max Space",
49+
portal.ParameterType.BOOLEAN, False,
50+
advanced=True,
51+
longDescription="Instead of specifying a size for your temporary filesystem, " +
52+
"check this box to allocate all available disk space. Leave the size above as zero.")
53+
54+
pc.defineParameter("tempFileSystemMount", "Temporary Filesystem Mount Point",
55+
portal.ParameterType.STRING,"/mydata",advanced=True,
56+
longDescription="Mount the temporary file system at this mount point; in general you " +
57+
"you do not need to change this, but we provide the option just in case your software " +
58+
"is finicky.")
59+
60+
# Retrieve the values the user specifies during instantiation.
61+
params = pc.bindParameters()
62+
63+
if params.tempFileSystemSize < 0 or params.tempFileSystemSize > 200:
64+
pc.reportError(portal.ParameterError("Please specify a size greater then zero and " +
65+
"less then 200GB", ["tempFileSystemSize"]))
66+
pc.verifyParameters()
67+
68+
# Add a raw PC to the request.
69+
node = request.RawPC("node")
70+
71+
# Set OS Image
72+
if params.osImage and params.osImage != "default":
73+
node.disk_image = params.osImage
74+
75+
# Optional hardware type.
76+
if params.physType != "":
77+
node.hardware_type = params.physType
78+
79+
# Optional Blockstore
80+
if params.tempFileSystemSize > 0 or params.tempFileSystemMax:
81+
bs = node.Blockstore("node-bs", params.tempFileSystemMount)
82+
if params.tempFileSystemMax:
83+
bs.size = "0GB"
84+
else:
85+
bs.size = str(params.tempFileSystemSize) + "GB"
86+
bs.placement = "any"
87+
88+
# Install and execute a script that is contained in the repository.
89+
node.addService(pg.Execute(shell="bash", command="/local/repository/changeShells.sh"))
90+
node.addService(pg.Execute(shell="bash", command="/local/repository/setupAll.sh"))
91+
92+
# Print the RSpec to the enclosing page.
93+
pc.printRequestRSpec(request)
94+

setupAll.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
mail -s "TrainTicket instance is setting up!" $(geni-get slice_email)
4+
5+
source /local/repository/aptSetup.sh
6+
source /local/repository/shcSetup.sh
7+
source /local/repository/dockerSetup.sh
8+
9+
mail -s "TrainTicket instance finished setting up!" $(geni-get slice_email)

shcSetup.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
sudo apt install shc
3+

0 commit comments

Comments
 (0)