-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagento-install
135 lines (110 loc) · 5.13 KB
/
magento-install
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
# Magento-scripts
This repository contains helpful steps and instructions for managing magento deployments.
## Magento installation scripts - https://github.com/indunie/magento-scripts
## Example command to install ( run as root)
```
./magento-install.sh --magento-username admin \
--magento-email [email protected] \
--magento-password admin@123 \
--database magento_osa_dev \
--database-user magentoip \
--database-password magento@123 \
--site-name osa.emmpressit.net.au \
--base-url https://osa.emmpressit.net.au \
--system-user=magento \
--system-password=magento@123 \
--elasticsearch-host=149.28.172.9 \
--elasticsearch-port=8080
```
## Creating replica/staging site from exsiting deployment
- Copy exsiting magento folder as new folder ( Make sure to clean any unnecesary/large log files inside `var/log`)
- Find current database used from `app/etc/env.php` in `db` section and replicate the database
- To baclup databse run `mysqldump --single-transaction -u <database_user> -p <database_name> > <backup_db_name>-$(date +'%Y%m%d_%H%M%S').sql`
- Then create a new database with desired name using mysql shell - Ex `create database my_staging_magento;`
- Restore previouse backup to new database.
- Run following command
```bash
mysql -u <db_user> -p <new_database_name> --init-command="SET SESSION FOREIGN_KEY_CHECKS=0;" < <backup_file_path.sql>
```
- Modify database name in new site by editing `app/etc/env.php`
- Update base URLs in new database
- Execute mysql shell and select correct database
- Find current base urls.
`select * from core_config_data where path like '%base%url%';`
- Update to new values. Make sure to have ending slash (`/`) and `https://`
`update core_config_data set value = 'https://<new_domain>/' where value = 'https://<old_domain>/';`
- Check again whether URLs are updated by
`select * from core_config_data where path like '%base%url%';`
- Point new DNS and create new apache configurations for new domain name(s) - for multisite magento deployments you need to create seperate config files for each new domain
- Sample apache configuration file - let say new domain is `staging.example.com`. New config file is at `/etc/apache2/sites-available/staging.example.com.conf`. And make sure to replace necessary fields
```
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName staging.example.com
ServerAlias www.staging.example.com # Only add if you need www alias
ServerAdmin webmaster@localhost
DocumentRoot /home/magento/staging.example.com # Make sure to add correct path
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/staging.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/staging.example.com.access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<Directory "<path_to_magento_directory_withount_ending_slash>">
AllowOverride All
</Directory>
```
- After modifying config files enable those configurations by running `a2ensite staging.example.com.conf` and run `systemctl reload apache2`
- Edit `.htaccess` file for multi site deployments
- If all done correctly, new replica should work, check file permissions also
## Install SSL certificates
`certbot --apache -d <new-domain>`
## Install FileRun using docker and `docker-compose.yml`
```yml
version: '2'
services:
db:
image: mariadb:10.1
environment:
MYSQL_ROOT_PASSWORD: hsxsgW#5r
MYSQL_USER: myuser
MYSQL_PASSWORD: jhsbygF54Ff
MYSQL_DATABASE: filerun
volumes:
- /filerun/db:/var/lib/mysql
web:
image: filerun/filerun
environment:
FR_DB_HOST: db
FR_DB_PORT: 3306
FR_DB_NAME: filerun
FR_DB_USER: myuser
FR_DB_PASS: jhsbygF54Ff
APACHE_RUN_USER: magento
APACHE_RUN_USER_ID: 1001
APACHE_RUN_GROUP: magento
APACHE_RUN_GROUP_ID: 1001
depends_on:
- db
links:
- db:db
ports:
- "8002:80"
volumes:
- ./html:/var/www/html
- /home/magento:/user-files
```