Skip to content

Commit

Permalink
Initial Config
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-e-dietrich committed May 23, 2018
0 parents commit 7c57a8a
Show file tree
Hide file tree
Showing 55 changed files with 6,935 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .docksal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docksal-local.env
docksal-local.yml
15 changes: 15 additions & 0 deletions .docksal/commands/composer
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#: exec_target = cli

## Run project's Behat tests.
##
## Usage: fin composer [arguments]
##

# Abort if anything fails
set -e

cd ${PROJECT_ROOT}

composer "$@"
15 changes: 15 additions & 0 deletions .docksal/commands/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#: exec_target = cli

## Run Symfony Console.
##
## Usage: fin console [arguments]
##

# Abort if anything fails
set -e

cd ${PROJECT_ROOT}

bin/console "$@"
44 changes: 44 additions & 0 deletions .docksal/commands/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

## Initialize stack and site (full reset)
##
## Usage: fin init

# Abort if anything fails
set -e

#-------------------------- Helper functions --------------------------------

# Console colors
red='\033[0;31m'
green='\033[0;32m'
green_bg='\033[42m'
yellow='\033[1;33m'
NC='\033[0m'

echo-red () { echo -e "${red}$1${NC}"; }
echo-green () { echo -e "${green}$1${NC}"; }
echo-green-bg () { echo -e "${green_bg}$1${NC}"; }
echo-yellow () { echo -e "${yellow}$1${NC}"; }

#-------------------------- Execution --------------------------------

# Stack initialization
echo -e "${green_bg} Step 1 ${NC}${green} Initializing stack...${NC}"
if [[ $DOCKER_RUNNING == "true" ]]; then
fin reset -f
else
fin up
fi
echo "Waiting 10s for MySQL to initialize...";
sleep 10

# Site initialization
echo -e "${green_bg} Step 2 ${NC}${green} Initializing site...${NC}"
# This runs inside cli using http://docs.docksal.io/en/v1.4.0/fin/custom-commands/#executing-commands-inside-cli
fin init-site

echo -en "${green_bg} DONE! ${NC} "
echo -e "Open ${yellow}http://${VIRTUAL_HOST}${NC} in your browser to verify the setup."

#-------------------------- END: Execution --------------------------------
58 changes: 58 additions & 0 deletions .docksal/commands/init-site
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

#: exec_target = cli

## Initialize/reinstall site
##
## Usage: fin init-site

# Abort if anything fails
set -e

#-------------------------- Settings --------------------------------

#-------------------------- END: Settings --------------------------------

#-------------------------- Helper functions --------------------------------

# Copy a settings file.
# Skips if the destination file already exists.
# @param $1 source file
# @param $2 destination file
copy_settings_file()
{
local source="$1"
local dest="$2"

if [[ ! -f $dest ]]; then
echo "Copying ${dest}..."
cp $source $dest
else
echo "${dest} already in place."
fi
}

#-------------------------- END: Helper functions --------------------------------

#-------------------------- Functions --------------------------------
# Composer Install
composer_install ()
{
cd $PROJECT_ROOT
composer global require hirak/prestissimo:^0.3
composer install
}

install_items ()
{
composer_install
copy_settings_file ${PROJECT_ROOT}/.docksal/env_docksal ${PROJECT_ROOT}/.env
}
#-------------------------- END: Functions --------------------------------

#-------------------------- Execution --------------------------------

mkdir ~/tmp
install_items
# Project initialization steps
#-------------------------- END: Execution --------------------------------
15 changes: 15 additions & 0 deletions .docksal/commands/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#: exec_target = cli

## Run PHP Unit.
##
## Usage: fin phpunit [arguments]
##

# Abort if anything fails
set -e

cd ${PROJECT_ROOT}

bin/phpunit "$@"
26 changes: 26 additions & 0 deletions .docksal/docksal.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This is a shared configuration file that is intended to be stored in the project repo.
# To override a variable locally:
# - create .docksal/docksal-local.env file and local variable overrides there
# - add .docksal/docksal-local.env to .gitignore

# Use the default Docksal stack
DOCKSAL_STACK=default

# Lock images versions for LAMP services
# This will prevent images from being updated when Docksal is updated
WEB_IMAGE='docksal/web:2.1-apache2.4'
DB_IMAGE='docksal/db:1.1-mysql-5.7'
CLI_IMAGE='docksal/cli:2.1-php7.1'

# Docksal configuration.
DOCROOT=public

# MySQL settings.
# MySQL will be exposed on a random port. Use "fin ps" to check the port.
# To have a static MySQL port assigned, copy the line below into the .docksal/docksal-local.env file
# and replace the host port "0" with a unique host port number (e.g. MYSQL_PORT_MAPPING='33061:3306')
MYSQL_PORT_MAPPING='0:3306'

# Enable/disable xdebug
# To override locally, copy the two lines below into .docksal/docksal-local.env and adjust as necessary
XDEBUG_ENABLED=0
30 changes: 30 additions & 0 deletions .docksal/docksal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Basic LAMP stack

version: "2.1"

services:
# Web
web:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: web
depends_on:
- cli

# DB
db:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: mysql

# CLI
cli:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: cli

# Mail
mail:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: mail
24 changes: 24 additions & 0 deletions .docksal/env_docksal
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=ece23fa7edec09a7bd5233ea1eb7fc94
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://user:user@db:3306/default
###< doctrine/doctrine-bundle ###
24 changes: 24 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=ece23fa7edec09a7bd5233ea1eb7fc94
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://user:user@db:3306/default
###< doctrine/doctrine-bundle ###
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

###> symfony/framework-bundle ###
/.env
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/webpack-encore-pack ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-pack ###

###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###
Empty file added assets/.gitignore
Empty file.
39 changes: 39 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);

if ($debug) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
18 changes: 18 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php

if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');
}
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
Loading

0 comments on commit 7c57a8a

Please sign in to comment.