Skip to content
This repository has been archived by the owner on Jun 25, 2018. It is now read-only.

Commit

Permalink
test aws upload and move to clever-cloud hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
romainnorberg committed Aug 29, 2016
1 parent 7fe3d8e commit dd1ef8f
Show file tree
Hide file tree
Showing 19 changed files with 642 additions and 364 deletions.
1 change: 1 addition & 0 deletions .clever.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"apps":[{"app_id":"app_38a5484e-81c3-4973-af23-291dce11841b","deploy_url":"https://github.com/romainnorberg/construct-tim.git","name":"construct-tim","alias":"construct-tim"}]}
5 changes: 0 additions & 5 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ twig:
s3_region: '%s3_region%'
s3_version: '%s3_version%'
s3_bucket: '%s3_bucket%'
s3_policy: '%s3_policy%'
s3_signature: '%s3_signature%'
s3_signature: '%s3_signature%'
s3_key: '%s3_credentials_key%'
s3_secret: '%s3_credentials_secret%'

# Doctrine Configuration
doctrine:
Expand Down
34 changes: 15 additions & 19 deletions app/config/parameters_prod.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
<?php

# https://help.fortrabbit.com/secrets

$secrets = json_decode(file_get_contents($_SERVER['APP_SECRETS']), true);

# database
$container->setParameter('database_driver', 'pdo_mysql');
$container->setParameter('database_host', $secrets['MYSQL']['HOST']);
$container->setParameter('database_name', $secrets['MYSQL']['DATABASE']);
$container->setParameter('database_user', $secrets['MYSQL']['USER']);
$container->setParameter('database_password', $secrets['MYSQL']['PASSWORD']);
$container->setParameter('database_host', getenv('MYSQL_ADDON_HOST'));
$container->setParameter('database_name', getenv('MYSQL_ADDON_DB'));
$container->setParameter('database_user', getenv('MYSQL_ADDON_USER'));
$container->setParameter('database_password', getenv('MYSQL_ADDON_PASSWORD'));

# mailer
$container->setParameter('mailer_transport', 'smtp');
$container->setParameter('mailer_host', $secrets['CUSTOM']['MAILER_HOST']);
$container->setParameter('mailer_user', $secrets['CUSTOM']['MAILER_USER']);
$container->setParameter('mailer_password', $secrets['CUSTOM']['MAILER_PASSWORD']);
$container->setParameter('mailer_sender', $secrets['CUSTOM']['MAILER_SENDER']);
$container->setParameter('mailer_host', getenv('MAILER_HOST'));
$container->setParameter('mailer_user', getenv('MAILER_USER'));
$container->setParameter('mailer_password', getenv('MAILER_PASSWORD'));
$container->setParameter('mailer_sender', getenv('MAILER_SENDER'));

# locale
$container->setParameter('locale', 'fr');

# rollbar
$container->setParameter('rollbar_server_access_token', $secrets['CUSTOM']['ROLLBAR_SERVER_ACCESS_TOKEN']);
$container->setParameter('rollbar_client_access_token', $secrets['CUSTOM']['ROLLBAR_CLIENT_ACCESS_TOKEN']);
$container->setParameter('rollbar_environment', $secrets['CUSTOM']['ROLLBAR_ENVIRONMENT']);
$container->setParameter('rollbar_server_access_token', getenv('ROLLBAR_SERVER_ACCESS_TOKEN'));
$container->setParameter('rollbar_client_access_token', getenv('ROLLBAR_CLIENT_ACCESS_TOKEN'));
$container->setParameter('rollbar_environment', getenv('ROLLBAR_ENVIRONMENT'));

# ewz_recaptcha
$container->setParameter('ewz_recaptcha_public_key', $secrets['CUSTOM']['EWZ_RECAPTCHA_PUBLIC_KEY']);
$container->setParameter('ewz_recaptcha_private_key', $secrets['CUSTOM']['EWZ_RECAPTCHA_PRIVATE_KEY']);
$container->setParameter('ewz_recaptcha_public_key', getenv('EWZ_RECAPTCHA_PUBLIC_KEY'));
$container->setParameter('ewz_recaptcha_private_key', getenv('EWZ_RECAPTCHA_PRIVATE_KEY'));

# s3 permissions
$container->setParameter('s3_credentials_key', $secrets['CUSTOM']['S3_CREDENTIALS_KEY']);
$container->setParameter('s3_credentials_secret', $secrets['CUSTOM']['S3_CREDENTIALS_SECRET']);
$container->setParameter('s3_credentials_key', getenv('S3_CREDENTIALS_KEY'));
$container->setParameter('s3_credentials_secret', getenv('S3_CREDENTIALS_SECRET'));
4 changes: 4 additions & 0 deletions app/config/services/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ services:
- { name: sonata.admin, manager_type: orm, label: Type de projet }
calls:
- [ setTemplate, [edit, AppBundle::admin/edit.html.twig]]

admin.tinymce:
class: AppBundle\Admin\TinymceAdmin
arguments: [~, ~, ~]
24 changes: 3 additions & 21 deletions app/config/services/s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,9 @@
}

$s3_bucket = 'construct-tim-2016';
$s3_region = 'eu-central-1';
$acl = 'private';

$s3_policy = base64_encode(json_encode(array(
'expiration' => date('Y-m-d\TH:i:s.000\Z', strtotime('+1 day')),
'conditions' => array(
array('bucket' => $s3_bucket),
array('signatureVersion' => 'v4'),
array('acl' => 'public-read'),
array('starts-with', '$key', ''),
array('starts-with', '$Content-Type', ''), // accept all files
// Plupload internally adds name field, so we need to mention it here
array('starts-with', '$name', ''),
// One more field to take into account: Filename - gets silently sent by FileReference.upload() in Flash
// http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTFlash.html
array('starts-with', '$Filename', ''),
)
)));
// sign policy
$s3_signature = base64_encode(hash_hmac('sha1', $s3_policy, getenv('S3_CREDENTIALS_SECRET'), true));

$container->setParameter('s3_region', 'eu-central-1');
$container->setParameter('s3_region', $s3_region);
$container->setParameter('s3_version', 'latest');
$container->setParameter('s3_bucket', $s3_bucket);
$container->setParameter('s3_policy', $s3_policy);
$container->setParameter('s3_signature', $s3_signature);
Empty file modified app/logs/.gitkeep
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions clevercloud/ccbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

php bin/console doctrine:schema:update --dump-sql
php bin/console doctrine:schema:update --force
1 change: 1 addition & 0 deletions clevercloud/cron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
4 changes: 4 additions & 0 deletions clevercloud/newrelic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"license": "7a7ec9c0a0c9d8ba6bd93f1592726e8040272dcd",
"appname": "Contruct-tim"
}
8 changes: 8 additions & 0 deletions clevercloud/php.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"deploy": {
"webroot": "/web"
},
"hooks": {
"postDeploy": "clevercloud/ccbuild.sh"
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"knplabs/knp-gaufrette-bundle": "^0.3.0",
"liip/imagine-bundle": "1.5.3",
"stfalcon/tinymce-bundle": "2.0",
"moxiecode/plupload": "3.x-dev"
"cocur/slugify": "^2.1"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
Expand Down
Loading

0 comments on commit dd1ef8f

Please sign in to comment.