richdynamix / arc

Production ready docker based development environment for your Laravel project.
MIT License
117 stars 18 forks source link

Dotenv values containing spaces must be surrounded by quotes #8

Closed nicobrinkkemper closed 5 years ago

nicobrinkkemper commented 5 years ago

Expected: web container is running Result: exited with code

Output:
...
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
The environment file is invalid: Dotenv values containing spaces must be surrounded by quotes.Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

.env generated by arc

APP_NAME="Arc";
APP_ENV="local";
APP_KEY="base64:rpDVB589rMWrRUVkcviIAOfnrQo/MOdfWdjOd3t+K5A=";
APP_DEBUG="true";
LOG_CHANNEL="stack";
APP_URL="https://arc.test";

DB_CONNECTION="mysql";
DB_HOST="database";
DB_PORT="3306";
DB_DATABASE="arc";
DB_USERNAME="arc";
DB_PASSWORD="arc";

MAIL_DRIVER="smtp";
MAIL_HOST="mailtrap.io";
MAIL_PORT="2525";
MAIL_USERNAME="null";
MAIL_PASSWORD="null";
MAIL_ENCRYPTION="null";

CACHE_DRIVER="redis";
SESSION_DRIVER="redis";
QUEUE_DRIVER="redis";
SESSION_DRIVER="redis";
SESSION_LIFETIME="120";

REDIS_HOST="redis";
REDIS_PASSWORD="null";
REDIS_PORT="6379";

MIX_PUSHER_APP_KEY="null";
MIX_PUSHER_APP_CLUSTER="null";

AUTHY_SECRET="null";

STRIPE_MODEL="App\User";
STRIPE_KEY="null";
STRIPE_SECRET="null";

BRAINTREE_MODEL="App\User";
BRAINTREE_ENV="null";
BRAINTREE_MERCHANT_ID="null";
BRAINTREE_PUBLIC_KEY="null";
BRAINTREE_PRIVATE_KEY="null";

BROADCAST_DRIVER="pusher";
PUSHER_APP_ID="null";
PUSHER_KEY="null";
PUSHER_SECRET="null";
PUSHER_APP_CLUSTER="mt1";

SENTRY_DSN="null";
LOGGLY_TOKEN="null";

AWS_ACCESS_KEY_ID="";
AWS_SECRET_ACCESS_KEY="";
AWS_DEFAULT_REGION="eu-central-1";
AWS_BUCKET="arc-dev";

20-arc-env

#!/bin/bash
START_MODE_CRON=${START_MODE_CRON:-true}
START_MODE_CRON="$(convert_to_boolean_string "$START_MODE_CRON")"
export START_MODE_CRON

START_MODE_WEB=${START_MODE_WEB:-true}
START_MODE_WEB="$(convert_to_boolean_string "$START_MODE_WEB")"
export START_MODE_WEB

WEB_HTTPS_ONLY=${WEB_HTTPS_ONLY:-true}
WEB_HTTPS_ONLY="$(convert_to_boolean_string "$WEB_HTTPS_ONLY")"
export WEB_HTTPS_ONLY

START_HORIZON=${START_HORIZON:-false}
START_HORIZON="$(convert_to_boolean_string "$START_HORIZON")"
export START_HORIZON

START_QUEUE=${START_QUEUE:-true}
START_QUEUE="$(convert_to_boolean_string "$START_QUEUE")"
export START_QUEUE

RUN_LARAVEL_CRON=${RUN_LARAVEL_CRON:-true}
RUN_LARAVEL_CRON="$(convert_to_boolean_string "$RUN_LARAVEL_CRON")"
export RUN_LARAVEL_CRON

AUTH_HTTP_ENABLED=${AUTH_HTTP_ENABLED:-false}
AUTH_HTTP_ENABLED="$(convert_to_boolean_string "$AUTH_HTTP_ENABLED")"
export AUTH_HTTP_ENABLED

export AUTH_HTTP_REALM=${AUTH_HTTP_REALM:-"Protected System"}
export AUTH_HTTP_FILE=/etc/nginx/custom-htpasswd-path

export WORK_DIRECTORY=${WORK_DIRECTORY:-/app}
export WEB_DIRECTORY=${WEB_DIRECTORY:-${WORK_DIRECTORY}/public}

export APP_NAME=${APP_NAME:-Arc}
export APP_ENV=${APP_ENV:-local}
export APP_KEY=${APP_KEY:-base64:rpDVB589rMWrRUVkcviIAOfnrQo/MOdfWdjOd3t+K5A=}
export APP_DEBUG=${APP_DEBUG:-true}
export LOG_CHANNEL=${LOG_CHANNEL:-stack}
export APP_URL=${APP_URL:-https://arc.test}

export DB_CONNECTION=${DB_CONNECTION:-mysql}
export DB_HOST=${DB_HOST:-database}
export DB_PORT=${DB_PORT:-3306}
export DB_DATABASE=${DB_DATABASE:-arc}
export DB_USERNAME=${DB_USERNAME:-arc}
export DB_PASSWORD=${DB_PASSWORD:-arc}

export MAIL_DRIVER=${MAIL_DRIVER:-smtp}
export MAIL_HOST=${MAIL_HOST:-mailtrap.io}
export MAIL_PORT=${MAIL_PORT:-2525}
export MAIL_USERNAME=${MAIL_USERNAME:-null}
export MAIL_PASSWORD=${MAIL_PASSWORD:-null}
export MAIL_ENCRYPTION=${MAIL_ENCRYPTION:-null}

export CACHE_DRIVER=${CACHE_DRIVER:-redis}
export SESSION_DRIVER=${SESSION_DRIVER:-redis}
export QUEUE_DRIVER=${QUEUE_DRIVER:-redis}

export SESSION_DRIVER=${SESSION_DRIVER:-file}
export SESSION_LIFETIME=${SESSION_LIFETIME:-120}

export REDIS_HOST=${REDIS_HOST:-redis}
export REDIS_PASSWORD=${REDIS_PASSWORD:-null}
export REDIS_PORT=${REDIS_PORT:-6379}

export MIX_PUSHER_APP_KEY=${MIX_PUSHER_APP_KEY:-null}
export MIX_PUSHER_APP_CLUSTER=${MIX_PUSHER_APP_CLUSTER:-null}

export AUTHY_SECRET=${AUTHY_SECRET:-null}

export STRIPE_MODEL=${STRIPE_MODEL:-"App\User"}
export STRIPE_KEY=${STRIPE_KEY:-null}
export STRIPE_SECRET=${STRIPE_SECRET:-null}

export BRAINTREE_MODEL=${BRAINTREE_MODEL:-"App\User"}
export BRAINTREE_ENV=${BRAINTREE_ENV:-null}
export BRAINTREE_MERCHANT_ID=${BRAINTREE_MERCHANT_ID:-null}
export BRAINTREE_PUBLIC_KEY=${BRAINTREE_PUBLIC_KEY:-null}
export BRAINTREE_PRIVATE_KEY=${BRAINTREE_PRIVATE_KEY:-null}

export BROADCAST_DRIVER=${BROADCAST_DRIVER:-pusher}
export PUSHER_APP_ID=${PUSHER_APP_ID:-null}
export PUSHER_KEY=${PUSHER_KEY:-null}
export PUSHER_SECRET=${PUSHER_SECRET:-null}
export PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER:-mt1}

export SENTRY_DSN=${SENTRY_DSN:-null}
export LOGGLY_TOKEN=${LOGGLY_TOKEN:-null}

export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-eu-central-1}
export AWS_BUCKET=${AWS_BUCKET:-arc-dev}
nicobrinkkemper commented 5 years ago

I just removed the double-quotes and semi-colon, which worked. It gave a database error though, but was able to migrate after restarting web. My fixed dotenv.tml:

APP_NAME={{ getenv "APP_NAME" }}
APP_ENV={{ getenv "APP_ENV" }}
APP_KEY={{ getenv "APP_KEY" }}
APP_DEBUG={{ getenv "APP_DEBUG" }}
LOG_CHANNEL={{ getenv "LOG_CHANNEL" }}
APP_URL={{ getenv "APP_URL" }}

DB_CONNECTION={{ getenv "DB_CONNECTION" }}
DB_HOST={{ getenv "DB_HOST" }}
DB_PORT={{ getenv "DB_PORT" }}
DB_DATABASE={{ getenv "DB_DATABASE" }}
DB_USERNAME={{ getenv "DB_USERNAME" }}
DB_PASSWORD={{ getenv "DB_PASSWORD" }}

MAIL_DRIVER={{ getenv "MAIL_DRIVER" }}
MAIL_HOST={{ getenv "MAIL_HOST" }}
MAIL_PORT={{ getenv "MAIL_PORT" }}
MAIL_USERNAME={{ getenv "MAIL_USERNAME" }}
MAIL_PASSWORD={{ getenv "MAIL_PASSWORD" }}
MAIL_ENCRYPTION={{ getenv "MAIL_ENCRYPTION" }}

CACHE_DRIVER={{ getenv "CACHE_DRIVER" }}
SESSION_DRIVER={{ getenv "SESSION_DRIVER" }}
QUEUE_DRIVER={{ getenv "QUEUE_DRIVER" }}
SESSION_DRIVER={{ getenv "SESSION_DRIVER" }}
SESSION_LIFETIME={{ getenv "SESSION_LIFETIME" }}

REDIS_HOST={{ getenv "REDIS_HOST" }}
REDIS_PASSWORD={{ getenv "REDIS_PASSWORD" }}
REDIS_PORT={{ getenv "REDIS_PORT" }}

MIX_PUSHER_APP_KEY={{ getenv "MIX_PUSHER_APP_KEY" }}
MIX_PUSHER_APP_CLUSTER={{ getenv "MIX_PUSHER_APP_CLUSTER" }}

AUTHY_SECRET={{ getenv "AUTHY_SECRET" }}

STRIPE_MODEL={{ getenv "STRIPE_MODEL" }}
STRIPE_KEY={{ getenv "STRIPE_KEY" }}
STRIPE_SECRET={{ getenv "STRIPE_SECRET" }}

BRAINTREE_MODEL={{ getenv "BRAINTREE_MODEL" }}
BRAINTREE_ENV={{ getenv "BRAINTREE_ENV" }}
BRAINTREE_MERCHANT_ID={{ getenv "BRAINTREE_MERCHANT_ID" }}
BRAINTREE_PUBLIC_KEY={{ getenv "BRAINTREE_PUBLIC_KEY" }}
BRAINTREE_PRIVATE_KEY={{ getenv "BRAINTREE_PRIVATE_KEY" }}

BROADCAST_DRIVER={{ getenv "BROADCAST_DRIVER" }}
PUSHER_APP_ID={{ getenv "PUSHER_APP_ID" }}
PUSHER_KEY={{ getenv "PUSHER_KEY" }}
PUSHER_SECRET={{ getenv "PUSHER_SECRET" }}
PUSHER_APP_CLUSTER={{ getenv "PUSHER_APP_CLUSTER" }}

SENTRY_DSN={{ getenv "SENTRY_DSN" }}
LOGGLY_TOKEN={{ getenv "LOGGLY_TOKEN" }}

AWS_ACCESS_KEY_ID={{ getenv "AWS_ACCESS_KEY_ID" }}
AWS_SECRET_ACCESS_KEY={{ getenv "AWS_SECRET_ACCESS_KEY" }}
AWS_DEFAULT_REGION={{ getenv "AWS_DEFAULT_REGION" }}
AWS_BUCKET={{ getenv "AWS_BUCKET" }}
richdynamix commented 5 years ago

Hi

Thanks for reporting this issue. The issue is specifically with the Dotenv package being updated in Laravel.

The environment file is invalid: Dotenv values containing spaces must be surrounded by quotes

The error is misleading as there is no env value without quotes. The solution I have found is to remove the semicolon at the end of each line. I will make an update today.

nicobrinkkemper commented 5 years ago

No problem. FYI I also had some setup problems with arc:install as I couldn't add the option for --ignore-platform-reqs which I needed inside a composer-only container. I installed them separately which and after that I ran the installer. IMO it can't hurt to add --ignore-platform-reqs by default which should help docker users.

richdynamix commented 5 years ago

Hi @nicobrinkkemper

I have just released a new version with the bug fix and your suggestion. I have also altered the install command to self remove Arc from the project after the initial setup.

https://github.com/richdynamix/arc/releases/tag/2.0.0