Skip to content

Instantly share code, notes, and snippets.

View EdisonArango's full-sized avatar
:shipit:

Edison Arango EdisonArango

:shipit:
View GitHub Profile
@EdisonArango
EdisonArango / httpd.conf
Last active August 27, 2018 23:08
Apache httpd.conf Django
ServerRoot "/home/edwinmore1/webapps/merco2/apache2"
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule wsgi_module modules/mod_wsgi.so
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
@EdisonArango
EdisonArango / Docker commands
Last active April 8, 2020 02:40
Docker commands
# INFO: REPLACE EVERYTHING INSIDE <>
# Start docker server in centos
sudo systemctl start docker
# Build and tag image
docker build -t <username>/<project_name>:<tag> <project_path>
# Create docker secret
echo "<secret>" | docker secret create <secret_name> -

Backup

Dump entire database into SQL

pg_dump -h <host> -p <port> -U <user> <db_name> > <filename>.sql

The port is not required in case it's the default

Example:

# Dumpdata indented
python manage.py dumpdata <app> --indent=2 > <filename>.json
# Dumpdata with natural keys (No numeric) and indented
python manage.py dumpdata <app> --natural-foreign --natural-primary --indent=2 > <filename>.json

Installation and Configuration

After installing with curl | bash, or another way you should go to the server ip or domain name.

Dokku allows users to push with the ssh public key, in Mac it's usually a file located here "~/.ssh/id_rsa.pub"

To manage dokku ssh-keys run inside the dokku machine:

dokku ssh-keys
1. Install the aws cli with pip3:
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
2. Set up Amazon Elastic Container Registry (ECR)
https://docs.aws.amazon.com/AmazonECR/latest/userguide/ECR_GetStarted.html
> This is a service like docker hub to push docker images, after configuring it we can push images to Amazon
Tip: To use the docker login automatically type in the console:
$(aws ecr get-login --no-include-email)
@EdisonArango
EdisonArango / Capybara.md
Created May 29, 2019 19:39 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above

First option

Generate the certificate using certbot inside a docker container

docker run -it --rm --name certbot \
            -v "/var/git/noirlab/config/letsencrypt:/etc/letsencrypt" \
            -v "/var/git/noirlab/config/letsencrypt-lib:/var/lib/letsencrypt" \
            -p 80:80 \
            certbot/certbot certonly