Compare commits

...

26 Commits

Author SHA1 Message Date
7d8dbbfd61 cleaned up repo 2023-12-19 13:40:45 -08:00
dfb5fa2cd8 removed env 2023-12-19 13:38:24 -08:00
dc1acafac4 fixed extra h 2023-12-19 13:31:59 -08:00
45d79b8084 Added echos for easier debugging 2023-12-19 13:30:40 -08:00
040e7783a8 Moved to bash script
we don't need this file any more as it's generated by bash script
2023-12-19 13:20:43 -08:00
ce270e5168 cleaned up install process 2023-12-19 13:17:56 -08:00
471395fba7 Fixed new project scripts 2023-12-19 13:05:01 -08:00
ae3688b166 added env generator, removed .env 2023-12-19 12:41:14 -08:00
1463667306 version bump 2023-12-19 12:28:13 -08:00
2c8ed95c2c added gitignore 2023-12-16 22:05:16 -08:00
f8010a6b41 updated the docker compose file 2023-12-16 21:44:00 -08:00
f1e74c60fb moved component maker into it's own repo: 2023-09-01 20:47:44 -07:00
9add26b186 fixed php tmp file dir 2023-07-23 10:33:31 -07:00
c0ef99a5fd added sql folder 2023-07-23 09:00:29 -07:00
9fd870dee8 added password generator 2023-07-23 08:47:26 -07:00
bbb8ab9c13 updated volum and network 2023-07-13 18:02:35 -07:00
90f7e42416 fixed filenames 2023-07-09 23:34:46 -07:00
c45b45b796 did some upgrades while launching a site 2023-07-09 23:33:44 -07:00
74fde32a04 fixed the missing files 2023-06-10 20:40:11 -07:00
222ecd8553 was supposed to be a package not a file 2023-06-09 23:46:28 -07:00
b9190e5131 got extensions working 2023-06-09 23:46:01 -07:00
16d5e357c0 testing packages
I'm just trying to test to see how packages work in gitea.
2023-06-09 23:42:57 -07:00
03b17ef004 second commit, working website 2023-06-09 19:04:05 -07:00
9720f10038 Fixed for Production and Staging 2023-06-08 00:46:50 -07:00
05f289eae0 updated documenation, fixed install script 2023-06-07 14:16:31 -07:00
815a551a07 installs to project directory now 2023-06-06 19:01:24 -07:00
30 changed files with 336 additions and 580 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
data/

View File

@@ -1,78 +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.
## Quick 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).
```bash ## Table of Contents
# STEP 1
# Clone the repo (change projectName to the name of your project)
git clone git@git.nickyeoman.com:nick/joomla.git projectName
# STEP 2 * [Quick Start Guide](https://git.nickyeoman.com/nick/joomla/wiki/Quick-Start)
# Move into the dir * [Gitea Repository](https://git.nickyeoman.com/nick/joomla/)
cd projectName * [Wiki](https://git.nickyeoman.com/nick/joomla/wiki)
* [Issue Tracker](https://git.nickyeoman.com/nick/joomla/issues)
# STEP 3 ## Contributing
# Setup your env file
mv env.sample .env
vi .env
# STEP 4 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.
# Prepare your project for git
bash bin/new_project.sh
# STEP 5
# Run the containers to initialize
sudo bash bin/docker_up.sh
# STEP 6
# Joomla cli installer
sudo bash bin/setup_joomla_installer.sh
# STEP 7
# Manually set Site Meta Description in [Administrator](http://localhost:8000/administrator/index.php?option=com_config)
# Step 8
# Clean up and Config
sudo bash bin/finalize.sh
```
## Development Environment
Let's update our bash_profile with some alias:
```bash
alias joomla='docker-compose exec -u www-data joomla php cli/joomla.php'
```
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
```
## Create A Component
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.
1. build the zip file by running bin/build_component.sh
## 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
* Can't get this one working either: https://www.techfry.com/resources/how-to-create-joomla-component
* https://docs.joomla.org/J4.x:Developing_an_MVC_Component/Introduction
* Can't get this one working [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)

View File

@@ -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" *

View File

@@ -1,14 +0,0 @@
#!/bin/bash
# Check if $name is set
if [[ -z "${name}" ]]; then
echo "Error: Variable \$name is not set. Exiting (displaycontroller.sh)."
exit 1
fi
cat <<EOM > admin/tmpl/${name}/default.php
<?php defined('_JEXEC') or die('Restricted Access'); ?>
<h2>Hello ${name}!</h2>
EOM

View File

@@ -1,29 +0,0 @@
#!/bin/bash
# Check if $name is set
if [[ -z "${name}" ]]; then
echo "Error: Variable \$name is not set. Exiting (displaycontroller.sh)."
exit 1
fi
cat <<EOM > admin/src/Controller/DisplayController.php
<?php
namespace Harvst\\Component\\${name^}\\Administrator\\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController {
protected \$default_view = '${name}';
public function display(\$cachable = false, \$urlparams = array()) {
return parent::display(\$cachable, \$urlparams);
}
}
EOM

View File

@@ -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

View File

@@ -1,50 +0,0 @@
#!/bin/bash
current_date=$(date +'%B %Y')
current_year=$(date +'%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>${name}</name>
<creationDate>${current_date}</creationDate>
<author>${JOOMLA_USER}</author>
<authorEmail>${EMAIL}</authorEmail>
<authorUrl>https://www.example.com/</authorUrl>
<copyright>Copyright (C) ${current_year} ${JOOMLA_USER}, All rights reserved.</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>COM_${name^^}_DESCRIPTION</description>
<namespace path="src/">Harvst\Component\\${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>
<folder>services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages folder="admin">
<!-- TODO: It's there but not working -->
<language tag="en-GB">language/en-GB/en-GB.com_${name}.ini</language>
</languages>
</administration>
</extension>
EOM

View File

@@ -1,35 +0,0 @@
#!/bin/bash
cat <<EOM > admin/services/provider.php
<?php defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
return new class implements ServiceProviderInterface {
public function register(Container \$container): void {
\$container->registerServiceProvider(new MVCFactory('\\\\Harvst\\\\Component\\\\${name^}'));
\$container->registerServiceProvider(new ComponentDispatcherFactory('\\\\Harvst\\\\Component\\\\${name^}'));
\$container->set(
ComponentInterface::class,
function (Container \$container) {
\$component = new MVCComponent(\$container->get(ComponentDispatcherFactoryInterface::class));
\$component->setMVCFactory(\$container->get(MVCFactoryInterface::class));
return \$component;
}
);
}
};
EOM

View File

@@ -1,26 +0,0 @@
#!/bin/bash
# Check if $name is set
if [[ -z "${name}" ]]; then
echo "Error: Variable \$name is not set. Exiting (displaycontroller.sh)."
exit 1
fi
cat <<EOM > admin/src/View/${name^}/HtmlView.php
<?php
namespace Harvst\\Component\\${name^}\\Administrator\\View\\${name^};
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView {
function display(\$tpl = null) {
parent::display(\$tpl);
}
}
EOM

View File

@@ -1,73 +0,0 @@
#!/bin/bash
# create_component.sh componentName
# 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 admin/services
mkdir -p admin/src/Controller admin/src/View/${name^} admin/tmpl/${name}
# 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/provider.sh"
source "$script_dir/component_parts/displaycontroller.sh"
source "$script_dir/component_parts/view.sh"
source "$script_dir/component_parts/defaultview.sh"
echo "Component framework generated successfully!"
echo "You should manually edit the manifest file before checkin"

14
bin/db-dump.bash Normal file
View 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

View File

@@ -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
View 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

View File

@@ -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
View 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
View 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

View File

@@ -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"

View File

@@ -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)")

View File

@@ -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
View 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"

View File

@@ -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

View 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"

View File

@@ -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.2 # 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"

View File

@@ -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)

View File

@@ -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
```

View File

@@ -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

View File

@@ -1 +0,0 @@
<!-- Placeholder -->

View File

@@ -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
View 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.