Skip to content

Commit c7c7284

Browse files
committed
6.9
1 parent 84eea09 commit c7c7284

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1742
-673
lines changed

.drone.jsonnet

Lines changed: 279 additions & 253 deletions
Large diffs are not rendered by default.

bin/mysql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash -e
2+
exec $SNAP/mariadb/usr/bin/mysql --socket=$SNAP_DATA/mysql.sock "$@"

bin/php.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
4+
export WP_CONFIG_DIR=$SNAP_DATA/config/wordpress
5+
exec ${DIR}/php/bin/php.sh "$@"

bin/service.mariadb.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/bin/bash -e
22

33
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
4-
5-
if [[ -z "$1" ]]; then
6-
echo "usage $0 [start]"
7-
exit 1
8-
fi
9-
10-
11-
case $1 in
12-
start)
13-
export MYSQL_HOME=/var/snap/wordpress/current/config
14-
exec ${DIR}/mariadb/usr/bin/mysqld --basedir=$SNAP/mariadb/usr --datadir=$SNAP_COMMON/database --plugin-dir=$SNAP/mariadb/lib/plugin --pid-file=$SNAP_COMMON/database/mariadb.pid
15-
;;
16-
17-
*)
18-
echo "not valid command"
19-
exit 1
20-
;;
21-
esac
4+
rm -rf $SNAP_DATA/database/aria_log_control
5+
export MYSQL_HOME=$SNAP_DATA/config
6+
exec ${DIR}/mariadb/usr/bin/mysqld \
7+
--basedir=$SNAP_DATA/mariadb/usr \
8+
--datadir=$SNAP_DATA/database \
9+
--plugin-dir=$SNAP/mariadb/lib/plugin \
10+
--pid-file=$SNAP_DATA/database/mariadb.pid

bin/service.nginx.sh

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
#!/bin/bash -e
2-
3-
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
4-
5-
if [[ -z "$1" ]]; then
6-
echo "usage $0 [start|stop]"
7-
exit 1
8-
fi
9-
10-
case $1 in
11-
pre-start)
12-
/bin/rm -f ${SNAP_COMMON}/web.socket
13-
exec ${DIR}/nginx/sbin/nginx -t -c /var/snap/wordpress/current/config/nginx.conf -p ${DIR}/nginx -g 'error_log '${SNAP_COMMON}'/log/nginx_error.log warn;'
14-
;;
15-
start)
16-
exec ${DIR}/nginx/sbin/nginx -c /var/snap/wordpress/current/config/nginx.conf -p ${DIR}/nginx -g 'error_log '${SNAP_COMMON}'/log/nginx_error.log warn;'
17-
;;
18-
post-start)
19-
timeout 5 /bin/bash -c 'until [ -S '${SNAP_COMMON}'/web.socket ]; do echo "waiting for ${SNAP_COMMON}/web.socket"; sleep 1; done'
20-
;;
21-
reload)
22-
${DIR}/nginx/sbin/nginx -c /var/snap/wordpress/current/config/nginx.conf -s reload -p ${DIR}/nginx
23-
;;
24-
stop)
25-
${DIR}/nginx/sbin/nginx -c /var/snap/wordpress/current/config/nginx.conf -s stop -p ${DIR}/nginx
26-
;;
27-
*)
28-
echo "not valid command"
29-
exit 1
30-
;;
31-
esac
2+
/bin/rm -f $SNAP_COMMON/web.socket
3+
exec $SNAP/nginx/bin/nginx.sh \
4+
-c $SNAP_DATA/config/nginx.conf \
5+
-p $SNAP/nginx \
6+
-e stderr

bin/service.php-fpm.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,4 @@
22

33
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
44

5-
if [[ -z "$1" ]]; then
6-
echo "usage $0 [start]"
7-
exit 1
8-
fi
9-
10-
case $1 in
11-
start)
12-
exec $DIR/php/bin/php-fpm.sh -y /var/snap/wordpress/current/config/php-fpm.conf -c /var/snap/wordpress/current/config/php.ini
13-
;;
14-
post-start)
15-
timeout 5 /bin/bash -c 'until [ -S /var/snap/wordpress/current/php.sock ]; do echo "waiting for /var/snap/wordpress/current/php.sock"; sleep 1; done'
16-
;;
17-
*)
18-
echo "not valid command"
19-
exit 1
20-
;;
21-
esac
5+
exec $DIR/php/bin/php-fpm.sh

bin/wp-cli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
44

55
sudo -H -E -u wordpress \
6-
LD_LIBRARY_PATH=${DIR}/php/lib \
7-
WP_CONFIG_DIR=/var/snap/wordpress/current/config/wordpress \
8-
${DIR}/php/bin/php.sh -c /var/snap/wordpress/current/config/php.ini \
9-
${DIR}/php/bin/wp-cli.phar --path=${DIR}/php/wordpress "$@"
6+
${DIR}/bin/php.sh \
7+
${DIR}/php/bin/wp-cli.phar \
8+
--path=${DIR}/php/wordpress \
9+
"$@"

cli/cmd/cli/main.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/spf13/cobra"
6+
"go.uber.org/zap"
7+
"hooks/installer"
8+
"hooks/log"
9+
"os"
10+
)
11+
12+
func main() {
13+
var cmd = &cobra.Command{
14+
Use: "cli",
15+
SilenceUsage: true,
16+
}
17+
18+
cmd.AddCommand(&cobra.Command{
19+
Use: "storage-change",
20+
RunE: func(cmd *cobra.Command, args []string) error {
21+
logger := log.Logger(zap.DebugLevel)
22+
logger.Info("storage-change")
23+
install := installer.New(logger)
24+
return install.StorageChange()
25+
},
26+
})
27+
28+
cmd.AddCommand(&cobra.Command{
29+
Use: "access-change",
30+
RunE: func(cmd *cobra.Command, args []string) error {
31+
logger := log.Logger(zap.DebugLevel)
32+
logger.Info("access-change")
33+
install := installer.New(logger)
34+
return install.AccessChange()
35+
},
36+
})
37+
38+
cmd.AddCommand(&cobra.Command{
39+
Use: "backup-pre-stop",
40+
RunE: func(cmd *cobra.Command, args []string) error {
41+
logger := log.Logger(zap.DebugLevel)
42+
logger.Info("backup-pre-stop")
43+
install := installer.New(logger)
44+
return install.BackupPreStop()
45+
},
46+
})
47+
48+
cmd.AddCommand(&cobra.Command{
49+
Use: "restore-pre-start",
50+
RunE: func(cmd *cobra.Command, args []string) error {
51+
logger := log.Logger(zap.DebugLevel)
52+
logger.Info("restore-pre-start")
53+
install := installer.New(logger)
54+
return install.RestorePreStart()
55+
},
56+
})
57+
58+
cmd.AddCommand(&cobra.Command{
59+
Use: "restore-post-start",
60+
RunE: func(cmd *cobra.Command, args []string) error {
61+
logger := log.Logger(zap.DebugLevel)
62+
logger.Info("restore-post-start")
63+
install := installer.New(logger)
64+
return install.RestorePostStart()
65+
},
66+
})
67+
68+
err := cmd.Execute()
69+
if err != nil {
70+
fmt.Print(err)
71+
os.Exit(1)
72+
}
73+
}

cli/cmd/configure/main.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/spf13/cobra"
6+
"go.uber.org/zap"
7+
"hooks/installer"
8+
"hooks/log"
9+
"os"
10+
)
11+
12+
func main() {
13+
var rootCmd = &cobra.Command{
14+
SilenceUsage: true,
15+
RunE: func(cmd *cobra.Command, args []string) error {
16+
logger := log.Logger(zap.DebugLevel)
17+
return installer.New(logger).Configure()
18+
},
19+
}
20+
21+
err := rootCmd.Execute()
22+
if err != nil {
23+
fmt.Print(err)
24+
os.Exit(1)
25+
}
26+
}

cli/cmd/install/main.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/spf13/cobra"
6+
"go.uber.org/zap"
7+
"hooks/installer"
8+
"hooks/log"
9+
"os"
10+
)
11+
12+
func main() {
13+
var rootCmd = &cobra.Command{
14+
Use: "install",
15+
SilenceUsage: true,
16+
RunE: func(cmd *cobra.Command, args []string) error {
17+
logger := log.Logger(zap.DebugLevel)
18+
return installer.New(logger).Install()
19+
},
20+
}
21+
22+
err := rootCmd.Execute()
23+
if err != nil {
24+
fmt.Print(err)
25+
os.Exit(1)
26+
}
27+
}

0 commit comments

Comments
 (0)