Compare commits
28 Commits
985514c51b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d8dbbfd61 | |||
| dfb5fa2cd8 | |||
| dc1acafac4 | |||
| 45d79b8084 | |||
| 040e7783a8 | |||
| ce270e5168 | |||
| 471395fba7 | |||
| ae3688b166 | |||
| 1463667306 | |||
| 2c8ed95c2c | |||
| f8010a6b41 | |||
| f1e74c60fb | |||
| 9add26b186 | |||
| c0ef99a5fd | |||
| 9fd870dee8 | |||
| bbb8ab9c13 | |||
| 90f7e42416 | |||
| c45b45b796 | |||
| 74fde32a04 | |||
| 222ecd8553 | |||
| b9190e5131 | |||
| 16d5e357c0 | |||
| 03b17ef004 | |||
| 9720f10038 | |||
| 05f289eae0 | |||
| 815a551a07 | |||
| 8e677c05f3 | |||
| cca1cc8751 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
data/
|
||||||
54
README.md
54
README.md
@@ -1,50 +1,18 @@
|
|||||||
# Joomla
|
# Joomla Setup and Helper Scripts
|
||||||
|
|
||||||
Joomla CMS.
|
This repository contains a comprehensive collection of documentation, scripts, and files to assist in setting up Joomla and managing Joomla projects.
|
||||||
|
|
||||||
Make sure the projectName is set correctly, it's very important, because it's used for git, docker, mysql and joomla.
|
Whether you're new to Joomla or an experienced user, this repository offers a range of resources to streamline your Joomla development workflow.
|
||||||
|
|
||||||
## Installation
|
For detailed instructions on getting started, please refer to the [Quick Start Guide]((https://git.nickyeoman.com/nick/joomla/wiki/Quick-Start)) in the [Wiki](https://git.nickyeoman.com/nick/joomla/wiki).
|
||||||
1. Clone me ```git clone git@git.nickyeoman.com:nick/joomla.git projectName```
|
|
||||||
1. cd projectName
|
|
||||||
1. Setup your .env file ```mv env.sample .env``` then edit with your favorite editor.
|
|
||||||
1. Prepare your project for git ```bash bin/new_project.sh```
|
|
||||||
1. Run the containers to initialize ```sudo bash bin/docker_up.sh```
|
|
||||||
1. cli installer ```bash bin/setup_joomla_installer.sh```
|
|
||||||
1. Manually set Site Meta Description in [Administrator](http://localhost:8000/administrator/index.php?option=com_config)
|
|
||||||
1. Run ```sudo bash bin/finalize.sh```
|
|
||||||
|
|
||||||
## Working Environment
|
## Table of Contents
|
||||||
|
|
||||||
Let's update our bash_profile with some alias:
|
* [Quick Start Guide](https://git.nickyeoman.com/nick/joomla/wiki/Quick-Start)
|
||||||
```bash
|
* [Gitea Repository](https://git.nickyeoman.com/nick/joomla/)
|
||||||
alias joomla='docker-compose exec -u www-data joomla php cli/joomla.php'
|
* [Wiki](https://git.nickyeoman.com/nick/joomla/wiki)
|
||||||
```
|
* [Issue Tracker](https://git.nickyeoman.com/nick/joomla/issues)
|
||||||
Allowing you to just run commands like this:
|
|
||||||
```bash
|
|
||||||
joomla core:check-updates
|
|
||||||
joomla site:down
|
|
||||||
joomla extension:list
|
|
||||||
joomla update:extensions:check
|
|
||||||
joomla cache:clean
|
|
||||||
|
|
||||||
```
|
## Contributing
|
||||||
|
|
||||||
## Create A Component
|
Contributions to this repository are welcome! If you find any issues, have suggestions for improvements, or want to add new features, please send me an email: joomla@nickyeoman.com or open an issue in the Issue Tracker (Which I don't check much). I appreciate your interest in this project.
|
||||||
|
|
||||||
1. Move to the directory where you would like to keep the component. ```cd ~/joomla-components/```
|
|
||||||
1. Run component creator from your Joomla install. ```bash ~/projects/joomla/projectName/bin/create_component.sh```
|
|
||||||
1. Optionally save to git repo.
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
* [Joomla Twig](https://phproberto.github.io/joomla-twig/)
|
|
||||||
|
|
||||||
### Component
|
|
||||||
|
|
||||||
* https://github.com/ceford/j4xdemos-com-mywalks/tree/master
|
|
||||||
* https://www.abdulwaheed.pk/en/blog/41-information-technology/44-joomla/302-how-to-create-joomla-4-component.html
|
|
||||||
* https://www.techfry.com/resources/how-to-create-joomla-component
|
|
||||||
* https://docs.joomla.org/J4.x:Developing_an_MVC_Component/Introduction
|
|
||||||
* [Develop a component](https://docs.joomla.org/J4.x:Developing_an_MVC_Component/Developing_a_Basic_Component)
|
|
||||||
* [Minimal component](https://joomla.stackexchange.com/questions/22176/minimal-basic-structure-for-a-frontend-joomla-component-without-using-joomla-mvc)
|
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
###################################################################################################
|
|
||||||
#
|
|
||||||
# INSTRUCTIONS
|
|
||||||
# Move to the directory of the component
|
|
||||||
# Run this script with component name (com_name)
|
|
||||||
###################################################################################################
|
|
||||||
|
|
||||||
# Check if the component name is provided as the first parameter
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
componentName="$1"
|
|
||||||
else
|
|
||||||
# Prompt for the name of the component
|
|
||||||
read -p "Enter the name of the component (including com_): " componentName
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the component name starts with 'com_'
|
|
||||||
if [[ $componentName != com_* ]]; then
|
|
||||||
echo "Invalid component name. The name should start with 'com_'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the component folder exists
|
|
||||||
if [ ! -d "$componentName" ]; then
|
|
||||||
echo "Component folder '$componentName' does not exist."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the name by removing the first four characters
|
|
||||||
name="${componentName:4}"
|
|
||||||
|
|
||||||
# Read the contents of $name/$name.xml file
|
|
||||||
xml_file="$componentName/$name.xml"
|
|
||||||
if [ -f "$xml_file" ]; then
|
|
||||||
xml_contents=$(cat "$xml_file")
|
|
||||||
else
|
|
||||||
echo "XML file '$xml_file' not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the version from the XML contents
|
|
||||||
regex="<version>(.*?)<\/version>"
|
|
||||||
if [[ $xml_contents =~ $regex ]]; then
|
|
||||||
version="${BASH_REMATCH[1]}"
|
|
||||||
else
|
|
||||||
echo "Version not found in the XML file."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
zip_filename="$name-$version.zip"
|
|
||||||
cd "$componentName" && 7z a "../$zip_filename" *
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat <<EOM
|
|
||||||
<?php
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\MVC\Controller\AdminController;
|
|
||||||
|
|
||||||
class ${name^}Controller extends AdminController
|
|
||||||
{
|
|
||||||
public function __construct(\$config = array())
|
|
||||||
{
|
|
||||||
parent::__construct(\$config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOM
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat <<EOM > admin_controller_base.php
|
|
||||||
<?php
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\MVC\Controller\Controller;
|
|
||||||
|
|
||||||
class ${name^}Controller extends Controller
|
|
||||||
{
|
|
||||||
public function __construct(\$config = array())
|
|
||||||
{
|
|
||||||
parent::__construct(\$config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOM
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat <<EOM > admin/language/en-GB/en-GB.com_${name}.ini
|
|
||||||
; com_${name}
|
|
||||||
COM_${name^^}_DESCRIPTION="Placeholder description, edit in language file"
|
|
||||||
EOM
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
current_date=$(date +'%B %Y')
|
|
||||||
|
|
||||||
# Check if JOOMLA_USER is set, otherwise prompt for it
|
|
||||||
if [ -z "$JOOMLA_USER" ]; then
|
|
||||||
read -p "Enter the Joomla user: " JOOMLA_USER
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if EMAIL is set, otherwise prompt for it
|
|
||||||
if [ -z "$EMAIL" ]; then
|
|
||||||
read -p "Enter the email address: " EMAIL
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOM > ${name}.xml
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<extension type="component" method="upgrade">
|
|
||||||
<name>com_${name}</name>
|
|
||||||
<creationDate>${current_date}</creationDate>
|
|
||||||
<author>${JOOMLA_USER}</author>
|
|
||||||
<authorEmail>${EMAIL}</authorEmail>
|
|
||||||
<authorUrl>https://www.example.com/</authorUrl>
|
|
||||||
<copyright>Copyright (C) 2023 ${JOOMLA_USER}, All rights reserved.</copyright>
|
|
||||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
|
||||||
|
|
||||||
<!-- The version string is recorded in the components table -->
|
|
||||||
<version>0.0.1</version>
|
|
||||||
|
|
||||||
<!-- The description is optional and defaults to the name -->
|
|
||||||
<description>COM_${name^^}_DESCRIPTION</description>
|
|
||||||
|
|
||||||
<namespace path="src">harvst\Component\com_${name}</namespace>
|
|
||||||
|
|
||||||
<administration>
|
|
||||||
<!-- The link that will appear in the Admin panel's "Components" menu -->
|
|
||||||
<menu link="index.php?option=com_${name}">${name}</menu>
|
|
||||||
<files folder="admin">
|
|
||||||
<folder>language</folder>
|
|
||||||
</files>
|
|
||||||
|
|
||||||
</administration>
|
|
||||||
</extension>
|
|
||||||
EOM
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat <<EOM
|
|
||||||
<?php
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\MVC\Controller\BaseController;
|
|
||||||
|
|
||||||
class ${name^}Controller extends BaseController
|
|
||||||
{
|
|
||||||
public function __construct(\$config = array())
|
|
||||||
{
|
|
||||||
parent::__construct(\$config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOM
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat <<EOM
|
|
||||||
<?php
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\MVC\Controller\Controller;
|
|
||||||
|
|
||||||
class ${name^}Controller extends Controller
|
|
||||||
{
|
|
||||||
public function __construct(\$config = array())
|
|
||||||
{
|
|
||||||
parent::__construct(\$config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOM
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Determine the directory where the script is located
|
|
||||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
||||||
|
|
||||||
#################################################################################
|
|
||||||
# ENV File
|
|
||||||
#################################################################################
|
|
||||||
# Import variables from .env file
|
|
||||||
if [ -f "$script_dir/../.env" ]; then
|
|
||||||
read -p "Found .env file at '$script_dir/.env'. Press Enter to use it, or enter a different file path: " env_file
|
|
||||||
if [ -z "$env_file" ]; then
|
|
||||||
env_file="$script_dir/.env"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
read -p "Enter the path to the .env file: " env_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Validate the .env file path
|
|
||||||
if [ ! -f "$env_file" ]; then
|
|
||||||
echo "Invalid .env file path. Please make sure the file exists."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source the variables from the .env file
|
|
||||||
source "$env_file"
|
|
||||||
|
|
||||||
echo "Variables from .env file imported successfully!"
|
|
||||||
|
|
||||||
#################################################################################
|
|
||||||
# Component Name
|
|
||||||
#################################################################################
|
|
||||||
|
|
||||||
# Check if the component name is provided as the first parameter
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
name="$1"
|
|
||||||
else
|
|
||||||
# Prompt for the name of the component
|
|
||||||
read -p "Enter the name of the component (one word in lowercase): " name
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Validate the component name
|
|
||||||
if [[ ! "$name" =~ ^[a-z0-9_]+$ ]]; then
|
|
||||||
echo "Invalid component name. The name should be one word in lowercase with no spaces or special characters."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################################################################
|
|
||||||
# Do the work
|
|
||||||
#################################################################################
|
|
||||||
|
|
||||||
# Create the component directory
|
|
||||||
component_dir="com_${name}"
|
|
||||||
mkdir -p "$component_dir"
|
|
||||||
|
|
||||||
# Create the main component files
|
|
||||||
cd "$component_dir" || exit
|
|
||||||
mkdir -p site
|
|
||||||
mkdir -p admin/language/en-GB
|
|
||||||
|
|
||||||
# Source the files for generating component files
|
|
||||||
source "$script_dir/component_parts/manifest.sh"
|
|
||||||
source "$script_dir/component_parts/language.sh"
|
|
||||||
# source "$script_dir/component_parts/admin_controller.sh"
|
|
||||||
# source "$script_dir/component_parts/site_controller.sh"
|
|
||||||
# source "$script_dir/component_parts/site_controller_base.sh"
|
|
||||||
# source "$script_dir/component_parts/admin_controller_base.sh"
|
|
||||||
|
|
||||||
|
|
||||||
echo "Component framework generated successfully!"
|
|
||||||
echo "You should manually edit the manifest file before checkin"
|
|
||||||
|
|
||||||
14
bin/db-dump.bash
Normal file
14
bin/db-dump.bash
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#check if root
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Grab dotenv
|
||||||
|
export $(grep -v '^#' .env | xargs)
|
||||||
|
|
||||||
|
tstamp=`date +%Y%m%d`
|
||||||
|
|
||||||
|
docker-compose exec mariadb-joomla /usr/bin/mysqldump -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} ${MYSQL_DATABASE} > sql/${JOOMLA_USER}-${MYSQL_DATABASE}-${tstamp}.sql
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Are you root?
|
|
||||||
if [ "$EUID" -ne 0 ]; then
|
|
||||||
echo -e "\033[0;31mThis script must be run as root.\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load environment variables from .env file
|
|
||||||
set -o allexport
|
|
||||||
source .env
|
|
||||||
set +o allexport
|
|
||||||
|
|
||||||
PROJECTNAME=$(basename "$(pwd)")
|
|
||||||
|
|
||||||
if [ "$DEBUG" = "true" ]; then
|
|
||||||
docker ps
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f html/index.html
|
|
||||||
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
docker-compose ps
|
|
||||||
15
bin/file-sync.sh
Normal file
15
bin/file-sync.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#check if root
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Grab dotenv
|
||||||
|
rsync -azhvc --del /var/lib/docker/volumes/harvst-ca_joomla/_data/ html/
|
||||||
|
|
||||||
|
# You probably should do something more like this:
|
||||||
|
# docker create --name temp-container -v <source_volume>:/source_data busybox
|
||||||
|
# docker cp temp-container:/source_data /path/to/destination_directory
|
||||||
|
# docker rm temp-container
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Are you root?
|
|
||||||
if [ "$EUID" -ne 0 ]; then
|
|
||||||
echo -e "\033[0;31mThis script must be run as root.\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROJECTNAME=$(basename "$(pwd)")
|
|
||||||
|
|
||||||
# Remove crap files
|
|
||||||
rm -f html/web.config.txt
|
|
||||||
rm -f html/htaccess.txt
|
|
||||||
rm -f html/LICENSE.txt
|
|
||||||
rm -f html/README.txt
|
|
||||||
|
|
||||||
# Set configuration.php
|
|
||||||
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting=none
|
|
||||||
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset=America/Vancouver
|
|
||||||
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite=true
|
|
||||||
|
|
||||||
# remove unused files from install
|
|
||||||
rm -rf bin/inc_new_project
|
|
||||||
rm -rf bin/new_project.sh
|
|
||||||
rm -rf bin/setup_joomla_installer.sh
|
|
||||||
|
|
||||||
echo "Now check the results and commit them to Git"
|
|
||||||
50
bin/generate_env.sh
Normal file
50
bin/generate_env.sh
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ENV_FILE=".env"
|
||||||
|
|
||||||
|
# Function to generate a random alphanumeric password of a given length
|
||||||
|
generate_password() {
|
||||||
|
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "${1:-12}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to prompt for a value if not set as a parameter
|
||||||
|
prompt_for_value() {
|
||||||
|
read -p "$1: " value
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set $PROJECTNAME if not provided as a parameter
|
||||||
|
PROJECTNAME=${1:-$(prompt_for_value "Enter PROJECTNAME")}
|
||||||
|
|
||||||
|
cat <<EOF > $ENV_FILE
|
||||||
|
# Docker
|
||||||
|
NETWORKNAME=admin_web
|
||||||
|
|
||||||
|
# MySQL
|
||||||
|
MYSQL_ROOT_PASSWORD=$(generate_password)
|
||||||
|
MYSQL_USER=u_$(echo $PROJECTNAME | tr '[:upper:]' '[:lower:]')
|
||||||
|
MYSQL_PASSWORD=$(generate_password)
|
||||||
|
MYSQL_DATABASE=db_$(echo $PROJECTNAME | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
# GITEA
|
||||||
|
GITEA_API_URL=REPLACEME
|
||||||
|
ACCESS_TOKEN=REPLACEME
|
||||||
|
|
||||||
|
# Joomla
|
||||||
|
EMAIL=noreply@$(echo $PROJECTNAME | tr '[:upper:]' '[:lower:]').com
|
||||||
|
JOOMLA_USER="$PROJECTNAME"
|
||||||
|
JOOMLA_USERNAME=admin
|
||||||
|
# Passwords must be 12 characters long (admin-password)
|
||||||
|
JOOMLA_PASSWORD=$(generate_password)
|
||||||
|
|
||||||
|
# SMTP
|
||||||
|
SMTP_USER=null
|
||||||
|
SMTP_PASS=null
|
||||||
|
SMTP_HOST='mailhog'
|
||||||
|
SMTP_SECURITY='None'
|
||||||
|
SMTP_PORT=1025
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm $0
|
||||||
|
|
||||||
|
echo "Generated $ENV_FILE with randomly generated passwords and customized PROJECTNAME."
|
||||||
38
bin/gitea_secrets.sh
Normal file
38
bin/gitea_secrets.sh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Load environment variables from .env file
|
||||||
|
if [ -f ".env" ]; then
|
||||||
|
set -o allexport
|
||||||
|
source .env
|
||||||
|
set +o allexport
|
||||||
|
else
|
||||||
|
echo "Error: The .env file does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
USERNAME=""
|
||||||
|
PASSWORD=""
|
||||||
|
|
||||||
|
read -p "Enter your Gitea username: " USERNAME
|
||||||
|
read -s -p "Enter your Gitea password: " PASSWORD
|
||||||
|
echo
|
||||||
|
|
||||||
|
secrets_response=$(curl -s -u "$USERNAME:$PASSWORD" "$GITEA_API/repos/$REPO_OWNER/$REPO_NAME/actions/secrets")
|
||||||
|
status_code=$(tail -c 3 <<< "$secrets_response")
|
||||||
|
|
||||||
|
if [[ $status_code -eq 401 ]]; then
|
||||||
|
echo "Authentication failed. Please check your username and password."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the secret keys
|
||||||
|
secret_keys=$(echo "$secrets_response" | jq -r '.[].name')
|
||||||
|
|
||||||
|
# Loop through secret keys
|
||||||
|
for secret_key in $secret_keys; do
|
||||||
|
secret_response=$(curl -s -u "$USERNAME:$PASSWORD" "$GITEA_API/repos/$REPO_OWNER/$REPO_NAME/actions/secrets/$secret_key")
|
||||||
|
secret_value=$(echo "$secret_response" | jq -r '.secret')
|
||||||
|
|
||||||
|
# Update .env file
|
||||||
|
sed -i "s/$secret_key=.*/$secret_key=$secret_value/" .env
|
||||||
|
done
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# This Bash script initializes a new Git repository, removes existing Git info, creates a README.md with the project name, and makes an initial commit.
|
||||||
|
|
||||||
PROJECTNAME=$(basename "$(pwd)")
|
PROJECTNAME=$(basename "$(pwd)")
|
||||||
|
|
||||||
# Remove existing Git repository information
|
rm -rf .git # Remove existing Git repository information
|
||||||
rm -rf .git
|
|
||||||
|
|
||||||
rm README.md
|
# New readme for Project
|
||||||
|
rm README.md
|
||||||
touch README.md
|
touch README.md
|
||||||
echo "# ${PROJECTNAME}" > README.md
|
echo "# ${PROJECTNAME}" > README.md
|
||||||
echo "" > README.md
|
echo "" >> README.md
|
||||||
echo "Created a fresh repo for your ${PROJECTNAME} project." >> README.md
|
echo "Created a fresh repo for your ${PROJECTNAME} project." >> README.md
|
||||||
|
|
||||||
# Initialize a new Git repository
|
# Initialize a new Git repository
|
||||||
echo -e "\n\e[32mSetup Git Locally\e[0m\n";
|
echo -e "\n\e[32mSetup Git Locally\e[0m\n";
|
||||||
git init
|
git init
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Initial commit of new project $PROJECTNAME"
|
git commit -m "Initial commit of new project $PROJECTNAME"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Creates a private Git repository on Gitea using its API, adds a remote origin to the local Git repository, and pushes existing changes to the master branch.
|
||||||
|
|
||||||
PROJECTNAME=$(basename "$(pwd)")
|
PROJECTNAME=$(basename "$(pwd)")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Sitemap
|
# Are you root?
|
||||||
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://deploy.ostraining.com/client/download/free/latest-stable/com_osmap
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo -e "\033[0;31mThis script must be run as root.\033[0m"
|
||||||
# Comments
|
exit 1
|
||||||
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://cdn.akeeba.com/updates/pkgengage.xml
|
fi
|
||||||
|
|
||||||
|
echo "Astroid Framework (Template)"
|
||||||
|
# [GitHub](https://github.com/templaza/astroid-framework)
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://github.com/templaza/astroid-framework/releases/download/v3.0.7/astroid-framework-3.0.7.zip
|
||||||
|
|
||||||
|
echo "OSMap (Sitemap)"
|
||||||
|
# [GitHub](https://github.com/joomlashack/OSMap)
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://github.com/joomlashack/OSMap/releases/download/v5.0.15/com_osmap_free_5.0.15.zip
|
||||||
|
|
||||||
|
echo "Akeeba Engage (Comments)"
|
||||||
|
# [Download page](https://www.akeeba.com/download/engage/3-2-5.html)
|
||||||
|
# [Github](https://github.com/akeeba/engage)
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://www.akeeba.com/download/engage/3-3-3/pkg-engage-3-3-3-zip.zip
|
||||||
|
|
||||||
|
echo "Mavro Contact Form"
|
||||||
|
# [GitHub](https://github.com/mavrosxristoforos/rapid-contact)
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php extension:install --url=https://github.com/mavrosxristoforos/rapid-contact/releases/download/1.4.37/mod_rapid_contact.zip
|
||||||
|
|
||||||
|
echo "END installing extensions"
|
||||||
91
bin/joomla_cleanup.sh
Normal file
91
bin/joomla_cleanup.sh
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Are you root?
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo -e "\033[0;31mThis script must be run as root.\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# ENV file
|
||||||
|
##################################################################
|
||||||
|
# Verify the .env file exists
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
echo "Error: The .env file does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load environment variables from .env file
|
||||||
|
set -o allexport
|
||||||
|
source .env
|
||||||
|
set +o allexport
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Variables
|
||||||
|
##################################################################
|
||||||
|
PROJECTNAME=$(basename "$(pwd)")
|
||||||
|
|
||||||
|
# Joomla Configuration Defaults
|
||||||
|
if [ -z "$JCONFIG_REPORTING" ]; then
|
||||||
|
JCONFIG_REPORTING='none'
|
||||||
|
fi
|
||||||
|
if [ -z "$JCONFIG_TIMEZONE" ]; then
|
||||||
|
JCONFIG_TIMEZONE='America/Vancouver'
|
||||||
|
fi
|
||||||
|
if [ -z "$JCONFIG_SEF" ]; then
|
||||||
|
JCONFIG_SEF=true
|
||||||
|
fi
|
||||||
|
# SMTP ENV CHECK
|
||||||
|
if [ -z "$SMTP_MAILER" ]; then
|
||||||
|
SMTP_MAILER='/usr/sbin/sendmail'
|
||||||
|
fi
|
||||||
|
if [ -z "$SMTP_USER" ]; then
|
||||||
|
SMTP_USER=null
|
||||||
|
fi
|
||||||
|
if [ -z "$SMTP_PASS" ]; then
|
||||||
|
SMTP_PASS=null
|
||||||
|
fi
|
||||||
|
if [ -n "$SMTP_PASS" ]; then
|
||||||
|
SMTP_AUTH=true
|
||||||
|
else
|
||||||
|
SMTP_AUTH=false
|
||||||
|
fi
|
||||||
|
if [ -z "$SMTP_HOST" ]; then
|
||||||
|
SMTP_HOST='mailhog'
|
||||||
|
fi
|
||||||
|
if [ -z "$SMTP_SECURITY" ]; then
|
||||||
|
SMTP_SECURITY='None'
|
||||||
|
fi
|
||||||
|
if [ -z "$SMTP_PORT" ]; then
|
||||||
|
SMTP_PORT=1025
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set configuration.php
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting="${JCONFIG_REPORTING}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset="${JCONFIG_TIMEZONE}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite="${JCONFIG_SEF}"
|
||||||
|
#SMTP
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set mailer=smtp
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set sendmail="${SMTP_MAILER}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpuser="${SMTP_USER}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtppass="${SMTP_PASS}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpauth="${SMTP_AUTH}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtphost="${SMTP_HOST}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpsecure="${SMTP_SECURITY}"
|
||||||
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpport="${SMTP_PORT}"
|
||||||
|
|
||||||
|
# Remove uneeded Joomla files
|
||||||
|
rm -f html/web.config.txt
|
||||||
|
rm -f html/htaccess.txt
|
||||||
|
rm -f html/LICENSE.txt
|
||||||
|
rm -f html/README.txt
|
||||||
|
|
||||||
|
# Remove Install helper scripts
|
||||||
|
rm -rf bin/inc_new_project
|
||||||
|
rm -rf bin/joomla_new_project.sh
|
||||||
|
rm -rf bin/joomla_install.sh
|
||||||
|
rm -rf bin/install_extensions.sh
|
||||||
|
|
||||||
|
rm $0
|
||||||
|
|
||||||
|
echo "Now check the results and commit them to Git"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Runs the joomla cli through docker
|
||||||
|
|
||||||
PROJECTNAME=$(basename "$(pwd)")
|
PROJECTNAME=$(basename "$(pwd)")
|
||||||
|
|
||||||
@@ -33,13 +34,13 @@ DB_PREFIX=$(LC_CTYPE=C tr -dc '[:alpha:]' < /dev/urandom | head -c 3)_
|
|||||||
docker-compose exec -u www-data joomla php installation/joomla.php install \
|
docker-compose exec -u www-data joomla php installation/joomla.php install \
|
||||||
--site-name=$PROJECTNAME \
|
--site-name=$PROJECTNAME \
|
||||||
--admin-email=$EMAIL \
|
--admin-email=$EMAIL \
|
||||||
--admin-user=$JOOMLA_USER \
|
--admin-user="$JOOMLA_USER" \
|
||||||
--admin-username=$JOOMLA_USERNAME \
|
--admin-username=$JOOMLA_USERNAME \
|
||||||
--admin-password=$JOOMLA_PASSWORD \
|
--admin-password=$JOOMLA_PASSWORD \
|
||||||
--db-type=mysqli \
|
--db-type=mysqli \
|
||||||
--db-host=mariadb \
|
--db-host=mariadb-joomla \
|
||||||
--db-user=$MYSQL_USER \
|
--db-user=$MYSQL_USER \
|
||||||
--db-pass=$MYSQL_PASSWORD \
|
--db-pass=$MYSQL_PASSWORD \
|
||||||
--db-name=$MYSQL_DATABASE \
|
--db-name=$MYSQL_DATABASE \
|
||||||
--db-prefix=$DB_PREFIX \
|
--db-prefix=$DB_PREFIX \
|
||||||
--db-encryption=0
|
--db-encryption=0
|
||||||
31
docker-compose.staging.yml
Normal file
31
docker-compose.staging.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
joomla:
|
||||||
|
volumes:
|
||||||
|
- ./data/development:/development
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin/phpmyadmin:latest # https://hub.docker.com/_/phpmyadmin
|
||||||
|
environment:
|
||||||
|
PMA_USER: ${MYSQL_USER}
|
||||||
|
PMA_PASSWORD: ${MYSQL_PASSWORD}
|
||||||
|
PMA_HOST: mariadb-joomla
|
||||||
|
UPLOAD_LIMIT: '200M'
|
||||||
|
ports:
|
||||||
|
- "8001:80"
|
||||||
|
volumes:
|
||||||
|
- "/etc/timezone:/etc/timezone:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
|
||||||
|
mailhog:
|
||||||
|
image: 'mailhog/mailhog:latest' # https://hub.docker.com/r/mailhog/mailhog
|
||||||
|
ports:
|
||||||
|
- "${SMTP_PORT}:1025"
|
||||||
|
- "8002:8025"
|
||||||
|
volumes:
|
||||||
|
- "/etc/timezone:/etc/timezone:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
@@ -1,52 +1,42 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
volumes:
|
# For Staging
|
||||||
joomla-db:
|
# docker-compose -f docker-compose.yml -f docker-compose.staging.yml up -d
|
||||||
joomla:
|
#
|
||||||
|
# For Production
|
||||||
networks:
|
# docker-compose up -d
|
||||||
default:
|
|
||||||
external:
|
networks:
|
||||||
name: ${NETWORKNAME}
|
default:
|
||||||
|
external:
|
||||||
services:
|
name: ${NETWORKNAME}
|
||||||
mariadb:
|
|
||||||
image: mariadb:10.7.1 # https://hub.docker.com/_/mariadb
|
services:
|
||||||
restart: always
|
mariadb-joomla:
|
||||||
environment:
|
image: mariadb:11.2.2 # https://hub.docker.com/_/mariadb
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
restart: always
|
||||||
MYSQL_USER: ${MYSQL_USER}
|
environment:
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
MYSQL_USER: ${MYSQL_USER}
|
||||||
volumes:
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||||
- joomla-db:/var/lib/mysql
|
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||||
|
volumes:
|
||||||
joomla:
|
- ./data/joomla-db:/var/lib/mysql
|
||||||
image: joomla:4.3.1 # https://hub.docker.com/_/joomla
|
- "/etc/timezone:/etc/timezone:ro"
|
||||||
restart: always
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
environment:
|
|
||||||
JOOMLA_DB_HOST: mariadb
|
joomla:
|
||||||
JOOMLA_DB_USER: ${MYSQL_USER}
|
image: joomla:5.0.1 # https://hub.docker.com/_/joomla
|
||||||
JOOMLA_DB_PASSWORD: ${MYSQL_PASSWORD}
|
restart: always
|
||||||
JOOMLA_DB_NAME: ${MYSQL_DATABASE}
|
environment:
|
||||||
volumes:
|
JOOMLA_DB_HOST: mariadb-joomla
|
||||||
- ./html:/var/www/html
|
JOOMLA_DB_USER: ${MYSQL_USER}
|
||||||
- ./php/php.ini:/usr/local/etc/php/php.ini
|
JOOMLA_DB_PASSWORD: ${MYSQL_PASSWORD}
|
||||||
ports:
|
JOOMLA_DB_NAME: ${MYSQL_DATABASE}
|
||||||
- "8000:80"
|
volumes:
|
||||||
|
- ./data/html:/var/www/html
|
||||||
phpmyadmin:
|
- ./php/php.ini:/usr/local/etc/php/php.ini
|
||||||
image: phpmyadmin/phpmyadmin:latest # https://hub.docker.com/_/phpmyadmin
|
- "/etc/timezone:/etc/timezone:ro"
|
||||||
environment:
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
PMA_USER: ${MYSQL_USER}
|
links:
|
||||||
PMA_PASSWORD: ${MYSQL_PASSWORD}
|
- mariadb-joomla
|
||||||
PMA_HOST: mariadb
|
|
||||||
UPLOAD_LIMIT: '200M'
|
|
||||||
ports:
|
|
||||||
- "8001:80"
|
|
||||||
|
|
||||||
mailhog:
|
|
||||||
image: 'mailhog/mailhog:latest' # https://hub.docker.com/r/mailhog/mailhog
|
|
||||||
ports:
|
|
||||||
- "1025:1025"
|
|
||||||
- "8002:8025"
|
|
||||||
|
|||||||
75
docs/CLI.md
75
docs/CLI.md
@@ -1,75 +0,0 @@
|
|||||||
# CLI Cheatsheet
|
|
||||||
|
|
||||||
## Cache
|
|
||||||
```
|
|
||||||
cache:clean Clean expired cache entries
|
|
||||||
```
|
|
||||||
|
|
||||||
## Config
|
|
||||||
```
|
|
||||||
config:get Display the current value of a configuration option
|
|
||||||
config:set Set a value for a configuration option
|
|
||||||
```
|
|
||||||
|
|
||||||
## Core
|
|
||||||
```
|
|
||||||
core:check-updates Check for Joomla updates
|
|
||||||
core:update Update Joomla
|
|
||||||
```
|
|
||||||
|
|
||||||
## Database
|
|
||||||
```
|
|
||||||
database:export database:export
|
|
||||||
database:import Import the database
|
|
||||||
```
|
|
||||||
|
|
||||||
## Extension
|
|
||||||
```
|
|
||||||
extension:discover Discover extensions
|
|
||||||
extension:discover:install Install discovered extensions
|
|
||||||
extension:discover:list List discovered extensions
|
|
||||||
extension:install Install an extension from a URL or from a path
|
|
||||||
extension:list List installed extensions
|
|
||||||
extension:remove Remove an extension
|
|
||||||
```
|
|
||||||
|
|
||||||
## Finder
|
|
||||||
```
|
|
||||||
finder:index Purges and rebuild the index
|
|
||||||
Scheduler
|
|
||||||
scheduler:list List all scheduled tasks
|
|
||||||
scheduler:run Run one or more scheduled tasks
|
|
||||||
scheduler:state Enable, disable or trash a scheduled task
|
|
||||||
```
|
|
||||||
|
|
||||||
## Session
|
|
||||||
```
|
|
||||||
session:gc Perform session garbage collection
|
|
||||||
session:metadata:gc Perform session metadata garbage collection
|
|
||||||
```
|
|
||||||
|
|
||||||
## Site
|
|
||||||
```
|
|
||||||
site:down Put the site into offline mode
|
|
||||||
site:up Put the site into online mode
|
|
||||||
```
|
|
||||||
|
|
||||||
## Update
|
|
||||||
```
|
|
||||||
update:extensions:check Check for pending extension updates
|
|
||||||
update:joomla:remove-old-files Remove old system files
|
|
||||||
```
|
|
||||||
|
|
||||||
## User
|
|
||||||
```
|
|
||||||
user:add Add a user
|
|
||||||
user:addtogroup Add a user to a group
|
|
||||||
user:delete Delete a user
|
|
||||||
user:list List all users
|
|
||||||
user:removefromgroup Remove a user from a group
|
|
||||||
user:reset-password Change a user's password
|
|
||||||
```
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
* [Joomla Magazine - Powerful cli](https://magazine.joomla.org/all-issues/june-2022/joomla-4-a-powerful-cli-application)
|
|
||||||
10
docs/FAQs.md
10
docs/FAQs.md
@@ -1,10 +0,0 @@
|
|||||||
# Frequently Asked Questions
|
|
||||||
|
|
||||||
## How do I add user to Docker
|
|
||||||
|
|
||||||
Read more on [Docker's Official Post Instalation Docs](https://docs.docker.com/engine/install/linux-postinstall/)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo usermod -aG docker $USER
|
|
||||||
newgrp docker
|
|
||||||
```
|
|
||||||
19
env.sample
19
env.sample
@@ -1,19 +0,0 @@
|
|||||||
# Docker
|
|
||||||
NETWORKNAME=admin_web
|
|
||||||
|
|
||||||
# MySQL
|
|
||||||
MYSQL_ROOT_PASSWORD=REPLACEME
|
|
||||||
MYSQL_USER=REPLACEME
|
|
||||||
MYSQL_PASSWORD=REPLACEME
|
|
||||||
MYSQL_DATABASE=REPLACEME
|
|
||||||
|
|
||||||
# GITEA
|
|
||||||
GITEA_API_URL=REPLACEME
|
|
||||||
ACCESS_TOKEN=REPLACEME
|
|
||||||
|
|
||||||
# Joomla
|
|
||||||
EMAIL=noreply@example.com
|
|
||||||
JOOMLA_USER="John Doe"
|
|
||||||
JOOMLA_USERNAME=admin
|
|
||||||
# Passwords must be 12 characters long
|
|
||||||
JOOMLA_PASSWORD=REPLACEME123
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<!-- Placeholder -->
|
|
||||||
@@ -42,6 +42,7 @@ max_file_uploads = 20
|
|||||||
allow_url_fopen = On
|
allow_url_fopen = On
|
||||||
allow_url_include = Off
|
allow_url_include = Off
|
||||||
default_socket_timeout = 60
|
default_socket_timeout = 60
|
||||||
|
upload_tmp_dir = /tmp
|
||||||
|
|
||||||
[CLI Server]
|
[CLI Server]
|
||||||
cli_server.color = On
|
cli_server.color = On
|
||||||
|
|||||||
5
sql/README.md
Normal file
5
sql/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Place MySQL Dumps Here
|
||||||
|
|
||||||
|
This directory is for your mysql dumps.
|
||||||
|
Run ```sudo bash bin/db-dump.bash``` to populate from docker.
|
||||||
|
|
||||||
Reference in New Issue
Block a user