- Download & install Virtual Box
- Download & install Vagrant (see below for some commands)
- Clone the git repository to some directory
- use
vagrant ssh
when within the directory in your terminal to enter the vm - the project directory is mounted at
/vagrant
cd scripts/init_machine
- execute the init_machine script
- if necessary, run
npm install
```
Host my-server
HostName <ip address>
User ubuntu
Port 22
IdentityFile "~/.ssh/<file containing your ssh key>"
```
- notes
- ubuntu is default username for an ubuntu EC2 instance
- you can now connect via 'ssh my-server'
- IdentityFile may be unnecessary if you get your usual public key into the
authorized keys section of the server
- you can call Host whatever you want, its just a name for your own use
Note that autoscaling will do this for us after we make an AMI
- create ec2 instance (t2 micro or other cheap type)
- security groups:
- allow http/https from everywhere
- allow ssh from anywhere (for now)
- allow icmp for echo requests (so ping works during testing)
- vpc
- use the default one (for now)
- use rsync to transfer the code over
rsync -avzhe ssh my-server/ my-server:/opt/app --exclude ".git"
- note: may require a manual step
- go to init machine directory, THEN execute init machine.sh
Start the server in server mode: npm run serve
- you can ctrl-c out of this a few seconds later since its using a module
called 'forever' to run
Start the server in local dev mode (use this except for prod server)
- npm start
vagrant up
- start a vm
vagrant halt
- force stop vm without deleting it
vagrant suspend
- like halt, but graceful and not forced
vagrant ssh
- ssh into a vm
vagrant destroy
- delete a vm
vagrant status
-get status of vms