Skip to content

Commit

Permalink
Merge d01627a into 077fcae
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSkierniewski committed Apr 28, 2017
2 parents 077fcae + d01627a commit 6abd3fd
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .server/nginx/site.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ server {
location = /robots.txt { access_log off; log_not_found off; }

# Stdout logging
error_log /dev/stdout info;
access_log /dev/stdout;
error_log /dev/stdout notice;
access_log off;

# Remove index.php$
if ($request_uri ~* "^(.*/)index\.php$") {
Expand Down
2 changes: 2 additions & 0 deletions ansible/templates/production-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ services:
web_server:
image: "{{ DOCKER_APP_IMAGE }}:{{ APP_VERSION | default('latest', true) }}"
restart: always
depends_on:
- redis_server
environment:
OVERRIDE_UMASK: "022"
XDEBUG: "false"
Expand Down
2 changes: 2 additions & 0 deletions ansible/templates/staging-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
web_server:
image: "{{ DOCKER_APP_IMAGE }}:{{ APP_VERSION | default('latest', true) }}"
restart: always
depends_on:
- redis_server
environment:
OVERRIDE_UMASK: "022"
XDEBUG: "false"
Expand Down
30 changes: 9 additions & 21 deletions app/Jobs/SendWelcomeEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;

class SendWelcomeEmail implements ShouldQueue
{
class SendWelcomeEmail implements ShouldQueue {
use InteractsWithQueue, Queueable, SerializesModels;

protected $user;
Expand All @@ -35,23 +33,13 @@ public function __construct(User $user)
*/
public function handle(Mailer $mailer)
{
try {
$mailer->send(
'emails.auth.welcome',
['user' => $this->user],
function ($m) {
$m->to($this->user->email, $this->user->name)
->subject(trans('emails.welcome.subject', ['siteName' => config('app.name')]));
}
);
} catch (\Swift_TransportException $e) {
Log::error(
'There was a problem with sending an welcome e-mail.',
[
'email' => $this->user->email,
'message' => $e->getMessage()
]
);
}
$mailer->send(
'emails.auth.welcome',
['user' => $this->user],
function ($m) {
$m->to($this->user->email, $this->user->name)
->subject(trans('emails.welcome.subject', ['siteName' => config('app.name')]));
}
);
}
}
28 changes: 28 additions & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
|
*/

use Monolog\Handler\StreamHandler;
use Monolog\Logger;

$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
Expand Down Expand Up @@ -41,6 +44,31 @@
App\Exceptions\Handler::class
);

/*
|--------------------------------------------------------------------------
| Override Monolog setup
|--------------------------------------------------------------------------
|
| Sending logs to named pipe (FIFO) so we can forward it to docker logs
|
*/

$app->configureMonologUsing(
function ($monolog) {
$levels = [
'debug' => Logger::DEBUG,
'info' => Logger::INFO,
'notice' => Logger::NOTICE,
'warning' => Logger::WARNING,
'error' => Logger::ERROR,
'critical' => Logger::CRITICAL,
'alert' => Logger::ALERT,
'emergency' => Logger::EMERGENCY,
];
$monolog->pushHandler(new StreamHandler('/tmp/laravel.log', $levels[config('app.log_level')]));
}
);

/*
|--------------------------------------------------------------------------
| Return The Application
Expand Down
35 changes: 35 additions & 0 deletions database/migrations/2017_04_26_135124_create_failed_jobs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ services:
web_server:
image: gzero/platform-container:v3
restart: "no"
depends_on:
- db_server
- redis_server
environment:
OVERRIDE_UMASK: "002"
XDEBUG: "true"
Expand Down

0 comments on commit 6abd3fd

Please sign in to comment.