Skip to content

Commit 8ca4218

Browse files
committed
Initial Upload
0 parents  commit 8ca4218

File tree

4 files changed

+157
-0
lines changed

4 files changed

+157
-0
lines changed
+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: Onboard Magento With Deployer
3+
---
4+
5+
This guide will walk you through onboarding your existing Magento Store onto the AutoPilot platform using Deployer.
6+
We will initially deploy a sample codebase onto a new deployment.
7+
Although we demonstrate using PHP Deployer, you can use any deployment tool you prefer.
8+
Filesystem requirements are outlined in the [Filesystem Requirements](#filesystem-requirements) section.
9+
10+
!!! Assumption:
11+
We assume the store's domain name is `example.com`.
12+
!!!
13+
14+
## Create Deployment
15+
16+
Create a new deployment through the AutoPilot dashboard that matches your Magento version to ensure compatibility with services like PHP and MySQL.
17+
If your Magento version is unavailable, mix and match service versions to meet your requirements.
18+
If provisioning fails, open a support ticket for assistance.
19+
20+
After provisioning, visit the Security tab to whitelist your IPv4 address and SSH key.
21+
Find your public IP at [ip.jetrails.com](https://ip.jetrails.com).
22+
23+
[!button target="blank" icon="link-external" iconAlign="right" text="Find Your Public IP" href="https://ip.jetrails.com"]
24+
25+
Your shell access command is available on the Overview tab.
26+
27+
!!! Assumption:
28+
We assume the shell access command is `ssh [email protected]`.
29+
!!!
30+
31+
## Deployer File
32+
33+
We created an AutoPilot recipe for Deployer to aid the deployment process.
34+
Find it on GitHub at [jetrails/deployer-autopilot](https://github.com/jetrails/deployer-autopilot).
35+
A sample deployer recipe is in the `examples` folder, e.g., [magento2.php](https://github.com/jetrails/deployer-autopilot/blob/master/examples/magento2.php).
36+
37+
Modify the following settings in the deployer file with your values:
38+
39+
!!! Assumption:
40+
We assume the repository is `[email protected]:example/example.git` and you use deploy keys for GitHub authentication.
41+
!!!
42+
43+
```php
44+
set("repository", "[email protected]:example/example.git");
45+
set("primary_domain", "example.com");
46+
set("cluster_user", "jrc-3p7i-376i");
47+
set("elastic_ip", "10.10.10.10");
48+
```
49+
50+
Find your cluster user's public SSH key by connecting to your deployment via SSH and running:
51+
52+
```shell
53+
cat ~/.ssh/id_rsa.pub
54+
```
55+
56+
## Import Database
57+
58+
Upload your database dump to your deployment using `rsync`:
59+
60+
!!! Assumption:
61+
Your database dump is named `database-dump.sql`.
62+
!!!
63+
64+
```shell
65+
rsync -aP database-dump.sql [email protected]:/var/www/example.com/
66+
```
67+
68+
Import the database dump into your MySQL database.
69+
Find your database name in the AutoPilot dashboard's Overview tab.
70+
71+
!!! Assumption:
72+
We assume the database name is `vo889841yc249h86`.
73+
!!!
74+
75+
Run the following command:
76+
77+
```shell
78+
mysql -D vo889841yc249h86 < /var/www/example.com/database-dump.sql
79+
```
80+
81+
## Upload Media Files
82+
83+
Upload your media files using `rsync`:
84+
85+
!!! Assumption:
86+
Your local media folder is located at `/path/to/media/`.
87+
!!!
88+
89+
```shell
90+
rsync -aP --no-p --no-g --chmod=ugo=rwX /path/to/media/ [email protected]:/var/www/example.com/pub/media/
91+
```
92+
93+
The `--no-p`, `--no-g`, and `--chmod=ugo=rwX` flags ensure proper permissions on the media files.
94+
95+
## Deploy Codebase
96+
97+
Once you have your deployer file, database, and media files ready, deploy your codebase:
98+
99+
```shell
100+
dep deploy
101+
```
102+
103+
If you integrated our example recipe, services like php-fpm and varnish will restart automatically after a successful deployment.
104+
105+
## Filesystem Requirements
106+
107+
NGINX and PHP-FPM run under the `www-data` user and group, therefore, all publicly accessible files must be readable by the `www-data` user.
108+
Additionally, any directories or files that need to be writable must also have write permissions for the `www-data` user.
109+
This is easy to do with Deployer's `acl` strategy, which leverages `setfacl` to set extended permissions.
110+
111+
To ensure proper ownership and permissions for the codebase files, follow these guidelines:
112+
113+
1. The codebase files should be owned by `jrc-3p7i-376i:jetrails`.
114+
2. The codebase files should have the permissions `u=rwX,g=u,o=rX`.
115+
3. The `www-data` user should have `rwX` permissions on writable directories such as `var`.
116+
117+
If you find yourself needing to set ownership and permissions manually, then follow the outlined steps.
118+
Use the following commands to set the ownership and permissions:
119+
120+
```shell
121+
sudo chown -R jrc-3p7i-376i:jetrails /var/www/example.com
122+
sudo chmod -R u=rwX,g=u,o=rX /var/www/example.com
123+
```
124+
125+
To grant the `www-data` user the necessary write permissions, use these commands:
126+
127+
```shell
128+
sudo setfacl -L -R -m u:"www-data":rwX /var/www/example.com/live/{var,pub/static,pub/media,generated,var/page_cache}
129+
sudo setfacl -dL -R -m u:"www-data":rwX /var/www/example.com/live/{var,pub/static,pub/media,generated,var/page_cache}
130+
```

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# AutoPilot — Documentation
2+
> Hello World!!

index.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Getting Started
3+
---
4+
5+
Hello World

retype.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
input: .
2+
output: .retype
3+
poweredByRetype: false
4+
breadcrumb:
5+
enabled: true # Enabled by default on Pro projects
6+
home: Home # Custom label for the first item
7+
home: ":icon-home:" # or, use an icon
8+
separator: "|" # Custom item separator
9+
branding:
10+
title: AutoPilot
11+
label: v5
12+
footer:
13+
copyright: "&copy; Copyright {{ year }}. All rights reserved."
14+
edit:
15+
repo: "https://github.com/jetrails/autopilot-docs"
16+
base: ""
17+
branch: "master"
18+
label: "Edit this page"
19+
editor:
20+
enabled: false

0 commit comments

Comments
 (0)