Skip to content

Documentación, convenciones e infraestructura

Notifications You must be signed in to change notification settings

BlickLabs/DevOps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blick DevOps

Index

Tips and General Aspects

Connection to servers

For the connection you need the .pem access key, you can request it to any of the members of the development team, for the connection, simply use the command

$ ssh -i <key.pem> user@public-ip -o ServerAliveInterval=60

The -o ServerAliveInterval helps us to keep the connection alive and avoid killed sessions by the server!

User and role management

For each new project, a user must be created, this user will contain the project files, and the application, should be run under the new user

To add a new user

$ sudo useradd <username> -g sudo -m
$ sudo passwd <username>
$ su <username>

User Password

By convention, the users' password will be made up of

<username>_sudo

For example, if the username is mike the password is mike_sudo

Databases roles (PostgreSQL)

Create a database role using the same convention in system users

For example, to postgresql

$ sudo su postgres
$ createdb <db_name>
$ createuser -P <db_username>
$ psql
=# GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <db_username>;
=# \q
$ exit

Redirect www to non-www

If you want redirect users from www to a plain, non-www domain edit NGINX redirect configuration

sudo vi /etc/nginx/conf.d/redirect.conf

Add this server block

server {
    server_name www.example.com;
    return 301 $scheme:https://example.com$request_uri;
}

Save and exit. This configures Nginx to redirect requests to "www.example.com" to "example.com".

Database roles (MySQL)

Enter as root to MySQL and create a new user.

CREATE DATABASE <DATABASE_NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'some_password';
GRANT ALL PRIVILEGES ON <DATABASE_NAME>.* TO 'username'@'localhost';
FLUSH PRIVILEGES;

Create a swap partition

As root!

You can add a 1 GB swap to your instance with these commands:

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile

To enable it by default after reboot, add this line to /etc/fstab:

/swapfile swap swap defaults 0 0

Configure swapiness

Install java (Ubuntu 16.04)

Generate SSH Keys

Remove file extension via Nginx

http:https://cobwwweb.com/remove-html-extension-and-trailing-slash-in-nginx-config

Common problems

Commit.js

You might have an issue with the generator when you're trying to deploy. In case the error is related with commit you should paste the next file inside your node_modules directory, considering the next route node_modules/gift/lib/commit.js

the route might change too!.