Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Herlon Aguiar herlon214

View GitHub Profile
@herlon214
herlon214 / init
Created Jan 18, 2019
Bash to work with gdsm
View init
#!/bin/bash
export $(curl http://169.254.169.254/latest/user-data)
docker swarm leave
docker swarm join --token TOKEN GDSM_IP:2377
NODE=$(docker info --format '{{ .Swarm.NodeID}}')
curl http://GDSM_IP:3300/label -X POST -d $(printf '{"ServiceName":"%s","NodeID":"%s"}' $SERVICE $NODE) -H "Content-Type: application/json"
@herlon214
herlon214 / init.service
Created Jan 18, 2019
Service starts after docker
View init.service
[Unit]
Description=Initialize docker
After=docker.service
Requires=docker.service
BindsTo=docker.service
[Service]
ExecStart=/bin/bash /home/core/init
ExecReload=/bin/bash /home/core/init
ExecStop=/bin/bash /home/core/init
@herlon214
herlon214 / Dockerfile
Created Dec 7, 2018
Compile and build NodeJS
View Dockerfile
# Build
FROM node:8.10.0 as builder
ENV NODE_ENV development
WORKDIR /app
COPY [".", "./"]
RUN yarn install --production=false && yarn compile
# Run
FROM node:8.10.0
View jest_with_parcel.txt
// babel.rc
{
"presets": [
"es2015"
]
}
// package.json
{
"dependencies": {
View FilterBranchName.sh
echo 'feature/testingGDSC' | sed -e 's/\//-/g'
@herlon214
herlon214 / Go build with docker
Created May 19, 2018
Build a go project within a Docker container
View Go build with docker
docker run --rm -v ${PWD}:/go/src/github.com/herlon214/gdsc -w /go/src/github.com/herlon214/gdsc/cmd/gdsc golang:latest /bin/bash -c "go get -v && go build -v -o /go/src/github.com/herlon214/gdsc/dist"
View NPM fix docker permissions.md

Fix npm docker permissions

Add this line into your Dockerfile

RUN npm config set unsafe-perm=true

@herlon214
herlon214 / Dockerfile
Created Mar 29, 2018 — forked from nknapp/Dockerfile
Traefik setup as reverse-proxy with docker and letsencrypt
View Dockerfile
FROM traefik:camembert
ADD traefik.toml .
EXPOSE 80
EXPOSE 8080
EXPOSE 443
View Mysql create user and give permissions to database.md
CREATE USER 'user'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database.* TO 'user'@'%';
View Wordpress with SSL (Traefik) and AWS S3.md

Fix SSL

Put this in wp-config.php

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
define('WP_HOME','https://your.site/');
define('WP_SITEURL','https://your.site/');

Media Upload & S3

You can’t perform that action at this time.