Skip to content

Commit 7e767bb

Browse files
committed
readme
1 parent 8532efe commit 7e767bb

File tree

1 file changed

+99
-30
lines changed

1 file changed

+99
-30
lines changed

README.md

Lines changed: 99 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,108 @@ The EB CLI integrates with Git and simplifies the process of creating environmen
77

88
If you have pip, use it to install the EB CLI.
99

10-
```
10+
```Shell
1111
$ pip install --user --upgrade awsebcli
12+
```
13+
14+
Add the local install location to your OS's path variable.
15+
16+
###### Linux
17+
```Shell
1218
$ export PATH=~/.local/bin:$PATH
1319
```
20+
###### OS-X
21+
```Shell
22+
$ export PATH=~/Library/Python/3.4/bin:$PATH
23+
```
24+
###### Windows
25+
Add `%USERPROFILE%\AppData\Roaming\Python\Scripts` to your PATH variable. Search for **Edit environment variables for your account** in the Start menu.
1426

1527
If you don't have pip, follow the instructions [here](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html).
1628

17-
## Download and extract Drupal and the configuration files
1829

19-
```
20-
~$ curl https://ftp.drupal.org/files/projects/drupal-8.2.2.tar.gz -o drupal.tar.gz
21-
~$ curl https://github.com/awslabs/eb-php-drupal/releases/download/v1.0/eb-php-drupal-v1.zip -o eb-php-drupal.zip
22-
~$ tar -xvf drupal.tar.gz && mv drupal-8.2.2 drupal-beanstalk && cd drupal-beanstalk
23-
~/drupal-beanstalk$ unzip ../eb-php-drupal.zip
24-
```
30+
## Set up your project directory
2531

26-
## Create an environment
27-
```
28-
~/drupal-beanstalk$ eb init --platform php5.6 --region us-east-2
29-
(specify a different region if you have a preference)
30-
~/drupal-beanstalk$ eb ssh --setup
31-
~/drupal-beanstalk$ eb create drupal-beanstalk --sample --database
32-
(choose database username/password, CTRL+C to exit once create is in-progress)
33-
```
32+
1. Download Drupal.
33+
34+
~$ curl https://ftp.drupal.org/files/projects/drupal-8.2.2.tar.gz -o drupal.tar.gz
35+
36+
2. Download the configuration files in this repository
37+
38+
~$ curl https://github.com/awslabs/eb-php-drupal/releases/download/v1.0/eb-php-drupal-v1.zip -o eb-php-drupal.zip
39+
40+
3. Extract Drupal and change the name of the folder
41+
42+
~$ tar -xvf drupal.tar.gz
43+
~$ mv drupal-8.2.2 drupal-beanstalk
44+
~$ cd drupal-beanstalk
45+
46+
4. Extract the configuration files over the Drupal installation
47+
48+
~/drupal-beanstalk$ unzip ~/eb-php-drupal.zip
49+
creating: .ebextensions/
50+
inflating: .ebextensions/dev.config
51+
inflating: .ebextensions/drupal.config
52+
inflating: .ebextensions/efs-create.config
53+
inflating: .ebextensions/efs-mount.config
54+
inflating: .ebextensions/loadbalancer-sg.config
55+
inflating: LICENSE
56+
inflating: README.md
57+
inflating: beanstalk-settings.php
58+
59+
60+
## Create an Elastic Beanstalk environment
61+
62+
1. Configure a local EB CLI repository with the PHP platform. Choose a [supported region](http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region) that is close to you.
63+
64+
~/drupal-beanstalk$ eb init --platform php7.0 --region us-west-
65+
Application drupal-beanstalk has been created.
66+
67+
2. Configure SSH. Create a key that Elastic Beanstalk will assign to the EC2 instances in your environment to allow you to connect to them later. You can also choose an existing key pair if you have the private key locally.
68+
69+
~/drupal-beanstalk$ eb init
70+
Do you want to set up SSH for your instances?
71+
(y/n): y
72+
73+
Select a keypair.
74+
1) [ Create new KeyPair ]
75+
(default is 1): 1
76+
77+
Type a keypair name.
78+
(Default is aws-eb): beanstalk-drupal
79+
80+
3. Create an Elastic Beanstalk environment with a MySQL database.
81+
82+
~/drupal-beanstalk$ eb create drupal-beanstalk --sample --database
83+
Enter an RDS DB username (default is "ebroot"):
84+
Enter an RDS DB master password:
85+
Retype password to confirm:
86+
Environment details for: drupal-beanstalk
87+
Application name: drupal-beanstalk
88+
Region: us-west-2
89+
Deployed Version: Sample Application
90+
Environment ID: e-nrx24yzgmw
91+
Platform: 64bit Amazon Linux 2016.09 v2.2.0 running PHP 7.0
92+
Tier: WebServer-Standard
93+
CNAME: UNKNOWN
94+
Updated: 2016-11-01 12:20:27.730000+00:00
95+
Printing Status:
96+
INFO: createEnvironment is starting.
3497

3598
## Networking configuration
3699
Modify the configuration files in the .ebextensions folder with the IDs of your [default VPC and subnets](https://console.aws.amazon.com/vpc/home#subnets:filter=default), and [your public IP address](https://www.google.com/search?q=what+is+my+ip).
37100

38-
- `.ebextensions/efs-create.config` creates an EFS file system and mount points in each Availability Zone / subnet in your VPC.
39-
- `.ebextensions/dev.config` restricts access to your environment to your IP address to protect it during the Drupal installation process.
101+
- `.ebextensions/efs-create.config` creates an EFS file system and mount points in each Availability Zone / subnet in your VPC. Identify your default VPC and subnet IDs in the [VPC console](https://console.aws.amazon.com/vpc/home#subnets:filter=default). If you have not used the console before, use the region selector to select the same region that you chose for your environment.
102+
- `.ebextensions/ssh.config` restricts access to your environment to your IP address to protect it during the Drupal installation process. Replace the placeholder IP address near the top of the file with your public IP address.
40103

41104
## Deploy Drupal to your environment
42-
Deploy the project code to your Elastic Beanstalk environment.
105+
Deploy the project code to your Elastic Beanstalk environment.
43106

44107
First, confirm that your environment is `Ready` with `eb status`. Environment creation takes about 15 minutes due to the RDS DB instance provisioning time.
45108

46-
```
47-
$ eb status
48-
$ eb deploy
109+
```Shell
110+
~/drupal-beanstalk$ eb status
111+
~/drupal-beanstalk$ eb deploy
49112
```
50113

51114
### NOTE: security configuration
@@ -58,7 +121,7 @@ You can [view the related SGs in the EC2 console](https://console.aws.amazon.com
58121

59122
Open your site in a browser.
60123

61-
```
124+
```Shell
62125
~/drupal-beanstalk$ eb open
63126
```
64127

@@ -78,36 +141,42 @@ The installation process created a file named `settings.php` in the `sites/defau
78141

79142
The project includes a settings file that uses environment variables to provide secrets to the application. Create a copy of this file named `settings.php`.
80143

81-
```
144+
```Shell
82145
~/drupal-beanstalk$ cp beanstalk-settings.php sites/default/settings.php
83146
```
84147

85148
This file reads variables for the database connection, which are provided by Elastic Beanstalk when you create a database instance inside your environment. It also reads variables named `HASH_SALT` and `SYNC_DIR`.
86149

87150
The hash salt can be any value but shouldn't be stored in source control. Use `eb setenv` to set this variable directly on the environment.
88-
```
89-
~/drupal-beanstalk$ eb setenv HASH_SALT=randomnumbersandletters89237492374
151+
152+
```Shell
153+
~/drupal-beanstalk$ eb setenv HASH_SALT=sd082lboxi235kf9g8hah
90154
```
91155

92156
The sync directory is not a secret but is randomly generated when you install Drupal. Connect to the instance to find the value for this variable.
93-
```
157+
158+
```Shell
94159
~/drupal-beanstalk$ eb ssh
95160
[ec2-user ~]$ tail /var/app/current/sites/default/settings.php
96161
$config_directories['sync'] = 'sites/default/files/config_4ccfX2sPQm79p1mk5IbUq9S_FokcENO4mxyC-L18-4g_xKj_7j9ydn31kDOYOgnzMu071Tvc4Q/sync';
97162
```
163+
98164
Replace the placeholder value in `.ebextensions/drupal.config` with the value shown after `$config_directories['sync']`.
99-
```
165+
166+
```Shell
100167
SYNC_DIR: sites/default/files/config_XXXXXXXXXXXXXXX/sync
101168
```
102169

103170
Remove the custom load balancer configuration to open the site to the Internet.
104-
```
171+
172+
```Shell
105173
~/drupal-beanstalk$ rm .ebextensions/loadbalancer-sg.config
106174
~/drupal-beanstalk$ eb deploy
107175
```
108176

109177
Finally, scale up to run the site on multiple instances for high availability.
110-
```
178+
179+
```Shell
111180
~/drupal-beanstalk$ eb scale 3
112181
```
113182

0 commit comments

Comments
 (0)