Progressive Project for CMPE272 Team Warriors Team Members:
- Pradeep
- Sanjeevi
- Senthil
- Yuva
Learning to build and deploy Flask based webserver using web example
Reference MicroBlog - Building a Simple Web Server using Flask
- Flask - The web framework used
(venv) $ export FLASK_APP=microblog.py
(venv) $ sudo bash
(venv) root $ . venv/bin/activate
(venv) root $ flask run --host=0.0.0.0 --port=80
- Clone git repository to root
$ cd ~/CMPE272
$ git init
$ git remote add origin https://github.com/YuvaAthur/cmpe272.git
$ git pull origin master
-
Remote connection from VSCode
- Ref: Search: "running vscode on ec2 ubuntu instance"
- Ref: https://medium.com/@prtdomingo/editing-files-in-your-linux-virtual-machine-made-a-lot-easier-with-remote-vscode-6bb98d0639a4
- Ref: (Sublime) http://blog.keyrus.co.uk/editing_files_on_a_remote_server_using_sublime.html
- Ref: https://askubuntu.com/questions/812192/installing-visual-studio-code-on-aws
-
Steps for remote VS Code
- Add Remote VSCode Extension
- Implemented by : Rafael Maiolla : Needs to be security checked?
- Reload VS Code
- Run
>Reload Window
from command palette
- Run
- Install rmate on EC2 instance
- Add Remote VSCode Extension
sudo wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate
sudo chmod a+x /usr/local/bin/rmate
- Execute
>Remote: Start Server
from command palette - Add Remote access to .ssh/config file
RemoteForward 52698 127.0.0.1:52698
- Or use command line
ssh -R 52698:localhost:52698 ec2-54-80-101-121.compute-1.amazonaws.com
- Consider using sshfs to mount remote fs over ssh
- Install Fuse and sshfs on Mac OS
sudo apt-get install sshfs # for linux
- Create a mount point
- Note: Change from
defer_permissions
todefault_permissions
- Note: Change from
sudo mkdir /mnt/awscmpe272
sudo sshfs -o allow_other,default_permissions,IdentityFile=~/.ssh/CMPE272 ubuntu@ec2-54-80-101-121.compute-1.amazonaws.com:CMPE272 /mnt/awscmpe272
- Unmount
sudo umount /mnt/awscmpe272
- Setting up AWS Destop environment
$ sudo apt-get update -y
$ sudo apt-get install lxde -y
$ sudo apt-get install xrdp -y
$ sudo passwd ubuntu 'pass1234'
$ vi /etc/xrdp/xrdp.ini
* Open RDP Port (3389) on AWS inbound ports
$ sudo service xrdp restart
* Use startx
$ sudo update-alternatives --config x-session-manager
$ sudo useradd -m awsgui
$ sudo passwd awsgui # 'pass1234'
$ sudo usermod -aG admin awsgui
$ sudo vim /etc/ssh/sshd_config # edit line "PasswordAuthentication" to yes
$ sudo /etc/init.d/ssh restart
$ sudo apt-get update
$ sudo apt-get install ubuntu-desktop
$ sudo apt-get install vnc4server
$ su - awsgui # ^D to exit
$ vncserver # set password 'pass1234'
$ vncserver -kill :1
$ vim /home/awsgui/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec sh /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
$ vncserver
$ sudo iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
-
MacOSX Client side
- Install vnc viewer
-
Install VSCode
$ sudo apt update
$ sudo apt install software-properties-common apt-transport-https wget
$ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
$ sudo apt install code
$ sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget