Skip to content

Commit 215cea3

Browse files
authored
Merge pull request #30 from rtCamp/feature/plesk-deployment
Add support for Plesk deployment
2 parents 6b97744 + f68be4f commit 215cea3

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN apt update && \
2626
software-properties-common && \
2727
add-apt-repository ppa:ondrej/php && \
2828
apt update && \
29-
apt-get install -y php7.4-cli php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-iconv && \
29+
apt-get install -y php7.4-cli php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-iconv php7.4-yaml && \
3030
pip3 install shyaml && \
3131
rm -rf /var/lib/apt/lists/*
3232

deploy.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@
7676
desc('Reset opcache');
7777
task('opcache:reset', function () {
7878

79-
$ee_version = run('ee --version');
79+
$ee_version = '';
80+
try {
81+
$ee_version = run('ee --version');
82+
} catch(\Exception $e) {
83+
echo 'Not using EasyEngine.';
84+
}
8085

8186
if ( false !== strpos( $ee_version, 'EasyEngine v3' ) ) {
8287

@@ -98,7 +103,12 @@
98103
desc('Upgrade WordPress DB');
99104
task('core_db:update', function () {
100105

101-
$ee_version = run('ee --version');
106+
$ee_version = '';
107+
try {
108+
$ee_version = run('ee --version');
109+
} catch(\Exception $e) {
110+
echo 'Not using EasyEngine.';
111+
}
102112

103113
if ( false !== strpos( $ee_version, 'EasyEngine v3' ) ) {
104114

@@ -128,8 +138,26 @@
128138
*/
129139
desc('Correct Permissions');
130140
task('permissions:set', function () {
131-
$output = run('chown -R www-data:www-data {{deploy_path}}');
132-
writeln('<info>' . $output . '</info>');
141+
142+
try {
143+
$plesk_version = run('plesk version');
144+
} catch(\Exception $e) {
145+
echo 'Not using Plesk.';
146+
}
147+
148+
if ( false !== strpos( $plesk_version, 'Plesk' ) ) {
149+
$branch = get('branch');
150+
$hosts_parsed = yaml_parse_file("/hosts.yml");
151+
$permission = ($hosts_parsed[$branch]['permission']);
152+
153+
$output = run("chown -R $permission {{deploy_path}}");
154+
writeln('<info>' . $output . '</info>');
155+
$output = run("chmod o-rwx {{deploy_path}}/current");
156+
writeln('<info>' . $output . '</info>');
157+
} else {
158+
$output = run('chown -R www-data:www-data {{deploy_path}}');
159+
writeln('<info>' . $output . '</info>');
160+
}
133161
});
134162

135163
/* deployment task */

0 commit comments

Comments
 (0)