Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Machine setup: postgres11, nodejs 4.2.6, python 3.7
$ adduser leonardo
$ usermod -aG sudo leonardo
$ su - leonardo
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ vim ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/authorized_keys
$ exit
$ su - leonardo
$ sudo vim /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
$ sudo systemctl reload sshd
$ sudo ufw app list
$ sudo ufw allow OpenSSH
$ sudo ufw allow 'Nginx HTTP'
$ sudo ufw enable
$ sudo ufw status
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" > /etc/apt/sources.list.d/PostgreSQL.list'
$ sudo apt-get -y update
$ sudo apt-get install postgresql postgresql-contrib
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.7
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo -H python3.7 ./get-pip.py
$ sudo -H pip install virtualenv
$ sudo -H pip install virtualenvwrapper
$ which python3.7
$ vim .bashrc
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.7
source /usr/local/bin/virtualenvwrapper.sh
export WORKON_HOME=$HOME/.virtualenvs
$ mkdir ~/.virtualenvs
$ source ~/.bashrc
$ mkvirtualenv manotes-api
$ sudo apt-get install nginx
$ sudo apt-get install redis-server
$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ sudo npm install -g bower
$ sudo npm install -g grunt
$ sudo npm install -g grunt-cli
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
$ ssh-keygen -t rsa -C "boitata"
$ sudo apt-add-repository -y ppa:rael-gc/rvm
$ sudo apt-get update
$ sudo apt-get install rvm
$ exit
$ rvm install 2.3.3
$ rvm use 2.3.3
$ gem install bundler
$ cd /projects/manotes-app
$ bundler install
$ cd /home/projects/manotes-app
$ npm install
$ bower install
$ cd
$ vim .bashrc
alias load-env='export $(cat .env | xargs)'
alias load-env-test='export $(cat .env.test | xargs)'
$ cd /etc/systemd/system/
$ sudo vim manotes-api.service
[Unit]
Description=Manotes daemon
After=network.target
[Service]
User=leonardo
EnvironmentFile=/home/leonardo/projects/.env
WorkingDirectory=/home/leonardo/projects/manotes-api
ExecStart=/home/leonardo/.virtualenvs/manotes-api/bin/gunicorn --config gunicorn_conf.py src.initialize:web_app
[Install]
WantedBy=multi-user.target
$ sudo vim manotes-api.celery.service
[Unit]
Description=Manotes daemon
After=network.target
[Service]
User=leonardo
EnvironmentFile=/home/leonardo/projects/.env
WorkingDirectory=/home/leonardo/projects/manotes-api
ExecStart=/home/leonardo/.virtualenvs/manotes-api/bin/celery worker -A src.initialize -l info
[Install]
WantedBy=multi-user.target
$ sudo apt-get install daemon # nao sei se precisa
$ daemon reload # nao sei se precisa
$ sudo apt-get install htop
$ systemctl daemon-reload
$ sudo service manotes-api start
# elasticsearch (in progress)
$ sudo apt-get install default-jre # Não sei se precisa
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ sudo apt-get install apt-transport-https
$ echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo vim /etc/default/elasticsearch
START_DAEMON=true
$ sudo systemctl restart elasticsearch.service
$ sudo apt-get update && sudo apt-get install kibana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.