First Upload

This commit is contained in:
2024-10-19 18:23:55 +00:00
commit 9db52c11c3
11339 changed files with 1479286 additions and 0 deletions

59
docker/8.2/Dockerfile Normal file
View File

@@ -0,0 +1,59 @@
FROM ubuntu:22.04
LABEL maintainer="Stephen Stack"
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y cron
RUN apt-get update \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& apt-get update \
&& apt-get install -y mysql-client \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY scheduler /etc/cron.d/scheduler
RUN chmod 0644 /etc/cron.d/scheduler \
&& crontab /etc/cron.d/scheduler
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
# restart supervisor
RUN service supervisor restart
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.2/php.ini Normal file
View File

@@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

1
docker/8.2/scheduler Normal file
View File

@@ -0,0 +1 @@
* * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@@ -0,0 +1,29 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:horizon]
command=/usr/bin/php /var/www/html/artisan horizon
autostart=true
autorestart=true
user=sail
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/horizon.log
stopwaitsecs=360
[program:cron]
command=/usr/sbin/cron -f -l 8
autostart=true
stdout_logfile=/var/log/cron.out.log
stderr_logfile=/var/log/cron.err.log

23
docker/dockerkillall.sh Executable file
View File

@@ -0,0 +1,23 @@
read -p "Are you sure, this will blow away all docker containers, images and the previously installed mysql database? (y/N) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# docker-compose down
docker rm -f $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
rm -fr mysql/*
rm -fr src/rconfig
docker-compose up -d -build
docker ps -a
docker rmi $(docker images -a -q)
docker rmi $(docker images --filter dangling=true -q)
docker system df
rm -fr /var/www/html/rconfig/storage/app/rconfig/mysql
# docker compose exec php-apache /bin/bash
fi

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL

View File

@@ -0,0 +1,2 @@
SELECT 'CREATE DATABASE testing'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testing')\gexec

70
docker/readme.md Normal file
View File

@@ -0,0 +1,70 @@
To setup docker for rConfig v6 Core, clone the develop branch of https://github.com/rconfig/rconfig
Docker, docker compose and git are required to setup rConfig v6 Core for Docker.
```bash
git clone https://github.com/rconfig/rconfig
cd rconfig
git checkout develop
```
Copy .env.docker.example to .env
```bash
cp .env.docker.example .env
```
Edit following lines in .env file. Those with a \* are required. The rest are optional.
```bash
APP_DEBUG=false #(recommended: false/ true for development)
DB_HOST=rconfig-mariadb-1 #(Do not change unless you know what you are doing)
DB_PORT=3306
DB_DATABASE=DBNAME* #(recommended: rconfig)
DB_USERNAME=DBUSER* #(recommended: anything but root)
DB_PASSWORD=DBPASS* #(recommended: 16+ characters, alphanumeric, special characters)
DB_STORAGE_LOCATION=/storage/app/rconfig/mysql
#DOCKER EXPOSED PORTS - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
APP_PORT=8080
FORWARD_DB_PORT=3307
FORWARD_REDIS_PORT=7000
```
```bash
docker compose up -d
```
After the containers are up and active successfully, deploy the app
```bash
docker exec -it rconfig-rconfig.core-1 /bin/bash
```
```bash
cd /var/www/html && yes | composer install --no-dev
```
```bash
cd /var/www/html && php artisan install
php artisan rconfig:clear-all
```
Exit the container, and set the storage permissions (this is a temporary fix, and will be fixed in the next release)
```bash
sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache
```
Might be best to bring down the containers and bring them back up again.
```bash
docker compose down
docker compose up -d
```
And that should be it. Launch the website/ server on port 8080, and login with admin@domain.com and admin.
If you run into difficulties, please open an issue on github.
Please note, the dockerkillall.sh script is for development purposes only. It will kill all docker containers and remove all docker images. It is not recommended for production use.