|
|
|
|
@ -142,12 +142,18 @@ sub do_domain ( $c ) { |
|
|
|
|
return $c->redirect_error( $calling_route ) |
|
|
|
|
if $c->stash->{errors}; |
|
|
|
|
|
|
|
|
|
# If we don't have an SSL domain, that means we need to get a cert through an |
|
|
|
|
# http challenge. |
|
|
|
|
|
|
|
|
|
# Now I need to configure the web servers to handle this domain. |
|
|
|
|
# |
|
|
|
|
# If there is an $ssl_domain, then the SSL cert is already handled, |
|
|
|
|
# likely a wildcard. |
|
|
|
|
# |
|
|
|
|
# Otherwise, make one and then configure nginx afterwards. |
|
|
|
|
my $ssl_job_id = 0; |
|
|
|
|
if ( ! $ssl_domain ) { |
|
|
|
|
# Do not run this job in test mode. |
|
|
|
|
if ( ! $c->is_testmode ) { |
|
|
|
|
my $ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], { |
|
|
|
|
$ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], { |
|
|
|
|
notes => { '_bid_' . $blog->id => 1 }, |
|
|
|
|
priority => $blog->build_priority, |
|
|
|
|
queue => 'certbot', |
|
|
|
|
@ -156,6 +162,19 @@ sub do_domain ( $c ) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# This code creates the nginx configuration and everything. Don't run it in |
|
|
|
|
# test mode. |
|
|
|
|
if ( ! $c->is_testmode ) { |
|
|
|
|
my $build_job_id = $c->minion->enqueue( 'initialize_blog', [ $blog->id ], { |
|
|
|
|
notes => { '_bid_' . $blog->id => 1 }, |
|
|
|
|
priority => $blog->build_priority, |
|
|
|
|
|
|
|
|
|
# We we're creating an SSL cert, wait until that is done. |
|
|
|
|
$ssl_job_id ? ( parents => [ $ssl_job_id ] ) : (), |
|
|
|
|
}); |
|
|
|
|
$blog->create_related( 'jobs', { minion_job_id => $build_job_id } ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$c->redirect_to( $c->url_for( 'show_blog_settings', { id => $blog->id } ) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -202,11 +221,7 @@ sub do_settings ( $c ) { |
|
|
|
|
|
|
|
|
|
$jekyll->write_config; |
|
|
|
|
|
|
|
|
|
my $build_job_id = $c->minion->enqueue( 'initialize_blog', [ $blog->id ], { |
|
|
|
|
notes => { '_bid_' . $blog->id => 1 }, |
|
|
|
|
priority => $blog->build_priority, |
|
|
|
|
}); |
|
|
|
|
$blog->create_related( 'jobs', { minion_job_id => $build_job_id } ); |
|
|
|
|
$c->sync_blog( $blog ); |
|
|
|
|
|
|
|
|
|
$c->flash( confirmation => "Welcome to the dashboard for your new blog!" ); |
|
|
|
|
$c->redirect_to( $c->url_for( 'show_dashboard_blog', { id => $blog->id } ) ); |
|
|
|
|
|