-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Software title: MariaDb and phpMyAdmin
- Loading branch information
1 parent
478d328
commit e363dde
Showing
10 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== "Configuration" | ||
|
||
Database access configuration is done at first install: | ||
- create root password | ||
- create database | ||
- create normal user | ||
- create password for normal user | ||
|
||
- Database host: `<your.IP>` | ||
|
||
=== "Directories" | ||
|
||
- Install directory: `/armbian/mariadb` | ||
- Site configuration directory: `/armbian/mariadb/config` | ||
|
||
=== "View logs" | ||
|
||
```sh | ||
docker logs -f mariadb | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mariadb is one of the most popular database servers. Made by the original developers of MySQL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
=== "Access to the web interface" | ||
|
||
The web interface is accessible via port **8071**: | ||
|
||
- URL: `https://<your.IP>:8071` | ||
- Server: IP from server you are connecting to. If you have installed MariaDB via this tool, then this is `<your.IP>` | ||
- Username: defined at SQL server install (MariaDb) | ||
- Password: defined at SQL server install (MariaDb) | ||
|
||
=== "Directories" | ||
|
||
- Install directory: `/armbian/phpmyadmin` | ||
- Site configuration directory: `/armbian/phpmyadmin/config` | ||
|
||
=== "View logs" | ||
|
||
```sh | ||
docker logs -f phpmyadmin | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Phpmyadmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
module_options+=( | ||
["module_mariadb,author"]="" | ||
["module_mariadb,maintainer"]="@igorpecovnik" | ||
["module_mariadb,testers"]="@igorpecovnik" | ||
["module_mariadb,feature"]="module_mariadb" | ||
["module_mariadb,desc"]="Install mariadb container" | ||
["module_mariadb,example"]="install remove purge status help" | ||
["module_mariadb,port"]="3306" | ||
["module_mariadb,status"]="Active" | ||
["module_mariadb,arch"]="" | ||
) | ||
# | ||
# Module mariadb-PDF | ||
# | ||
function module_mariadb () { | ||
local title="mariadb" | ||
local condition=$(which "$title" 2>/dev/null) | ||
|
||
if check_if_installed docker-ce; then | ||
local container=$(docker container ls -a | mawk '/mariadb?( |$)/{print $1}') | ||
local image=$(docker image ls -a | mawk '/mariadb?( |$)/{print $3}') | ||
fi | ||
|
||
local commands | ||
IFS=' ' read -r -a commands <<< "${module_options["module_mariadb,example"]}" | ||
|
||
MARIADB_BASE="${SOFTWARE_FOLDER}/mariadb" | ||
|
||
case "$1" in | ||
"${commands[0]}") | ||
check_if_installed docker-ce || install_docker | ||
[[ -d "$MARIADB_BASE" ]] || mkdir -p "$MARIADB_BASE" || { echo "Couldn't create storage directory: $MARIADB_BASE"; exit 1; } | ||
|
||
# get parameters | ||
MYSQL_ROOT_PASSWORD=$($DIALOG --title "Enter root password for Mariadb SQL server" --inputbox "\nHit enter for defaults" 9 50 "armbian" 3>&1 1>&2 2>&3) | ||
MYSQL_DATABASE=$($DIALOG --title "Enter database name for Mariadb SQL server" --inputbox "\nHit enter for defaults" 9 50 "armbian" 3>&1 1>&2 2>&3) | ||
MYSQL_USER=$($DIALOG --title "Enter user name for Mariadb SQL server" --inputbox "\nHit enter for defaults" 9 50 "armbian" 3>&1 1>&2 2>&3) | ||
MYSQL_PASSWORD=$($DIALOG --title "Enter new password for ${MYSQL_USER}" --inputbox "\nHit enter for defaults" 9 50 "armbian" 3>&1 1>&2 2>&3) | ||
docker run -d \ | ||
--name=mariadb \ | ||
-e PUID=1000 \ | ||
-e PGID=1000 \ | ||
-e TZ="$(cat /etc/timezone)" \ | ||
-e "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" \ | ||
-e "MYSQL_DATABASE=${MYSQL_DATABASE}" \ | ||
-e "MYSQL_USER=${MYSQL_USER}" \ | ||
-e "MYSQL_PASSWORD=${MYSQL_PASSWORD}" \ | ||
-p 3306:3306 \ | ||
-v "${MARIADB_BASE}/config:/config" \ | ||
--restart unless-stopped \ | ||
lscr.io/linuxserver/mariadb:latest | ||
for i in $(seq 1 20); do | ||
if docker inspect -f '{{ index .Config.Labels "build_version" }}' mariadb >/dev/null 2>&1 ; then | ||
break | ||
else | ||
sleep 3 | ||
fi | ||
if [ $i -eq 20 ] ; then | ||
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs mariadb\`)" | ||
exit 1 | ||
fi | ||
done | ||
;; | ||
"${commands[1]}") | ||
[[ "${container}" ]] && docker container rm -f "$container" >/dev/null | ||
[[ "${image}" ]] && docker image rm "$image" >/dev/null | ||
;; | ||
"${commands[2]}") | ||
[[ -n "${MARIADB_BASE}" && "${MARIADB_BASE}" != "/" ]] && rm -rf "${MARIADB_BASE}" | ||
;; | ||
"${commands[3]}") | ||
if [[ "${container}" && "${image}" ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
;; | ||
"${commands[4]}") | ||
echo -e "\nUsage: ${module_options["module_mariadb,feature"]} <command>" | ||
echo -e "Commands: ${module_options["module_mariadb,example"]}" | ||
echo "Available commands:" | ||
echo -e "\tinstall\t- Install $title." | ||
echo -e "\tremove\t- Remove $title." | ||
echo -e "\tpurge\t- Purge $title data folder." | ||
echo -e "\tstatus\t- Installation status $title." | ||
|
||
echo | ||
;; | ||
*) | ||
${module_options["module_mariadb,feature"]} ${commands[4]} | ||
;; | ||
esac | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
module_options+=( | ||
["module_phpmyadmin,author"]="" | ||
["module_phpmyadmin,maintainer"]="@igorpecovnik" | ||
["module_phpmyadmin,testers"]="@igorpecovnik" | ||
["module_phpmyadmin,feature"]="module_phpmyadmin" | ||
["module_phpmyadmin,desc"]="Install phpmyadmin container" | ||
["module_phpmyadmin,example"]="install remove purge status help" | ||
["module_phpmyadmin,port"]="8071" | ||
["module_phpmyadmin,status"]="Active" | ||
["module_phpmyadmin,arch"]="" | ||
) | ||
# | ||
# Module phpmyadmin-PDF | ||
# | ||
function module_phpmyadmin () { | ||
local title="phpmyadmin" | ||
local condition=$(which "$title" 2>/dev/null) | ||
|
||
if check_if_installed docker-ce; then | ||
local container=$(docker container ls -a | mawk '/phpmyadmin?( |$)/{print $1}') | ||
local image=$(docker image ls -a | mawk '/phpmyadmin?( |$)/{print $3}') | ||
fi | ||
|
||
local commands | ||
IFS=' ' read -r -a commands <<< "${module_options["module_phpmyadmin,example"]}" | ||
|
||
PHPMYADMIN_BASE="${SOFTWARE_FOLDER}/phpmyadmin" | ||
|
||
case "$1" in | ||
"${commands[0]}") | ||
check_if_installed docker-ce || install_docker | ||
[[ -d "$PHPMYADMIN_BASE" ]] || mkdir -p "$PHPMYADMIN_BASE" || { echo "Couldn't create storage directory: $PHPMYADMIN_BASE"; exit 1; } | ||
docker run -d \ | ||
--name=phpmyadmin \ | ||
-e PUID=1000 \ | ||
-e PGID=1000 \ | ||
-e TZ="$(cat /etc/timezone)" \ | ||
-e PMA_ARBITRARY=1 \ | ||
-p 8071:80 \ | ||
-v "${PHPMYADMIN_BASE}/config:/config" \ | ||
--restart unless-stopped \ | ||
lscr.io/linuxserver/phpmyadmin:latest | ||
for i in $(seq 1 20); do | ||
if docker inspect -f '{{ index .Config.Labels "build_version" }}' phpmyadmin >/dev/null 2>&1 ; then | ||
break | ||
else | ||
sleep 3 | ||
fi | ||
if [ $i -eq 20 ] ; then | ||
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs phpmyadmin\`)" | ||
exit 1 | ||
fi | ||
done | ||
;; | ||
"${commands[1]}") | ||
[[ "${container}" ]] && docker container rm -f "$container" >/dev/null | ||
[[ "${image}" ]] && docker image rm "$image" >/dev/null | ||
;; | ||
"${commands[2]}") | ||
[[ -n "${PHPMYADMIN_BASE}" && "${PHPMYADMIN_BASE}" != "/" ]] && rm -rf "${PHPMYADMIN_BASE}" | ||
;; | ||
"${commands[3]}") | ||
if [[ "${container}" && "${image}" ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
;; | ||
"${commands[4]}") | ||
echo -e "\nUsage: ${module_options["module_phpmyadmin,feature"]} <command>" | ||
echo -e "Commands: ${module_options["module_phpmyadmin,example"]}" | ||
echo "Available commands:" | ||
echo -e "\tinstall\t- Install $title." | ||
echo -e "\tremove\t- Remove $title." | ||
echo -e "\tpurge\t- Purge $title data folder." | ||
echo -e "\tstatus\t- Installation status $title." | ||
|
||
echo | ||
;; | ||
*) | ||
${module_options["module_phpmyadmin,feature"]} ${commands[4]} | ||
;; | ||
esac | ||
} |