Skip to content

Commit 7d0ceb4

Browse files
committed
Fix AWS vagrant file and start documentation
1 parent cd8bd4a commit 7d0ceb4

4 files changed

Lines changed: 77 additions & 11 deletions

File tree

Readme-AmazonWebServices.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
**Making your own Macaulay2 web server which
2+
runs on Amazon Web Services (AWS, i.e. on the Amazon cloud)**
3+
4+
There are a number of steps to set this up,
5+
due to the complexity of AWS. But, it really isn't
6+
so bad.
7+
8+
* Create an account on AWS.
9+
* Learn how to log on to the AWS Console
10+
11+
The steps needed to create a virtual machine on AWS running tryM2. The specific
12+
directions might change, as it depends on Amazon's web interface.
13+
14+
* Create a user with admin priviledges
15+
* Create a key (this is a file that you will download
16+
called credentials.csv. You will need to open this file later and extract the information. )
17+
* Create a Key Pair:
18+
* Go to the EC2 Console
19+
* Go to Network and Security -- Key Pairs
20+
* Create a KeyPair. You will give it a name and description.
21+
This will download a file with a .pem extension, which you
22+
will refer to below.
23+
* Add a security group, with the following information:
24+
Custom TCP, incoming port 8002, 0.0.0.0/0, name it 'default'.
25+
26+
Now, back on your machine, you will need to install**vagrant**and
27+
make sure you have**wget**as well (if not, you can download the file below from your browser). After that, do the following.
28+
29+
* In a command line, download the vagrant file we will use.
30+
* `wget https://github.com/fhinkel/InteractiveShell/blob/master/Vagrantfile_aws`
31+
* You will need to edit this file, to change the following items.
32+
*
33+
34+
InteractiveShell/Vagrantfile_aws

Vagrantfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
mathProgram = "M2"
66
npmCmd = "npm start"
77
logfilePath = "/home/vagrant/web" + mathProgram + ".log"
8-
cronString = "SHELL=/bin/bash\n";
9-
cronString += "@reboot source ~/.nvm/nvm.sh; until [ -d /home/vagrant/InteractiveShell/public ]; do sleep 1; done; cd /home/vagrant/InteractiveShell; " + npmCmd + " 2>&1 > " + logfilePath
108

119
# All Vagrant configuration is done below. The "2" in Vagrant.configure
1210
# configures the configuration version (we support older styles for

Vagrantfile_aws

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#
1111
# https://github.com/mitchellh/vagrant-aws
1212
#
13+
14+
# Settings:
15+
mathProgram = "M2"
16+
npmCmd = "npm start"
17+
logfilePath = "/home/vagrant/web" + mathProgram + ".log"
18+
1319
Vagrant.configure(2) do |config|
1420

1521
# Use a dummy box, since aws-provider will just copy an already existing AMI.
@@ -50,21 +56,49 @@ Vagrant.configure(2) do |config|
5056
override.ssh.username = "ubuntu"
5157
end
5258

53-
#
54-
# Third line since username is already given by aim.
55-
config.vm.provision "shell", privileged:false, inline: <<-SHELL
56-
sudo apt-get update && apt-get upgrade -y
57-
sudo apt-get install -y nodejs npm wget
58-
sudo ln -s /home/ubuntu /home/vagrant
59+
config.vm.provision "sudo", type:"shell", privileged:true, inline: <<-SHELL
60+
apt-get update && apt-get upgrade -y
61+
apt-get install -y nodejs npm wget
5962
wget -qO- https://get.docker.com/ | sh
60-
sudo ln -s /usr/bin/nodejs /usr/bin/node
63+
ln -s /usr/bin/nodejs /usr/bin/node
64+
ln -s /home/ubuntu /home/vagrant
65+
SHELL
66+
67+
config.vm.provision "gitclone", type:"shell", privileged:false, inline: <<-SHELL
6168
git clone https://github.com/fhinkel/InteractiveShell.git
69+
SHELL
70+
71+
config.vm.provision "nvm", type:"shell", privileged:false, inline: <<-SHELL
72+
curl https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
73+
source ~/.nvm/nvm.sh;
74+
nvm install stable
75+
nvm use stable
76+
SHELL
77+
78+
config.vm.provision "node-modules", type:"shell", privileged:false, inline: <<-SHELL
6279
cd InteractiveShell
6380
npm install
64-
git pull --no-verify
81+
SHELL
82+
83+
config.vm.provision "docker", type:"shell", privileged:false, inline: <<-SHELL
84+
cd InteractiveShell
85+
git pull
6586
rm id_rsa*
6687
ssh-keygen -b 1024 -f id_rsa -P ''
6788
sudo docker build -t m2container .
6889
SHELL
6990

91+
92+
# config.vm.provision "cron", type:"shell", privileged:false do |cron|
93+
# cron.inline = "echo \"" + cronString + "\" > tmpcron; crontab tmpcron; rm tmpcron"
94+
# end
95+
96+
config.vm.provision "startup_server", type:"shell", privileged:false, run: "always", inline: <<-SHELL
97+
source ~/.nvm/nvm.sh
98+
cd InteractiveShell
99+
git pull --no-verify
100+
101+
npm start 2>&1 > ../webm2.log &
102+
SHELL
103+
70104
end

src/startupConfigs/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var configuration = function(overrideOptions) {
2323
},
2424
perContainerResources: {
2525
cpuShares: 2,
26-
memory: 128
26+
memory: 256
2727
},
2828
hostConfig: {
2929
minContainerAge: 10,

0 commit comments

Comments
 (0)