Last active
December 24, 2019 09:14
-
-
Save vonalbert/d28057893cb7c046f0b014738cf0d1f4 to your computer and use it in GitHub Desktop.
Development Toolbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
alias composer='symfony composer' | |
alias pear='symfony pear' | |
alias pecl='symfony pecl' | |
alias php='symfony php' | |
alias php-cgi='symfony php-cgi' | |
alias php-config='symfony php-config' | |
alias php-fpm='symfony php-fpm' | |
alias phpdbg='symfony phpdbg' | |
alias scenv='symfony scenv' | |
alias sf='symfony console' | |
dc-mysql-restore-dump() { | |
if [[ -z "$1" || -z "$2" ]]; then | |
echo "Usage: dc-mysql-restore-dump [container-name] [path/to/file.sql]" | |
return 1 | |
fi | |
CONTAINER_ID=$(docker-compose ps -q "$1") | |
if [[ ! -f "$2" ]]; then | |
echo "$2 is not a path to the mysql dump" | |
return 2 | |
fi | |
docker exec -i "$CONTAINER_ID" sh -c 'exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD" $MYSQL_DATABASE' < "$2" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = true | |
[*] | |
charset = utf-8 | |
indent_size = 4 | |
indent_style = space | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
[*.js] | |
indent_size = 2 | |
[*.scss] | |
indent_size = 2 | |
[*.md] | |
trim_trailing_whitespace = false | |
[Makefile] | |
indent_style = tab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apc.enable_cli = 1 | |
date.timezone = UTC | |
session.auto_start = Off | |
short_open_tag = Off | |
# http://symfony.com/doc/current/performance.html | |
opcache.interned_strings_buffer = 16 | |
opcache.max_accelerated_files = 20000 | |
opcache.memory_consumption = 256 | |
realpath_cache_size = 4096K | |
realpath_cache_ttl = 600 | |
xdebug.remote_enable=1 | |
xdebug.remote_port=9009 | |
xdebug.remote_autostart=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
export DEBIAN_FRONTEND=noninteractive | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Prevent calling this script as root user | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
if [[ $(id -u) = 0 ]]; then | |
echo "Do not execute this script with root privileges" | |
exit 1 | |
fi | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Update system and install miscellaneous packages | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install -y software-properties-common curl \ | |
build-essential gcc git git-flow libmcrypt4 libpcre3-dev libpng-dev \ | |
unzip make whois vim libnotify-bin bash-completion imagemagick | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# PHP installation | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
PHP_VERSIONS="5.6|7.0|7.1|7.2|7.3|7.4" | |
PHP_MODULES="cli|curl|dev|fpm|gd|intl|mbstring|mysql|phar|pgsql|soap|sqlite|xml|zip" | |
PHP_DEFAULT="7.3" | |
sudo apt-add-repository ppa:ondrej/php -y | |
sudo apt install -y "^php($PHP_VERSIONS)-?($PHP_MODULES)$" | |
sudo update-alternatives --set php "/usr/bin/php$PHP_DEFAULT" | |
sudo update-alternatives --set php-config "/usr/bin/php-config$PHP_DEFAULT" | |
sudo update-alternatives --set phpize "/usr/bin/phpize$PHP_DEFAULT" | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Install Symfony CLI | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
SYMFONY_EXE="$HOME/.symfony/bin/symfony" | |
[[ -f "$SYMFONY_EXE" ]] || curl -sS https://get.symfony.com/cli/installer | bash | |
echo "$PHP_DEFAULT" > ~/.php-version | |
"$SYMFONY_EXE" local:php:refresh | |
"$SYMFONY_EXE" local:php:list | |
grep -qxF 'export PATH="$HOME/.symfony/bin:$PATH"' ~/.bashrc || echo 'export PATH="$HOME/.symfony/bin:$PATH"' >> ~/.bashrc | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Install Composer | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Install Node Version Manager and more recent Node LTS version | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
nvm install --lts | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Install docker && docker-compose | |
# | |
# [!! Note !!] | |
# Docker installation script adds the appropriate apt repository and | |
# install the executable using the package manager, so it's important | |
# not to re-run this script twice, because upgrades are done with | |
# apt upgrade | |
# see: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
if [[ ! -f /usr/bin/docker ]]; then | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo usermod -aG docker "$(id -un)" | |
sudo service docker start | |
fi | |
DOCKER_COMPOSE_VERSION="1.24.1" | |
sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment