File size: 2,161 Bytes
5d87633
 
 
 
 
3115519
b7323a5
46bf03b
3115519
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
5d87633
46bf03b
 
bcc9ddf
46bf03b
 
 
5d87633
 
 
 
 
 
 
46bf03b
3115519
 
 
 
bcc9ddf
3115519
46bf03b
 
3115519
 
 
 
46bf03b
 
3115519
46bf03b
 
3115519
46bf03b
3115519
46bf03b
 
3115519
46bf03b
 
 
 
 
3d3f5a1
 
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
#! /bin/bash

PORT=22003
MACHINE=paffenroth-23.dyn.wpi.edu

# Clean up from previous runs
ssh-keygen -f "/home/amcreelman/.ssh/known_hosts" -R "[${MACHINE}]:${PORT}"
rm -rf tmp2

# Create a temporary directory
mkdir tmp2

# copy the key to the temporary directory
cp wormington_keys/student-admin_key* tmp2

# copy the key to the temporary directory
cp wormington_keys/group_key* tmp2

# Change to the temporary directory
cd tmp2

# Set the permissions of the key
chmod 600 student-admin_key*

# Set the permissions of the key
chmod 600 group_key*

# skip creating unique key -- already have

# Insert the key into the authorized_keys file on the server
# One > creates
cat group_key.pub > authorized_keys
# two >> appends
# Remove to lock down machine
#cat student-admin_key.pub >> authorized_keys

chmod 600 authorized_keys

echo "checking that the authorized_keys file is correct"
ls -l authorized_keys
cat authorized_keys

# Copy the authorized_keys file to the server
scp -i student-admin_key -P ${PORT} -o StrictHostKeyChecking=no authorized_keys student-admin@${MACHINE}:~/.ssh/

# Add the key to the ssh-agent
eval "$(ssh-agent -s)"
ssh-add group_key

# entered our password

# Check the key file on the server
echo "checking that the authorized_keys file is correct"
ssh -p ${PORT} -o StrictHostKeyChecking=no student-admin@${MACHINE} "cat ~/.ssh/authorized_keys"

# clone the repo
git clone https://github.com/alyshacreelman/Wormington-Scholar

# Copy the files to the server
scp -P ${PORT} -o StrictHostKeyChecking=no -r Wormington-Scholar student-admin@${MACHINE}:~/

# from here on code is currently commented out in Randy's code

# check that the code in installed and start up the product
COMMAND="ssh -p ${PORT} -o StrictHostKeyChecking=no student-admin@${MACHINE}"

${COMMAND} "ls Wormington-Scholar"
${COMMAND} "sudo apt install -qq -y python3-venv"
${COMMAND} "cd Wormington-Scholar && python3 -m venv venv"
${COMMAND} "cd Wormington-Scholar && source venv/bin/activate && pip install -r requirements.txt"
${COMMAND} "nohup Wormington-Scholar/venv/bin/python3 Wormington-Scholar/app.py > log.txt 2>&1 &"

# nohup ./whatever > /dev/null 2>&1