Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/masbicudo/ufrj-org-info-trab-final
https://github.com/masbicudo/ufrj-org-info-trab-final
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/masbicudo/ufrj-org-info-trab-final
- Owner: masbicudo
- Created: 2019-11-25T04:00:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T19:02:03.000Z (almost 3 years ago)
- Last Synced: 2023-03-31T04:01:35.748Z (almost 2 years ago)
- Language: TypeScript
- Size: 72.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Intro
Este é o meu trabalho final da disciplina de Organização da Informação da UFRJ.
# Uploading to AWS
## Creating an EC2 instance
After creating an AWS account, go to `Services`, then `EC2`.
Click the button `Launch instance`.
Select one image from the `Quick start` group
(it's the default group).Be careful when searching for images, since results
can show paid instances from AWS Marketplace,
resulting in costs both with software and the instance itself.Choose `Ubuntu Server 18.04 LTS (HVM), SSD Volume Type`, for example.
Choose `t2.micro` (free tier eligible).
Free tier is available in the 1st year of your AWS account.Click the button `Review and Launch`, then `Launch`.
Now you will be asked for a key pair to connect via ssh.
Create one if you don't already have, and download the key pair.## Installing the key
This is optional. It's meant to associate the key with the host, so that you don't have to indicate the key file
every time you want to connect to the instance.First copy the `.pem` file you selected or created before to `~/.ssh/`.
In Windows `~` is equivalente to `%USERPROFILE%`.Now in the `~/.ssh` folder, create a `config` file and add:
Host ec2-0-0-0-0.us-east-2.compute.amazonaws.com
IdentityFile ~/.ssh/key-file.pemSee [OpenSSH Config File Examples - nixCraft](https://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/) for more.
## Connecting for the first time
A strange message will appear if this is the first time
you connect to this instance, about the authenticity of the
server. Just type `yes`.See [SSH: The authenticity of host can't be established - StackOverflow](https://superuser.com/questions/421074/ssh-the-authenticity-of-host-host-cant-be-established) for more.
## Copying file via scp
Build the project and then copy the build folder to the instance:
scp -r build [email protected]:./build
## Connecting via ssh
At the command line, connect via ssh:
## Running the server
After connecting via ssh, install nodejs (ref: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/)
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install nodejsThen run the server, if you copied everything to the `build` folder already:
cd build
npm install
sudo node server.js $(ec2metadata --local-ipv4)## Keep process running after closing ssh connection
[Keep running a python program even after logging-off the ssh session [duplicate] - askubuntu](https://askubuntu.com/questions/921494/keep-running-a-python-program-even-after-logging-off-the-ssh-session)
### screen
The screen command can be used to keep a process running
in the server when the user closes the ssh connection.ref: https://superuser.com/questions/454907/how-to-execute-a-command-in-screen-and-detach
ref: https://dev.to/bobbyiliev/how-to-keep-a-process-running-even-after-closing-ssh-connection-3cekCreate a new screen
screen -S SOME_NAME_HERE
Detach from session:
ctrl+a ctrl+d
Restore a previously created screen
screen -R SOME_NAME_HERE
Lists the available screens
screen -ls
Running nodejs server using `screen` in a single line:
screen -dmS server sudo node server.js $(ec2metadata --local-ipv4)
# References
[How to keep a program running after closing SSH client - StackOverflow](https://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session)