Skip to content

Instantly share code, notes, and snippets.

@redhajuanda
Last active May 11, 2022 05:20
Show Gist options
  • Select an option

  • Save redhajuanda/d35e547270c794f87efb313afae3fbf6 to your computer and use it in GitHub Desktop.

Select an option

Save redhajuanda/d35e547270c794f87efb313afae3fbf6 to your computer and use it in GitHub Desktop.
# docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker your-user
# docker ubuntu 20.04
sudo apt install docker.io
sudo systemctl enable --now docker
sudo usermod -aG docker SOMEUSERNAME
docker --version
# mysql on docker
mkdir -p /storage/docker/mysql-data
docker run \
-d \
--name=mysql\
-e MYSQL_ROOT_PASSWORD=mysql \
-p 3306:3306 \
--volume=/root/docker/mysql/conf.d:/etc/mysql/conf.d \
--volume=/storage/docker/mysql-data:/var/lib/mysql \
--restart=unless-stopped \
mysql
apt-get install mysql-client
# mariadb on docker
docker run --detach --name mariadb --env MARIADB_USER=mariadb --env MARIADB_PASSWORD=mariadb --env MARIADB_ROOT_PASSWORD=mariadb -p 3306:3306 mariadb:latest
sudo apt install wget
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
echo "fd3f41eefff54ce144c932100f9e0f9b1d181e0edd86a6f6b8f2a0212100c32c mariadb_repo_setup" \
| sha256sum -c -
chmod +x mariadb_repo_setup
sudo ./mariadb_repo_setup \
--mariadb-server-version="mariadb-10.5"
sudo apt update
sudo apt install mariadb-client
mariadb --host 127.0.0.1 --port 3306 \
--user mariadb --password \
# postgres on docker
docker run \
-d \
--name=postgres\
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
-v /storage/docker/postgres-data:/var/lib/postgresql/data \
--restart=unless-stopped \
postgres
sudo apt-get install postgresql-client
psql -h localhost -U postgres -d postgres
# golang
curl -O https://storage.googleapis.com/golang/go1.14.7.linux-amd64.tar.gz
tar -xvf go1.14.7.linux-amd64.tar.gz
sudo mv go /usr/local
sudo vim ~/.bashrc
# Go Global variables
export GOROOT=/usr/local/go
export GOPATH=$HOME/gopath
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export CGO_ENABLED=0
export GO111MODULE=on
export GOPRIVATE=gitlab.sicepat.tech
source ~/.bashrc
git config --global url."git@gitlab.sicepat.tech:".insteadOf "https://gitlab.sicepat.tech"
go version
# NODE JS #
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm list-remote
nvm install v16.4.0
nvm list
# php laravel
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.4 php7.4-fpm libapache2-mod-php7.0 php7.4-cli php7.4-curl php7.4-mysql php7.4-sqlite3 \
php7.4-gd php7.4-xml php7.1-mcrypt php7.4-mbstring php7.4-iconv php7.4-zip
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo chown -R $USER $HOME/.composer
# insomnia rest
# Add to sources
echo "deb https://dl.bintray.com/getinsomnia/Insomnia /" \
| sudo tee -a /etc/apt/sources.list.d/insomnia.list
# Add public key used to verify code signature
wget --quiet -O - https://insomnia.rest/keys/debian-public.key.asc \
| sudo apt-key add -
# Refresh repository sources and install Insomnia
sudo apt-get update
sudo apt-get install insomnia
# elastic search on docker
docker run --name "elastic" -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --restart=unless-stopped docker.elastic.co/elasticsearch/ela^Cicsearch:7.8.1
# COMMON ISSUES
## Connect to local MYSQL from docker container
Use the docker host ip. First get the host ip address on the docker network (in linux type
```ip addr show```
and look for the docker0 ip). This is usually something like 172.17.0.1 (your mileage may vary). Then you should be able to use that ip address to connect to mariadb for example 172.17.0.1:3306
# nginx
server {
listen 80;
listen [::]:80;
server_name reyaja.com www.reyaja.com;
root /var/www/reyaja.com;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
-- name server --
upstream be {
server 0.0.0.0:3000;
}
server {
server_name api.pinteran.com;
server_tokens off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
location / {
proxy_pass http://be;
}
}
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt install certbot python3-certbot-nginx
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow 'OpenSSH'
sudo ufw allow ssh
sudo certbot --nginx -d example.com -d www.example.com
# ===============================================================#
# POSTGRES CLIENT
#
# Setup the repository
#
# Install the public key for the repository (if not done previously):
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
# Create the repository configuration file:
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
#
# Install pgAdmin
#
# Install for both desktop and web modes:
sudo apt install pgadmin4
# Install for desktop mode only:
sudo apt install pgadmin4-desktop
# Install for web mode only:
sudo apt install pgadmin4-web
# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh
#======================================================================#
#krakenD
docker run -p 8080:8080 --add-host=host.docker.internal:host-gateway -v $PWD:/etc/krakend/ devopsfaith/krakend run --config /etc/krakend/krakend.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment