@@ -5,17 +5,17 @@ Deploying to fortrabbit
5
5
=======================
6
6
7
7
This step-by-step cookbook describes how to deploy a Symfony web application to
8
- `fortrabbit `_. You can read more about using Symfony with fortrabbit on the
9
- official fortrabbit `Symfony install guide `_.
8
+ `fortrabbit `_. You can read more about using Symfony with fortrabbit on the
9
+ official fortrabbit `Symfony install guide `_.
10
10
11
11
Setting up fortrabbit
12
12
---------------------
13
13
14
14
Before getting started, you should have done a few things on the fortrabbit side:
15
15
16
- * `Sign up `_.
17
- * Add an SSH key to your Account (to deploy via Git)
18
- * Create an App
16
+ * `Sign up `_;
17
+ * Add an SSH key to your Account (to deploy via Git);
18
+ * Create an App.
19
19
20
20
Preparing your Application
21
21
--------------------------
@@ -54,10 +54,7 @@ to redirect it to :phpfunction:`error_log`:
54
54
55
55
<monolog : config >
56
56
<!-- ... -->
57
- <monolog : handler
58
- name =" nested"
59
- type =" error_log"
60
- />
57
+ <monolog : handler name =" nested" type =" error_log" />
61
58
</monolog : config >
62
59
</container >
63
60
@@ -77,38 +74,37 @@ Configuring Database Access & Session Handler
77
74
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78
75
79
76
You can use the fortrabbit App Secrets to attain your database credentials.
80
- Create the file ``app/config_prod_secrets.php `` with the following contents::
77
+ Create the file ``app/config/config_prod_secrets.php `` with the following
78
+ contents::
81
79
82
- <?php
83
- // Get the path to the secrects.json file
84
- if (!$secrets = getenv("APP_SECRETS") ) {
80
+ // get the path to the secrects.json file
81
+ $secrets = getenv("APP_SECRETS")
82
+ if (!$secrets) {
85
83
return;
86
84
}
87
85
88
- // Read the file and decode json to an array
86
+ // read the file and decode json to an array
89
87
$secrets = json_decode(file_get_contents($secrets), true);
90
88
91
- // Set database parameters to the container
89
+ // set database parameters to the container
92
90
if (isset($secrets['MYSQL'])) {
93
-
94
91
$container->setParameter('database_driver', 'pdo_mysql');
95
92
$container->setParameter('database_host', $secrets['MYSQL']['HOST']);
96
93
$container->setParameter('database_name', $secrets['MYSQL']['DATABASE']);
97
94
$container->setParameter('database_user', $secrets['MYSQL']['USER']);
98
95
$container->setParameter('database_password', $secrets['MYSQL']['PASSWORD']);
99
96
}
100
97
101
- // Check if the Memcache component is present
98
+ // check if the Memcache component is present
102
99
if (isset($secrets['MEMCACHE'])) {
103
-
104
100
$memcache = $secrets['MEMCACHE'];
105
101
$handlers = [];
106
102
107
103
foreach (range(1, $memcache['COUNT']) as $num) {
108
- $handlers [] = $memcache['HOST' . $num] . ':' . $memcache['PORT' . $num];
104
+ $handlers[] = $memcache['HOST'. $num]. ':'. $memcache['PORT'. $num];
109
105
}
110
106
111
- // Apply ini settings
107
+ // apply ini settings
112
108
ini_set('session.save_handler', 'memcached');
113
109
ini_set('session.save_path', implode(',', $handlers));
114
110
@@ -119,7 +115,7 @@ Create the file ``app/config_prod_secrets.php`` with the following contents::
119
115
}
120
116
}
121
117
122
- Make sure this file is listed in your * imports * :
118
+ Make sure this file is imported into the main config file :
123
119
124
120
.. configuration-block ::
125
121
@@ -205,11 +201,11 @@ Every time you push to fortrabbit composer install runs before your code gets
205
201
deployed. To finetune the deployment behavior put a `fortrabbit.yml `_. deployment
206
202
file (optional) in the project root.
207
203
208
- Add fortrabbit as a (additional) Git remote and add your configuration changes.
204
+ Add fortrabbit as a (additional) Git remote and add your configuration changes:
209
205
210
206
.. code-block :: bash
211
207
212
- $ git remote add fortrabbit git@deploy.eu2.frbit.com:your-app.git
208
+ $ git remote add fortrabbit git@deploy.eu2.frbit.com:< your-app> .git
213
209
$ git add composer.json composer.lock
214
210
$ git add app/config/config_prod_secrets.php
215
211
@@ -222,7 +218,7 @@ Commit and push
222
218
223
219
.. note ::
224
220
225
- Replace your-app with the name of your fortrabbit App.
221
+ Replace `` < your-app> `` with the name of your fortrabbit App.
226
222
227
223
.. code-block :: bash
228
224
@@ -286,4 +282,4 @@ documentation.
286
282
.. _`Symfony install guide` : https://help.fortrabbit.com/install-symfony
287
283
.. _`fortrabbit.yml` : https://help.fortrabbit.com/deployment-file-v2
288
284
.. _`database migrations and tunneling` : https://help.fortrabbit.com/install-symfony-2#toc-migrate-amp-other-database-commands
289
- .. _`Sign up` : https://dashboard.fortrabbit.com
285
+ .. _`Sign up` : https://dashboard.fortrabbit.com
0 commit comments