This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:17.0.1 | |
ARG BUILD_ENV | |
RUN mkdir -p /usr/src/app | |
COPY package*.json /usr/src/app/ | |
RUN cd /usr/src/app/; npm install | |
WORKDIR /usr/src/app | |
COPY . /usr/src/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by .ignore support plugin (hsz.mobi) | |
### Node template | |
# Logs | |
/logs | |
*.log | |
npm-debug.log* | |
yarn-debug.log* | |
yarn-error.log* | |
# Runtime data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.7.1@soon-to-be-programmer-deploy-demo/wrappers/ruby; | |
ssl_prefer_server_ciphers on; | |
# Add HSTS | |
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; | |
client_max_body_size 20M; | |
listen 443; | |
server_name demo.soontobeprogrammer.com; | |
passenger_enabled on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.7.1@soon-to-be-programmer-deploy-demo/wrappers/ruby; | |
listen 80; | |
server_name demo.soontobeprogrammer.com; | |
passenger_enabled on; | |
root /home/ubuntu/soon-to-be-programmer-deploy-demo/public; | |
rails_env production; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
server_name _; | |
index index.html index.htm index.nginx-debian.html; | |
root /var/www/html; | |
location ^~ /.well-known/acme-challenge { | |
allow all; | |
default_type "text/plain"; | |
} | |
location / { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream MY_APP { | |
server 127.0.0.1:3000; | |
server 127.0.0.1:3000 max_fails=1 fail_timeout=30s backup; | |
keepalive 64; | |
} | |
server { | |
listen 80 default_server; | |
server_name _; | |
location / { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check installation instruction from github rvm | |
# ignore rdoc for faster gem installation (run this command) | |
echo "gem: --no-document" >> ~/.gemrc | |
# make sure you have NodeJS and Yarn installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For NodeJS install | |
nginx-extras | |
# For NodeJS + Ruby on Rails install Nginx Passenger from official website | |
https://www.phusionpassenger.com/library/install/nginx/install/oss/bionic/ | |
# Install certbot | |
https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx.html | |
# Requesting certificate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add user | |
adduser ubuntu | |
# Set to super user | |
usermod -aG sudo ubuntu | |
# Switch user | |
sudo su ubuntu | |
# Add .ssh to ubuntu user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this setup 4GB of swap file. | |
sudo fallocate -l 4G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab' | |
# reboot once | |
sudo reboot | |
# SSH back to server and check swapon again. | |
# check swap file |
NewerOlder