-
Notifications
You must be signed in to change notification settings - Fork 0
/
guide.txt
242 lines (208 loc) · 7.52 KB
/
guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
---------------------------
NEW LOCAL DEV ENVIRONMENT
---------------------------
Assumptions:
1) <newsite> is the name of the repo
2) You're using Git Bash and PHPStorm
3) /c/sites/www/ (C:\sites\www\) is a directory
4) You already have a copy of the database
4) You have 'newlocal' cloned in /c/sites/www/
Create new directory / pull repo [LOCAL]
-----------------------------------------
cd /c/sites/www/
git clone <link>
(should create <newsite> dir, which is the root dir)
Create VM [LOCAL]
------------------
From Site Root:
copy Vagrantfile into root dir, change vb.name to 'NewSite'
cp ../newlocal/local/Vagrantfile .
vim Vagrantfile
copy bootstrap.sh into root dir, change all instances of 'newsite'
cp ../newlocal/local/bootstrap.sh .
vim bootstrap.sh
:%s/newsite/<newsite>/g (find / replace 'newsite' with <newsite>)
vagrant up (make sure it's using port 2222)
vagrant status (make sure it's running properly)
vagrant ssh
Create User & Create / Import Database [VAGRANT]
-------------------------------------------------
// mysql -u root (no password) (shouldn't be needed)
// create database <newsite>; (shouldn't be needed)
// use <newsite>; (shouldn't be needed)
// grant all on <newsite>.* to root@localhost; (shouldn't be needed)
// quit; (mysql) (shouldn't be needed)
mysql -u root <newsite> < <import file>.sql (via vagrant ssh)
Update Hosts File [NOTEPAD as administrator]
---------------------------------------------
192.168.33.10 newsite.dev www.newsite.dev
New PHPStorm Project [PHPSTORM]
--------------------------------
Create new project from existing files
Choose: Source files are in a local directory, no web server is yet configured
Navigate to /www/<newsite>, click 'Project Root'
Add PHPStorm Deployment [PHPSTORM]
-----------------------------------
Navigate to Tools > Deployment > Configuration
Add deployment name & SFTP
Set connection settings
SFTP host: wwww.<newsite>.dev
Port: 22
Root Path: /
User: vagrant
Pass: vagrant
Web server: http://<SFTP host>
Set mappings
Local path: C:\sites\www\<newsite>
Deploy path: /var/www/html
Web path: /
Update Vagrant w/ Local Files [PHPSTORM]
-----------------------------------------
Right click on project folder (<newsite>) and click 'Upload To'
Install Magerun [VAGRANT]
--------------------------
// https://github.com/netz98/n98-magerun/wiki/Commands
wget http://files.magerun.net/n98-magerun-latest.phar -O n98-magerun.phar
sudo chmod +x ./n98-magerun.phar
sudo cp ./n98-magerun.phar /usr/local/bin/
Install Magerun Add-Ons [VAGRANT]
----------------------------------
// http://magerun.net/magerun-addons-by-peter-jaap-blaakmeer/
sudo mkdir -p ~/.n98-magerun/modules/
cd ~/.n98-magerun/modules/
sudo git clone https://github.com/peterjaap/magerun-addons.git
Create local.xml [VAGRANT]
---------------------------
From Site Root:
n98-magerun.phar local-config:generate
Host: localhost
User: root
Pass: (blank)
Database: <newsite>
Session: db
Admin: admin
Change Base URLs [VAGRANT]
---------------------------
From Site Root:
n98-magerun.phar sys:store:config:base-url:set
Scope: 0 (Main shop)
Base URL: www.<newsite>.dev
Unsecure: [ENTER]
Secure: * Make sure secure url is http, not https
Defaults are ok for everything else
Add Database to PHPStorm [PHPSTORM]
------------------------------------
Click 'Database' tab on top right
Add new MySQL data source
General Tab:
User: root
Password: (blank)
URL: jdbc:mysql://localhost:3306/<newsite>
(Make sure the dropdown is set to 'URL only')
SSH / SSL Tab:
Use SSH tunnel: (checked)
Host: 127.0.0.1
Port: 2222
User: vagrant
Password: vagrant
* NOTE: To test the connection to the db, vagrant up
Testing the SSH connection, vagrant ssh
-------------------
NEW CODE ANALYSIS
-------------------
Assumptions:
1) <siteanalysis> is the name of the analysis
2) You're using Git Bash and PHPStorm
3) /c/sites/www/ (C:\sites\www\) is a directory
Create new directory [LOCAL]
-----------------------------
cd /c/sites/www/
mkdir <siteanalysis>
Create VM [LOCAL]
------------------
copy /c/sites/www/newlocal/analysis/Vagrantfile into root dir, change vb.name to
'Site Analysis'
copy /c/sites/www/newlocal/analysis/bootstrap.sh into root dir,
change all instances of 'siteanalysis'
vim bootstrap.sh
:%s/siteanalysis/<siteanalysis>/g
vagrant up (make sure it's using port 2222)
vagrant status (make sure it's running properly)
vagrant ssh
Update Vagrant w/ Local Files [LOCAL + VAGRANT]
------------------------------------------------
copy tar.gz into /c/www/sites/Vagrant/siteanalysis
vagrant ssh (within siteanalysis dir)
mv /vagrant_data/<siteanalysis>.tar.gz .
tar zxvf <siteanalysis>.tar.gz
Import Database [VAGRANT]
--------------------------
mysql -u root -p <siteanalysis> < <importfile>.sql
Create local.xml [VAGRANT]
---------------------------
From Site Root:
magerun local-config:generate
Host: localhost
User: root
Pass: (blank)
Database: <siteanalysis>
Session: db
Admin: admin
Change Base URLs [VAGRANT] (Requires Add-Ons)
----------------------------------------------
From Site Root:
magerun sys:store:config:base-url:set
Scope: 0 (Main shop)
Base URL: www.<siteanalysis>.dev
Unsecure: [ENTER]
Secure: * Make sure secure url is http, not https
Defaults are ok for everything else
Check Theme for Duplicates [VAGRANT]
-------------------------------------
magerun dev:theme:duplicates {packagename}
Diff Core [LOCAL]
------------------
diff -wqr magento/app/code/core/ magento-clean/app/code/core/
Check for Local Overrides [VAGRANT]
------------------------------------
if [ -d app/code/local/Mage ]; then echo 'Mage Directory in Local Codepool'; fi
if [ -d app/code/local/Enterprise ]; then echo 'Enterprise Directory in Local Codepool'; fi
if [ -d app/code/community/Mage ]; then echo 'Mage Directory in Community Codepool'; fi
if [ -d app/code/community/Enterprise ]; then echo 'Enterprise Directory in Community Codepool'; fi
Check for Rewrite Conflicts [VAGRANT]
--------------------------------------
magerun dev:module:rewrite:conflicts
Check Code Quality [VAGRANT]
-----------------------------
phpcs -pn --report-width=120 --report=summary --standard=/home/vagrant/Ecg/Ecg app/code/local/
Module Count [VAGRANT]
-----------------------
magerun dev:module:list --codepool=local --status=active
magerun dev:module:list --codepool=community --status=active
---------------------------------
GIT: ADD DEPLOYMENT TO NEW SITE
---------------------------------
---------------------
GIT: CREATE NEW TAG
---------------------
Merge new code into production branch
--------------------------------------
git tag -a v1.0.1 -m "Message describing reason for new version/tag"
git push origin v1.0.1
Create release on github off of tag
On prod server
<switch to website owner/user>
git fetch --all
git checkout -b v1.0.1 v1.0.1
--------------------------------
NEW DATABASE IN ZEROLAG CONTROL
--------------------------------
Click into environment
Click 'Add Account' in top right
Change dropdown to 'this is a linked database account'
Fill out form
Save
---------------------------------------
GIT: REMOVE LARGE FILE SO YOU CAN PUSH
---------------------------------------
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD