docker ps shows running containers, amd docker container ls lists available containers
docker ps
docker container ls
module.exports = function (api) { | |
api.cache(true); | |
const presets = [ | |
'@babel/preset-env', | |
'@babel/preset-react', | |
] | |
const plugins = [ | |
] |
defmodule WorkshopWeb.HomeView do | |
use WorkshopWeb, :view | |
end |
defmodule WorkshopWeb.HomeController do | |
use WorkshopWeb, :controller | |
def index(conn, _params) do | |
render( | |
conn, | |
"index.html", | |
props: Jason.encode!(%{foo: "bar"}) | |
) | |
end |
defmodule WorkshopWeb.Router do | |
use WorkshopWeb, :router | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_live_flash | |
plug :put_root_layout, {WorkshopWeb.LayoutView, :root} | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers |
# make sure to move your .pem file for SSH auth to ~/.ssh & chmod 0400 the file | |
chmod 0400 your-server-identity.pem | |
# open ~/.ssh/config with your favorite text editer and drop in the following plumbing (replace the IP/host of your server and username and point to the correct pem file) | |
Host my-server | |
HostName 54.157.228.255 | |
User your-user-name | |
IdentityFile ~/.ssh/your-server-identity.pem | |
IdentitiesOnly yes | |
sudo apt-get update -y && sudo apt-get upgrade -y | |
sudo apt install postgresql -y | |
sudo su postgres | |
psql -U postgres -c "CREATE ROLE ubuntu;" | |
psql -U postgres -c "ALTER ROLE ubuntu WITH LOGIN;" | |
psql -U postgres -c "ALTER USER ubuntu CREATEDB;" | |
psql -U postgres -c "ALTER USER ubuntu WITH PASSWORD 'ubuntu';" | |
exit |
#to run curl link_to_this_raw_gist | sudo bash | |
sudo apt-get update -y && sudo apt-get upgrade -y | |
sudo apt install curl -y | |
sudo apt-get install tmux -y | |
sudo apt install nodejs -y && sudo apt install npm -y | |
sudo apt-get install htop build-essential zlib1g-dev openssl libreadline6-dev git-core zlib1g libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf automake libtool bison libgecode-dev -y && sudo apt-get install libpq-dev -y | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc && echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv && git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build |
This hacky configuration is not right. You should always use a unix socket as its more secure and performant. This is setup assuming that there is a server listening on port 3000
RAILS_ENV=production rails db:create
RAILS_ENV=production rails db:migrate
RAILS_ENV=production rails assets:precompile
RAILS_ENV=production rails s
upstream app {