From 34d756c2e168d7dca78ca81c237ab21a5b5ae95a Mon Sep 17 00:00:00 2001 From: Gurkengewuerz Date: Thu, 26 Oct 2023 01:14:25 +0200 Subject: [PATCH] feat: add automcms --- .env.cms | 93 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 8 +++- README.md | 42 ++++++++++++++++-- atomcms/Dockerfile | 75 ++++++++++++++++++++++++++++++++ atomcms/logs/.gitkeep | 0 atomcms/storage/.gitkeep | 0 compose.yaml | 14 ++++++ 7 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 .env.cms create mode 100644 atomcms/Dockerfile create mode 100644 atomcms/logs/.gitkeep create mode 100644 atomcms/storage/.gitkeep diff --git a/.env.cms b/.env.cms new file mode 100644 index 0000000..ea6924f --- /dev/null +++ b/.env.cms @@ -0,0 +1,93 @@ +APP_NAME=Laravel +APP_ENV=production +APP_KEY=base64:VcFHbHg+rGs3CWrjPOvTpg+9am00e3GCAx4Iyrg9p+c= +APP_DEBUG=false +APP_URL=http://127.0.0.1:8081 + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +# Change those to match your database settings +DB_CONNECTION=mysql +DB_HOST=db +DB_PORT=3306 +DB_DATABASE=arcturus +DB_USERNAME=arcturus_user +DB_PASSWORD=arcturus_pw + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DISK=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=database +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailhog +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https +PUSHER_APP_CLUSTER=mt1 + +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_HOST="${PUSHER_HOST}" +VITE_PUSHER_PORT="${PUSHER_PORT}" +VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +NITRO_CLIENT_PATH=http://127.0.0.1:3000 + +# If set to true, Atom will rename any colliding table names when migration the first time around +RENAME_COLLIDING_TABLES=false + +# Only enable if you come from a CMS like RevCMS +# This will only work if your password is hashed using md5 +# By default Atom CMS uses bcrypt, this is purely used to ease the process, when switching from a CMS using md5 +CONVERT_PASSWORDS=false + +# Enable this if your site is running through https, but you're experiencing issues with requests being made to "http" +FORCE_HTTPS=false + +# Default language for the site +APP_LOCALE=de + +# General paypal options +PAYPAL_MODE='sandbox' +PAYPAL_PAYMENT_ACTION='Order' +PAYPAL_CURRENCY='USD' +PAYPAL_NOTIFY_URL= +PAYPAL_LOCALE='en_US' +PAYPAL_VALIDATE_SSL=true + +#PayPal Setting & API Credentials - sandbox +PAYPAL_SANDBOX_CLIENT_ID= +PAYPAL_SANDBOX_CLIENT_SECRET= +PAYPAL_SANDBOX_APP_ID= + +#PayPal Setting & API Credentials - live +PAYPAL_LIVE_CLIENT_ID= +PAYPAL_LIVE_CLIENT_SECRET= +PAYPAL_LIVE_APP_ID= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 60a3870..2f77021 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,10 @@ assets/swf assets/usercontent/**/*.png ~$*.xlsx export/ -assets/usercontent/imageproxy/ \ No newline at end of file +assets/usercontent/imageproxy/ +atomcms/cache/* +atomcms/storage/* +atomcms/logs/* +!atomcms/cache/.gitkeep +!atomcms/storage/.gitkeep +!atomcms/logs/.gitkeep diff --git a/README.md b/README.md index 104685e..0350f44 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,8 @@ UPDATE emulator_settings SET `value`='/app/assets/swf/c_images/Badgeparts' WHERE ```bash docker compose up assets -d && \ docker compose up assets-build --build && \ -docker compose up imager --build -d && \ -docker compose up arcturus --build -d && \ -docker compose up backup -d +docker compose up imgproxy --build -d && \ +docker compose up arcturus --build -d ``` 7. Update the: `nitro/renderer-config.json` and `nitro/ui-config.json` values to your setup. If the deployment is buggy or throws any errors check the json files for updates. then Build and Start Nitro @@ -176,6 +175,43 @@ python SQLGenerator.py docker compose restart arcturus ``` +## AtomCMS + +1. change [`.env.cms`](/.env.cms) to your needs + +2. Check your permissions table. Use [**perms_groups.sql**](/arcturus/perms_groups.sql) if unclear. AtomCMS is not using the new permission layout so we are legacy supporting it by "copy" the most important values. + +4. Start the CMS +```bash +docker compose up cms --build -d +``` + +5. Generate a new secret APP_KEY +```bash +docker compose exec cms php artisan key:generate +``` + +6. Open the CMS in the browser by default [`127.0.0.1:8081`](http://127.0.0.1:8081/) and do the basic setup. + +7. Update automcms settings with HeidiSQL + +```sql +UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/api/imager/?figure=' WHERE `key` = 'avatar_imager'; +UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/swf/c_images/album1584' WHERE `key` = 'badges_path'; +UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/usercontent/badgeparts/generated' WHERE `key` = 'group_badge_path'; +UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/swf/dcr/hof_furni' WHERE `key` = 'furniture_icons_path'; + +UPDATE website_settings SET `value` = 'arcturus' WHERE `key` = 'rcon_ip'; +UPDATE website_settings SET `value` = '3001' WHERE `key` = 'rcon_port'; + +-- check values - these values are for the perms_groups.sql +UPDATE website_settings SET `value` = '11' WHERE `key` = 'min_staff_rank'; +UPDATE website_settings SET `value` = '12' WHERE `key` = 'min_maintenance_login_rank'; +UPDATE website_settings SET `value` = '13' WHERE `key` = 'min_housekeeping_rank'; +``` + +**ℹ Notice**: badgeparts generator must be set up in arcturus and all files must be synced with the badge_parts.nitro + ## Create an archive/backup ### Export running containers diff --git a/atomcms/Dockerfile b/atomcms/Dockerfile new file mode 100644 index 0000000..169a6ec --- /dev/null +++ b/atomcms/Dockerfile @@ -0,0 +1,75 @@ +FROM php:8.2-apache as builder + +ARG COMMIT=d0c28fb + +WORKDIR /var/www/html + +RUN apt-get update && apt-get install -y \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libonig-dev \ + libssl-dev \ + libzip-dev \ + git \ + zip \ + unzip \ + && docker-php-ext-install -j$(nproc) curl gd mbstring pdo_mysql sockets fileinfo zip \ + && docker-php-ext-enable curl gd mbstring pdo_mysql sockets fileinfo zip + +COPY --from=composer:lts /usr/bin/composer /usr/local/bin/composer + +RUN git config --global --add safe.directory /var/www/html +RUN git clone --recurse-submodules https://github.com/ObjectRetros/atomcms.git . +RUN git checkout $COMMIT + +RUN composer install + + +# --------------------------------------------- +FROM node:lts-alpine as npm-builder + +WORKDIR /var/www/html + +COPY --from=builder /var/www/html /var/www/html + +RUN yarn install +RUN yarn run build:atom + + +# --------------------------------------------- +FROM php:8.2-apache + +WORKDIR /var/www/html + +RUN apt-get update && apt-get install -y \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libonig-dev \ + libssl-dev \ + libzip-dev \ + && docker-php-ext-install -j$(nproc) curl gd mbstring pdo_mysql sockets fileinfo \ + && docker-php-ext-enable curl gd mbstring pdo_mysql sockets fileinfo +RUN apt remove apt --autoremove -y --allow-remove-essential + +RUN a2enmod rewrite + +COPY --from=npm-builder /var/www/html /var/www/html +RUN rm -rf /var/www/html/node_modules + +RUN chown -R www-data:www-data /var/www/html/storage \ + && chown -R www-data:www-data /var/www/html/bootstrap/cache + +EXPOSE 80 + +ENV APACHE_DOCUMENT_ROOT /var/www/html/public + +RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \ + && sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf + +RUN echo 'max_execution_time = 120' >> /usr/local/etc/php/conf.d/docker-php-maxexectime.ini; + +CMD ["apache2-foreground"] diff --git a/atomcms/logs/.gitkeep b/atomcms/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/atomcms/storage/.gitkeep b/atomcms/storage/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/compose.yaml b/compose.yaml index b99d249..4810e67 100644 --- a/compose.yaml +++ b/compose.yaml @@ -116,5 +116,19 @@ services: restart: unless-stopped networks: [nitro] + cms: + build: + context: atomcms + depends_on: + - imager + - arcturus + ports: + - "8081:80" + volumes: + - ".env.cms:/var/www/html/.env" + - "./atomcms/storage:/var/www/html/storage/app/public" + - "./atomcms/logs:/var/www/html/storage/logs" + networks: [nitro] + networks: nitro: