|
|
|
@ -26,6 +26,9 @@ sub do_create ($c) { |
|
|
|
return if $c->stash->{errors}; |
|
|
|
return if $c->stash->{errors}; |
|
|
|
|
|
|
|
|
|
|
|
$domain = $domain ? $domain : $subdomain . '.' . $c->config->{customer_domain}; |
|
|
|
$domain = $domain ? $domain : $subdomain . '.' . $c->config->{customer_domain}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create the Jekyll repo for the site |
|
|
|
|
|
|
|
my $jekyll = $c->jekyll($domain)->init; |
|
|
|
|
|
|
|
|
|
|
|
my $blog = try { |
|
|
|
my $blog = try { |
|
|
|
$c->db->storage->schema->txn_do( sub { |
|
|
|
$c->db->storage->schema->txn_do( sub { |
|
|
|
@ -39,6 +42,10 @@ sub do_create ($c) { |
|
|
|
domain_id => $domain_record->id, |
|
|
|
domain_id => $domain_record->id, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$blog->create_related( 'repoes', { |
|
|
|
|
|
|
|
url => $jekyll->repo, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return $blog; |
|
|
|
return $blog; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} catch { |
|
|
|
} catch { |
|
|
|
@ -50,11 +57,19 @@ sub do_create ($c) { |
|
|
|
|
|
|
|
|
|
|
|
$domain = $domain ? $domain : $subdomain . '.' . $c->config->{hosted_domain}; |
|
|
|
$domain = $domain ? $domain : $subdomain . '.' . $c->config->{hosted_domain}; |
|
|
|
|
|
|
|
|
|
|
|
# Create the Jekyll repo for the site |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Configure DNS to point to the blog |
|
|
|
# Configure DNS to point to the blog |
|
|
|
|
|
|
|
|
|
|
|
# Schedule a job to deploy the website |
|
|
|
# Schedule a job to deploy the website |
|
|
|
|
|
|
|
my $ssl_job_id = $c->minion->enqueue( 'create_ssl_cert', [ $blog->id ], { |
|
|
|
|
|
|
|
notes => { '_mjb_bid_' . $blog->id => 1 }, |
|
|
|
|
|
|
|
queue => 'certbot', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$c->minion->enqueue( 'deploy_blog', [ $blog->id ], { |
|
|
|
|
|
|
|
notes => { '_mjb_bid_' . $blog->id => 1 }, |
|
|
|
|
|
|
|
parents => [ $ssl_job_id ], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
# Take the user to the management panel for the site |
|
|
|
# Take the user to the management panel for the site |
|
|
|
|
|
|
|
|
|
|
|
|