Menu Close

devstate.de

A Dreams Engine Blog. This Blog may not make any sense to you. This is a collection of internal snippets that we collect with our experiences, but we hope some of our post will help you in some way.

Docker+WP

Create a

docker-compose.yml

file in a any folder

i.e.

/Documents/Docker/mydomainsample.com/docker-compose.yml
docker-compose.yml
version: '2'

services:
 wordpress:
 depends_on:
 - mysql
 image: wordpress:php7.0
 ports:
 - "8080:80"
 volumes:
 - ./htdocs/assets:/var/www/html/wp-content
 links:
 - mysql
 environment:
 WORDPRESS_DB_HOST: mysql:3306
 WORDPRESS_DB_PASSWORD: wp

 mysql:
 image: mariadb:10.1.19
 ports:
 - "8081:3306"
 volumes:
 - ./databases:/var/lib/mysql
 environment:
 MYSQL_ROOT_PASSWORD: wp

Know Issues

WordPress Docker not starting or closing unexpectedly:

This happen because the MySQL docker database doesn’t have the necessary permissions:

Step 1: Access the docker cluster:

docker exec -it my_wordpress_mysql_docker_cluster bash

Step 2: Access MySQL:

msyql -uroot -pwp

Step 3: Allow MySQL WordPress User to access the databases:

GRANT ALL ON *.* to yourUser@'%' IDENTIFIED BY 'wp';

Create Databases

#Se crea la base de datos con el nombre

CREATE DATABASE name;

#Se crea el usuarios y contraseña dentro de MYSQL

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

#Se proporciona al usuario el acceso a la información

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Remove/Purge Easy Engine

Suggested by: http://www.galih.us/2014/12/cara-uninstall-easyengine.html

First:

ee system purge

changed to stack, so:

ee stack purge

Then:

rm -rf /etc/easyengine/;
rm -rf /etc/bash_completion.d/ee;
rm -rf /usr/local/sbin/ee;
rm -rf /usr/local/bin/ee;
rm -rf /usr/local/sbin/easyengine;
rm -rf /usr/share/easyengine;
rm -rf /var/www/*;
rm -rf /etc/nginx;
rm -rf /etc/php5;
rm -rf /etc/mysql;
rm -rf /var/lib/mysql;
rm -rf /etc/postfix;

And finally:

apt-get autoremove

Optimal Easy Engine 3.0

#Access Server

ssh root@IP

#Update Server TimeZone

dpkg-reconfigure tzdata

#Secure SSH acccess with a different port

vim /etc/ssh/sshd_config

#Keep SSH Connection Alive 

ClientAliveInterval 30
ClientAliveCountMax 999999

#Restart SSH 

service ssh restart

#Add a Initial message 

vim /etc/motd
================= Project =========================================
https://project.io/
https://api.project.io/
https://cdn.project.io/
===================================================================

#Update/Upgrade Server

apt update; apt upgrade -y;

#Instalar Vim 8 Ubuntu/Mint

add-apt-repository -y ppa:jonathonf/vim
apt update
apt install vim -y

#Install Git

apt install git -y

#Beautyfy Terminal

  • follow this steps:
apt install zsh -y
  • Change permanently to zsh
chsh -s /bin/zsh 
  • Get .Antigen
git clone https://github.com/zsh-users/antigen.git .antigen
  • Add the next Script:
echo "# .zshrc Source Basic

source '${HOME}/.antigen/antigen.zsh'

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle rsync
antigen bundle pip
antigen bundle python
antigen bundle history
antigen bundle command-not-found

# Third Party
antigen bundle kennethreitz/autoenv
antigen bundle zsh-users/zsh-completions

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-completions src
antigen bundle zsh-users/zsh-syntax-highlighting

# Load the theme.
antigen theme https://github.com/denysdovhan/spaceship-zsh-theme spaceship

# Tell antigen that you're done.
antigen apply

source '${HOME}/.aliases' " >> ~/.zshrc
  • Edit .zshrc
vim ~/.zshrc

# SET COMMON ALIASES

echo "#Set Aliases
alias gonginx='/etc/nginx/'
alias gomysql='/etc/mysql/'
alias www='/var/www/'
alias zshrc='vim ~/.zshrc'
alias aliax='vim ~/.aliases'
alias vimx='vim ~/.vimrc'" >> ~/.aliases

# SET COMMON VIM CONFIGS

echo"set mouse-=a
set paste" >> ~/.vimrc

#Verificar el nombre

hostname

#Reiniciar server

reboot

#Intalas EasyEngine

wget -qO ee rt.cx/ee && sudo bash ee

#Creas el sitio y actualizas php a la version 7

ee site create misitio.com --wpfc --php7

#Para verificar que la configuración de nginx sea correcta

nginx -t

#Reiniciar el servicio nginx

service nginx restart

#Limpiar todo el EasyEngine

ee clean --all

Most Useful ST Packages and Config for Great Workflow

###Packages

### Packge Control:
--------------------
BracketHighlighter
CodeFormatter
HTML5
Material Theme
ColorHighligter
Compass
CSS3
GitGutter
Sass
SFTP
SidebarEnhancment
Themr
TrailingSpace
Wordpress

if(is_OSX){
  MacTerminal
}

###Configs

{
    "always_show_minimap_viewport": true,
    "bold_folder_labels": true,
    "caret_extra_bottom": 3,
    "caret_extra_top": 3,
    "caret_extra_width": 2,
    "color_scheme": "Packages/Material Theme/schemes/Material-Theme-OceanicNext.tmTheme",
    "folder_exclude_patterns":
    [
        ".sass-cache",
        ".svn",
        ".git",
        ".hg",
        "CVS",
        "_build",
        "dist",
        "build",
        "wp-admin",
        "wp-includes"
    ],
    "font_options":
    [
        "gray_antialias"
    ],
    "font_size": 19,
    "highlight_line": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "indent_guide_options":
    [
        "draw_normal",
        "draw_active"
    ],
    "line_padding_bottom": 3,
    "line_padding_top": 3,
    "overlay_scroll_bars": "enabled",
    "theme": "Material-Theme.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": true
}

###KeyBindings

[

{ "keys": ["ctrl+s"], "command": "toggle_side_bar" },
{ "keys": ["super+ctrl+z"], "command": "word_wrap" },
{ "keys": ["super+t"], "command": "open_mac_terminal"},
{ "keys": ["super+shift+h"], "command": "encode_html_entities" },
{ "keys": ["super+ctrl+m"], "command": "sftp_monitor_file" },
{ "keys": ["super+alt+p"], "command": "sftp_upload_file" },
{ "keys": ["super+ctrl+l"], "command": "reindent" },
// latex align keybind, to align & and \\, but not \&
{
"keys": ["super+shift+a"], "command": "align_tab",
"args" : {"user_input" : "(?<!\\\\)&|\\\\\\\\"},
"context":[
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
}

]

###MacTerminal

For iTerm 
{
    "terminal"   :  "iterm-nightly"
}

For iTerm Nightly
{
    "terminal"   :  "iterm-nightly"
}

Install .Antigen and Beautify your iTerm

upgrade: 13.09.16

install zsh:

apt install zsh //or aptitude

Change permanently to zsh

chsh
/bin/zsh 

(In OSX just change the user configuration to zsh)

You had to have Git Installed for the next steps

Git Antigen:
https://github.com/zsh-users/antigen

Download Input Mono Font:
Input Mono

Download Iconsolata:
Inconsolata

 

  • You had to have Git Installed for the next steps
git clone https://github.com/zsh-users/antigen.git .antigen

Edit  .zshrc

vim ~/.zshrc

Copy the next Script:

# .zshrc Source Basic

source ~/.antigen/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle rsync
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle python
antigen bundle history
antigen bundle command-not-found

# Third Party
antigen bundle kennethreitz/autoenv

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-completions src
antigen bundle zsh-users/zsh-syntax-highlighting

# Load the theme.
# antigen theme https://github.com/carloscuesta/materialshell  /zsh/materialshell-dark
antigen theme https://github.com/denysdovhan/spaceship-zsh-theme spaceship


# Tell antigen that you're done.
antigen apply

source "${HOME}/.aliases"

#SET COMMON ALIASES

 

#Set Aliases

alias gonginx="/etc/nginx/"
alias gomysql="/etc/mysql/"
alias www="/var/www/"
alias zshrc="vim ~/.zshrc"
alias aliax="vim ~/.aliases"
alias vimx="vim ~/.vimrc"

 

#SET COMMON VIM CONFIGS

set mouse-=a
set paste

use Incosolata and Input Mono in Iterm.

PHP 5.5 to 5.6

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5

.Gitignoring the hardway

To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm –cached filename

To untrack every file that is now in your .gitignore:

First commit any outstanding code changes, and then, run this command:

git rm -r --cached .

This removes any changed files from the index(staging area), then just run:

git add .

Commit it:

git commit -m ".gitignore is now working"

To undo

git rm --cached filename

, use git add filename.

Source: http://stackoverflow.com/a/1139797/3912326

Solve MySQL(MariaDB) Bad Socket

To find all socket files on your system run:

sudo find / -type s

My Mysql server system had the socket open at /var/lib/mysql/mysql.sock

Once you find where the socket is being opened, add or edit the line to your /etc/my.cnf file with the path to the socket file:

socket=/var/lib/mysql/mysql.sock

Sometimes the system startup script that launched the command line executable specifies a flag –socket=path. This flag could override the my.cnf location, and that would result in a socket not being found where the my.cnf file indicates it should be. Then when you try to run the mysql command line client, it will read my.cnf to find the socket, but it will not find it since it deviates from where the server created one. So, Unless you care where the socket resides, just changing the my.cnf to match should work. I

If you’re super user in the linux system, based on the above just do this:

kill -9 4969

or sometimes you can do this:

pkill -9 mysqld

After you do this you might want to look for a pid file in /var/run/mysqld/ and delete it

Make sure the permissions on your socket is such that whatever user mysqld is running as can read/write to it. An easy test is to open it up to full read/write and see if it still works:

chmod 777 '/var/run/mysqld/mysqld.sock

If that fixes the issue, you can tailor the permissions and ownership of the socket as needed based on your security settings.

Also, the directory the socket resides in has to be reachable by the user running the mysqld process.

Install Pure-FTP , –Purge VSFTP

#Install Pure-FTPd

aptitude -y install pure-ftpd

#run as a daemon

echo "yes" > /etc/pure-ftpd/conf/Daemonize

#prohibit Anonymous

echo "yes" > /etc/pure-ftpd/conf/NoAnonymous

#enable chroot

echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone

#only IPV4

echo "yes" > /etc/pure-ftpd/conf/IPV4Only

service pure-ftpd restart

#Restarting ftp server: Running: 
/usr/sbin/pure-ftpd -l pam -E -A -8 UTF-8 -B -O clf:/var/log/pure-ftpd/transfer.log -u 1000 -4 -B

Remove (PURGE!!!) VSFTPD

#remove first:

#Stop: Unknown instance
#and when I used:

ps -a | grep ftp

#I can still see vsftpd was running, That meant the vsftpd was not stopped.
#So I used: 

kill -9 25676

#the stop
service vsftp stop
sudo aptitude remove --purge vsftpd
sudo aptitude install vsftpd


#delete via rm -rf or FTP 
/etc/vsftpd.conf






Newer Posts
Older Posts