- AWS account is created
- Non-root user is created
- VPC exists in the us-east-1 region
- We can go over the networking of what this should look like
- Log into your AWS account
- Click EC2 --> Instances
- Click Launch Instance
- Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-43a15f3e
- t2.micro (for now, free)
- Make sure subnet is public
- Make sure you auto-assign a public IP (Enable)
- Storage is dependent on your database, logging, etc. situation
- Add a "Name" tag
- Create or use a security group configured according to the information below (see Security Group Information)
- Make sure you have whatever key pair you choose (or create a new one)
- Wait until your instance is in state "running"
- Note the public IP of your instance (IPv4 Public IP)
- SSH onto the host
- Need to use terminal or puTTY
- Add your SSH key to the keychain (if terminal)
- ssh ubuntu@${PUBLIC_IP}
* port 22 TCP (for SSH)
* port 3838 TCP (for Shiny)
* port 80 TCP (if installing nginx)
* port 443 TCP (if installing nginx)
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
- sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
- sudo apt-get update
- sudo apt-get install r-base
- sudo -i R (test your installation)
- sudo R -e "install.packages(c('shiny', 'rmarkdown'), repos='http://cran.rstudio.com/')"
- sudo apt-get install gdebi-core
- wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb
- sudo gdebi shiny-server-1.5.7.907-amd64.deb
sudo systemctl start shiny-server
sudo systemctl stop shiny-server
- scp -r ${REPO}/ ubuntu@${PUBLIC_IP}:/home/ubuntu
- ssh ubuntu@${PUBLIC_IP}
- sudo mv /home/ubuntu/${REPO} /srv/shiny-server/
-
sudo apt-get install -y nginx
-
Make the following configuration changes: A) To /etc/nginx/nginx.conf: add:
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
below
# Basic Settings
in thehttp {}
block B) Create /etc/nginx/conf.d/shiny.conf (see shiny.conf file)
- /var/log/nginx/access.log
- /var/log/nginx/error.log
- /var/log/shiny-server/${app}.log
- Navigate to www.freenom.com
- Find a domain name you would like (for free!)
- Checkout
- https://my.freenom.com/knowledgebase.php?action=displayarticle&id=33
- https://www.youtube.com/watch?v=UpyAJkhXFFc
- Consider using a load balancer and auto-scaling group
- Consider writing a script to install R and your dependencies and adding it to your instance's userdata
- Consider hosting your apps in S3 for versioning
- Consider creating a base AMI that has R, Shiny Server installed, nginx configuration set up
- Spin up an instance, install these dependencies, create an AMI
- Select your Instance --> Image --> Create Image
- Spin up an instance, install these dependencies, create an AMI
- Consider adding an EIP (Elastic IP) to your instance so your DNS records do not need to change