second commit, working website

This commit is contained in:
Nick Yeoman 2023-06-09 19:04:05 -07:00
parent 9720f10038
commit 03b17ef004
10 changed files with 55 additions and 149 deletions

26
.env Normal file
View File

@ -0,0 +1,26 @@
# Docker
NETWORKNAME=admin_web
# MySQL
MYSQL_ROOT_PASSWORD=r00tp@ssw0rd
MYSQL_USER=dbuser
MYSQL_PASSWORD=dbp@ssw0rdzztop
MYSQL_DATABASE=nydb
# GITEA
GITEA_API_URL=https://git.nickyeoman.com/api/v1
ACCESS_TOKEN=974f3a5e0bdc1de7bb954cb202eba196e7bb513c
# Joomla
EMAIL=noreply@nickyeoman.com
JOOMLA_USER="Nick Yeoman"
JOOMLA_USERNAME=nick
# Passwords must be 12 characters long (admin-password)
JOOMLA_PASSWORD=RswXWgP74VKrnick
# SMTP
SMTP_USER=null
SMTP_PASS=null
SMTP_HOST='mailhog'
SMTP_SECURITY='None'
SMTP_PORT=1025

26
.env.staging Normal file
View File

@ -0,0 +1,26 @@
# Docker
NETWORKNAME=admin_web
# MySQL
MYSQL_ROOT_PASSWORD=r00tp@ssw0rd
MYSQL_USER=dbuser
MYSQL_PASSWORD=dbp@ssw0rdzztop
MYSQL_DATABASE=nydb
# GITEA
GITEA_API_URL=https://git.nickyeoman.com/api/v1
ACCESS_TOKEN=974f3a5e0bdc1de7bb954cb202eba196e7bb513c
# Joomla
EMAIL=noreply@nickyeoman.com
JOOMLA_USER="Nick Yeoman"
JOOMLA_USERNAME=nick
# Passwords must be 12 characters long (admin-password)
JOOMLA_PASSWORD=RswXWgP74VKrnick
# SMTP
SMTP_USER=null
SMTP_PASS=null
SMTP_HOST='mailhog'
SMTP_SECURITY='None'
SMTP_PORT=1025

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

View File

@ -1,18 +0,0 @@
#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
# Remove existing Git repository information
rm -rf .git
rm README.md
touch README.md
echo "# ${PROJECTNAME}" > README.md
echo "" > README.md
echo "Created a fresh repo for your ${PROJECTNAME} project." >> README.md
# Initialize a new Git repository
echo -e "\n\e[32mSetup Git Locally\e[0m\n";
git init
git add .
git commit -m "Initial commit of new project $PROJECTNAME"

View File

@ -1,32 +0,0 @@
#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
echo -e "\n\e[32mSetup Git Remotely\e[0m\n";
DESC="Repo auto created by Joomla remote git script creator for $PROJECTNAME"
# Create the repository using Gitea API
RESPONSE=$(curl -s -X POST \
-H "Authorization: token $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$PROJECTNAME\",\"private\": true,\"description\": \"$DESC\"}" \
$GITEA_API_URL/user/repos)
if [ -z "$RESPONSE" ] || [ "$(echo "$RESPONSE" | jq -r '.id')" = "null" ]; then
echo "Error: Failed to create $PROJECTNAME repository."
exit 1
fi
SSH_URL=$(echo "$RESPONSE" | jq -r '.ssh_url')
if [ "$SSH_URL" = "null" ]; then
echo "Error: Failed to retrieve SSH URL for $PROJECTNAME repository."
exit 1
fi
# Add new remote repository
git remote add origin "$SSH_URL"
git remote -v
# Commit existing changes
git push -u origin master

View File

@ -1,28 +0,0 @@
#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
SETGITEA=true
# 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
# Run Git setup
bash bin/inc_new_project/git_setup.sh
if [ "$GITEA_API_URL" = "REPLACEME" ]; then
SETGITEA=false
fi
# Run remote Git setup
if [ "$SETGITEA" = "true" ]; then
bash bin/inc_new_project/remote_git_setup.sh
fi
echo -e "\e[32mAll Done\e[0m";

View File

@ -1,45 +0,0 @@
#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
# 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
##################################################################
# non interactive install
#
# https://docs.joomla.org/J4.x:Joomla_CLI_Installation
##################################################################
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 \
--site-name=$PROJECTNAME \
--admin-email=$EMAIL \
--admin-user="$JOOMLA_USER" \
--admin-username=$JOOMLA_USERNAME \
--admin-password=$JOOMLA_PASSWORD \
--db-type=mysqli \
--db-host=mariadb-joomla \
--db-user=$MYSQL_USER \
--db-pass=$MYSQL_PASSWORD \
--db-name=$MYSQL_DATABASE \
--db-prefix=$DB_PREFIX \
--db-encryption=0

View File

@ -2,6 +2,8 @@ version: '3.8'
services:
joomla:
volumes:
- ./development:/development
ports:
- "8000:80"

View File

@ -40,8 +40,7 @@ services:
JOOMLA_DB_PASSWORD: ${MYSQL_PASSWORD}
JOOMLA_DB_NAME: ${MYSQL_DATABASE}
volumes:
- ./html:/var/www/html
- ./development:/development
- joomla:/var/www/html
- ./php/php.ini:/usr/local/etc/php/php.ini
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"