diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..429600c3c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,6 @@ +{ + "name": "Openclassify", + // Script to run to bootstrap the app when the space is created + "postCreateCommand": "bash install.sh", + "outputCapture": "std" +} diff --git a/.env-sail b/.env-sail index 8762d0ffa..6556227c9 100644 --- a/.env-sail +++ b/.env-sail @@ -1,16 +1,18 @@ -APP_ENV=local +APP_NAME=oc +APP_ENV=production INSTALLED="false" +APP_URL_TYPE="HTTP_X_FORWARDED_HOST" APP_KEY=DYKEBxfEHK1PP4mUbP3gWPtsPZgXh0qX APP_DEBUG=true -DEBUG_BAR=false +DEBUG_BAR=true DB_CONNECTION=mysql -DB_HOST=mysql -DB_DATABASE=oopenclassify -DB_USERNAME=root -DB_PASSWORD= +#DB_HOST=mysql +DB_HOST=host.docker.internal +DB_DATABASE=oc +DB_USERNAME=oc +DB_PASSWORD=oc APPLICATION_NAME=Default -APPLICATION_REFERENCE=default -APPLICATION_DOMAIN=http://localhost +APPLICATION_REFERENCE=default ADMIN_USERNAME=admin ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=admin diff --git a/.gitignore b/.gitignore index 723ef36f4..2ce671bee 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,12 @@ -.idea \ No newline at end of file +.idea +.env +.coverage +/bin +/core +/build +/vendor +/coverage +/node_modules +/bower_components +composer.lock +package-lock.json \ No newline at end of file diff --git a/Envoy.blade.php b/Envoy.blade.php deleted file mode 100644 index be765124e..000000000 --- a/Envoy.blade.php +++ /dev/null @@ -1,62 +0,0 @@ -@servers(['web' => 'yoursite@50.59.80.150 -p 22400']) - -@task('update', ['on' => 'web']) -cd /home/yoursite -php /usr/bin/composer update -o --no-dev -php artisan migrate --all-addons --force -php artisan migrate --force -@endtask - -@task('pull', ['on' => 'web']) -cd /home/yoursite -git pull -@endtask - -@task('migrate', ['on' => 'web']) -cd /home/yoursite -php artisan migrate --all-addons --force -php artisan migrate --force -@endtask - -@task('compile', ['on' => 'web']) -cd /home/yoursite -php artisan streams:compile -@endtask - -@task('clear', ['on' => 'web']) -cd /home/yoursite -php artisan httpcache:clear -php artisan assets:clear -php artisan cache:clear -php artisan route:clear -php artisan view:clear -php artisan twig:clear -@endtask - -@task('install', ['on' => 'web']) -cd /home/yoursite -php artisan addon:install {{$addon}} -@endtask - -@task('uninstall', ['on' => 'web']) -cd /home/yoursite -php artisan addon:uninstall {{$addon}} -@endtask - -@task('reinstall', ['on' => 'web']) -cd /home/yoursite -php artisan addon:reinstall {{$addon}} -@endtask - -@macro('push') -pull -clear -migrate -@endmacro - -@macro('deploy') -push -update -compile -clear -@endmacro diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 5b7819683..000000000 --- a/INSTALL.md +++ /dev/null @@ -1,69 +0,0 @@ -# Installation - -## Server Requirements - -- PHP >= 7.2 -- XML PHP Extension -- PDO PHP Extension -- cURL PHP Extension -- JSON PHP Extension -- Ctype PHP Extension -- BCMath PHP Extension -- SQLite PHP Extension -- OpenSSL PHP Extension -- Mbstring PHP Extension -- Fileinfo PHP Extension -- Tokenizer PHP Extension -- GD Library (>=2.0) **OR** Imagick PHP extension (>=6.5.7) - - -### Via Composer - -> Do not create an `.env` file just yet - Installer will generate one for you.{.important} - -```bash -composer create-project openclassify/openclassify -``` - -### Host Configuration - -When you setup your web host be sure to point the web root to `public` directory. Just as you would a normal Laravel installation. - -#### Alternate Directories for cPanel or Virtualmin - -In some environments like cPanel or Virtualmin it may be difficult to use the `public` directory as the web root. In these cases we suggest symlinking the `public` directory to `public_html`: - -```bash -ln -s public public_html -``` - -You may also simply rename the `public` directory to `public_html`. Path hints will automatically use the correct path. - -### Directory Permissions - -After installing, you may need to configure some permissions in order to proceed. Directories within the `storage`, `public/app`, and the `bootstrap/cache` directories should be writable by your web server. If you are using the [Homestead](http://laravel.com/docs/homestead) virtual machine, these permissions should already be set. - - -## Installing - -### Running the Installation Wizard - -After downloading and it's dependencies with: - -```bash -composer install -``` -you will need to install the software in order to get started. -By this time you should be able to visit your site's URL which will - redirect you to the installer: `http://yoursite.com/installer` - -### Using the CLI Installer - - -```bash -php artisan install - -``` - -You will be prompted for details in order to proceed with the installation process. - diff --git a/Procfile b/Procfile deleted file mode 100644 index 7892955c3..000000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: INSTALLED=false php artisan streams:compile && INSTALLED=true bin/heroku-php-apache2 public/ diff --git a/README.md b/README.md index e1a8a1692..5fe759912 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@


- + + + Scrutinizer Code Quality @@ -14,18 +16,52 @@ -## About OpenClassify +### About OpenClassify -OpenClassify is modular and most advanced open source classified platform build with Laravel 8 & PHP 8.1 Supported. Included Pyrocms 3.9 +OpenClassify is modular and most advanced open source classified platform build with Laravel included Pyrocms. + +### Install with Docker + +We suggest to use Docker. Nginx, Mysql and PHP 8.2 pre-installed. MacOS, Windows and Ubuntu is supported. +Install Docker and run it. Install by watching 2 min video on [Youtube](https://www.youtube.com/watch?v=vVpVmsxq-Z0&t=27s&pp=ygUTb3BlbmNsYXNzaWZ5IGRvY2tlcg%3D%3D) -## Translation +1- Clone project +```bash +git clone https://github.com/openclassify/openclassify.git +``` + +2- Run install.sh +```bash +bash install.sh +``` +3- That's it! + +Open project at [localhost](http://localhost) + + +### Documentation + +You can visit this link for detailed documentation. +https://visiosoft.gitbook.io/v2/ + +### CLI Commands + +If you couldn't find a solution for any problem, please review our CLI Command document. +[View CLI Command Document](https://github.com/openclassify/openclassify/blob/master/docs/cli-commands.md) + +### Other Installation Methods + +Check [here](https://github.com/openclassify/openclassify/blob/master/docs/other-install-methods.md) for more. + + +### Translation Openclassify support 22+ languages. If you'd like to contribute translations, please check out our [Crowdin](https://crowdin.com/project/openclassify) project. -## Server Requirements +### Server Requirements -- Supports PHP 7.3 and later (8.1 Supported) +- Only PHP > 8.2 Officially Supported! - XML PHP Extension - PDO PHP Extension - cURL PHP Extension @@ -38,116 +74,14 @@ Openclassify support 22+ languages. If you'd like to contribute translations, pl - Fileinfo PHP Extension - Tokenizer PHP Extension - GD Library (>=2.0) **OR** Imagick PHP extension (>=6.5.7) - - -## Via Composer - -> Do not create an `.env` file just yet - Installer will generate one for you.{.important} - -```bash -composer create-project openclassify/openclassify -``` - -### Via Docker - -We suggest to use Docker. - -https://github.com/openclassify/openclassify/wiki/Installing-Openclassify-on-windows-docker-desktop - -### Host Configuration - -When you setup your web host be sure to point the web root to `public` directory. Just as you would a normal Laravel installation. - -#### Alternate Directories for cPanel or Virtualmin - -In some environments like cPanel or Virtualmin it may be difficult to use the `public` directory as the web root. In these cases we suggest symlinking the `public` directory to `public_html`: - -```bash -ln -s public public_html -``` - -You may also simply rename the `public` directory to `public_html`. Path hints will automatically use the correct path. - -### Directory Permissions - -After installing, you may need to configure some permissions in order to proceed. Directories within the `storage`, `public/app`, and the `bootstrap/cache` directories should be writable by your web server. If you are using the [Homestead](http://laravel.com/docs/homestead) virtual machine, these permissions should already be set. -## Installation - -### Running the Installation Wizard - -After downloading and it's dependencies with: - -```bash -composer install -``` -you will need to install the software in order to get started. -By this time you should be able to visit your site's URL which will - redirect you to the installer: `http://yoursite.com/installer` - -### Using the CLI Installer - - -```bash -php artisan install - -``` - -You will be prompted for details in order to proceed with the installation process. - -> You may need to run `ulimit -n 1024` before installing via CLI to temporarily increase your max open files limit. - -#### Automating the CLI Installer - -You can automate the installer by creating your own .env file with something like this: - -```bash -APP_ENV=local -APP_DEBUG=true -APP_KEY=zfesbnTkXvooWVcsKMw2r4SmPVNGbFoS -DB_CONNECTION=mysql -DB_HOST=localhost -DB_DATABASE=workbench -DB_USERNAME=root -DB_PASSWORD=root -APPLICATION_NAME=Default -APPLICATION_REFERENCE=default -APPLICATION_DOMAIN=localhost -ADMIN_EMAIL=info@openclassify.com -ADMIN_USERNAME=admin -ADMIN_PASSWORD=password -LOCALE=en -TIMEZONE=Turkey/Istanbul -``` -> The APP_KEY must be exactly 32 characters in length. - -Then run the installer and indicate that the system is ready to install: - -```bash -php artisan install --ready -``` - -## CLI Commands - -If you couldn't find a solution for any problem, please review our CLI Command document. -[View CLI Command Document](https://github.com/openclassify/openclassify/blob/master/docs/cli-commands.md) - -## Documentation - -You can visit this link for detailed documentation. -https://visiosoft.gitbook.io/v2/ - -## Code Contributors +### Code Contributors This project exists thanks to all the people who [contribute](https://github.com/openclassify/openclassify/graphs/contributors) and more.

- - -

- -Thanks to Ryan and his stream platform PyroCMS which makes OpenClassify more powerful. +

\ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index dde06e865..000000000 --- a/SECURITY.md +++ /dev/null @@ -1,15 +0,0 @@ -# Security Policy - -## Supported Versions - - - -| Version | Supported | -| ------- | ------------------ | -| 2.x | :x: | -| 1.x | :white_check_mark: | - -## Reporting a Vulnerability - - -If you discover any security related issues, please email info@openclassify.com instead of using the issue tracker. diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c4192631f..000000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/app.json b/app.json deleted file mode 100644 index 1945d327b..000000000 --- a/app.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "PyroCMS", - "description": "A barebones Pyro install.", - "repository": "https://github.com/pyrocms/pyrocms", - "logo": "https://pyrocms.com/files/vendors/logo-inverted_512@2x.jpg", - "keywords": [ - "pyrocms", - "laravel", - "cms", - "php" - ], - "addons": [ - { - "plan": "heroku-postgresql", - } - ], - "scripts": { - "postdeploy": "composer install" - } -} diff --git a/build.xml b/build.xml deleted file mode 100644 index 21584f383..000000000 --- a/build.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json index 0238b80bc..887600ed9 100644 --- a/composer.json +++ b/composer.json @@ -57,9 +57,7 @@ "anomaly/navigation-module": "~2.4.0", "anomaly/dashboard-module": "~2.2.0", "anomaly/redirects-module": "~2.3.0", - "anomaly/variables-module": "~2.4.0", "anomaly/settings-module": "~2.4.0", - "anomaly/blocks-module": "~1.3.0", "anomaly/search-module": "~3.0.0", "anomaly/users-module": "~2.5.0", "anomaly/pages-module": "~2.6.0", @@ -74,13 +72,10 @@ "visiosoft/integer-field_type": "~2.1.0", "visiosoft/list-field_type": "*", "visiosoft/addblock-extension": "^1.1", - "maatwebsite/excel": "*", "google/recaptcha": "1.2.*", "sentry/sentry-laravel": "2.3.1", "composer/composer": "2.*", "visiosoft/composer-merge-plugin": "2.*", - "pusher/pusher-php-server": "^5.0", - "simplepie/simplepie": "^1.5.0", "guzzlehttp/guzzle": "^7.3", "visiosoft/connect-module": "^1.0", "visiosoft/singlefile-field_type": "^1.0", @@ -95,7 +90,6 @@ "visiosoft/advs-module": "^1.0", "visiosoft/json-field_type": "^1.0", "visiosoft/language_switcher-plugin": "^1.0", - "fruitcake/laravel-cors": "^2.0", "visiosoft/global_helper-extension": "*" }, "replace": { @@ -105,9 +99,7 @@ "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", "symfony/css-selector": "3.1.*", - "symfony/dom-crawler": "3.1.*", - "anomaly/installer-module": "~2.4.0", - "laravel/sail": "^1.14" + "symfony/dom-crawler": "3.1.*" }, "repositories": [ { diff --git a/config/app.php b/config/app.php index 92ea8017d..28067a4d8 100644 --- a/config/app.php +++ b/config/app.php @@ -78,7 +78,7 @@ return [ | */ - 'url' => env('APP_URL', 'http://localhost'), + 'url' => env('APP_URL', '/'), /* |-------------------------------------------------------------------------- diff --git a/config/broadcasting.php b/config/broadcasting.php index 5d8b7df8b..2c599d6b8 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -15,7 +15,7 @@ return [ | */ - 'default' => env('BROADCAST_DRIVER', 'pusher'), + 'default' => env('BROADCAST_DRIVER', 'null'), /* |-------------------------------------------------------------------------- diff --git a/docker-compose.yml b/docker-compose.yml index b94e54e5a..84116cd93 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,82 +1,87 @@ -# For more information: https://laravel.com/docs/sail -version: '3' -services: - laravel.test: - build: - context: ./docker/7.4 - dockerfile: Dockerfile - args: - WWWGROUP: '${WWWGROUP}' - image: sail-7.4/openclassify - extra_hosts: - - 'host.docker.internal:host-gateway' - ports: - - '${APP_PORT:-80}:80' - - '${HMR_PORT:-8080}:8080' - environment: - WWWUSER: '${WWWUSER}' - LARAVEL_SAIL: 1 - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - volumes: - - '.:/var/www/html' - networks: - - sail - phpmyadmin: - image: 'phpmyadmin:latest' - ports: - - 8888:80 - environment: - MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' - links: - - "mysql:db" - depends_on: - - mysql - networks: - - sail - mysql: - image: 'mysql/mysql-server:8.0' - ports: - - '${FORWARD_DB_PORT:-3306}:3306' - environment: - MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' - MYSQL_ROOT_HOST: "%" - MYSQL_DATABASE: '${DB_DATABASE}' - MYSQL_USER: '${DB_USERNAME}' - MYSQL_PASSWORD: '${DB_PASSWORD}' - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - volumes: - - 'sail-mysql:/var/lib/mysql' - - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' - networks: - - sail - healthcheck: - test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] - retries: 3 - timeout: 5s - redis: - image: 'redis:alpine' - ports: - - '${FORWARD_REDIS_PORT:-6379}:6379' - volumes: - - 'sail-redis:/data' - networks: - - sail - healthcheck: - test: ["CMD", "redis-cli", "ping"] - retries: 3 - timeout: 5s - memcached: - image: 'memcached:alpine' - ports: - - '11211:11211' - networks: - - sail -networks: - sail: - driver: bridge volumes: - sail-mysql: - driver: local - sail-redis: - driver: local + db-store: + psysh-store: + +configs: + db-config: + file: ./docker/mysql/my.cnf + +services: + php: + build: + context: . + dockerfile: ./docker/php/Dockerfile + target: ${APP_BUILD_TARGET:-development} + container_name: oc_php + volumes: + - type: bind + source: ./ + target: /workspace + - type: volume + source: psysh-store + target: /root/.config/psysh + volume: + nocopy: true + depends_on: + database: + condition: service_healthy + extra_hosts: + - "host.docker.internal:host-gateway" + + nginx: + build: + context: . + dockerfile: ./docker/nginx/Dockerfile + container_name: ${APP_NAME}_nginx + ports: + - target: 80 + published: ${WEB_PUBLISHED_PORT:-80} + protocol: tcp + mode: host + volumes: + - type: bind + source: ./ + target: /workspace + depends_on: + - php + - database + + database: + build: + context: . + dockerfile: ./docker/mysql/Dockerfile + command: --max_allowed_packet=32505856 # Set max_allowed_packet to 256M (or any other value) + ports: + - target: 3306 + published: ${DB_PUBLISHED_PORT:-3306} + protocol: tcp + mode: host + configs: + - source: db-config + target: /etc/my.cnf + volumes: + - type: volume + source: db-store + target: /var/lib/mysql + volume: + nocopy: true + environment: + - MYSQL_DATABASE=${DB_DATABASE:-laravel} + - MYSQL_USER=${DB_USERNAME:-phper} + - MYSQL_PASSWORD=${DB_PASSWORD:-secret} + - MYSQL_ROOT_PASSWORD=${DB_PASSWORD:-secret} + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + timeout: 5s + retries: 10 + + phpmyadmin: + image: phpmyadmin/phpmyadmin:latest + ports: + - "8081:80" + depends_on: + - database + environment: + PMA_USER: oc + PMA_PASSWORD: oc + PMA_HOSTS: database,localhost \ No newline at end of file diff --git a/docker/7.4/.env b/docker/7.4/.env deleted file mode 100644 index e3a6e1fed..000000000 --- a/docker/7.4/.env +++ /dev/null @@ -1,2 +0,0 @@ -WWWGROUP=1000 -WWWUSER=1000 diff --git a/docker/7.4/Dockerfile b/docker/7.4/Dockerfile deleted file mode 100644 index 5f675fb00..000000000 --- a/docker/7.4/Dockerfile +++ /dev/null @@ -1,68 +0,0 @@ -FROM ubuntu:20.04 - -LABEL maintainer="Taylor Otwell" - -ARG WWWGROUP -ARG NODE_VERSION=16 -ARG POSTGRES_VERSION=14 - -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 gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \ - && mkdir -p ~/.gnupg \ - && chmod 600 ~/.gnupg \ - && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf \ - && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c \ - && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg \ - && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ - && apt-get update \ - && apt-get install -y php7.4-cli php7.4-dev \ - php7.4-pgsql php7.4-sqlite3 php7.4-gd \ - php7.4-curl php7.4-memcached \ - php7.4-imap php7.4-mysql php7.4-mbstring \ - php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \ - php7.4-intl php7.4-readline php7.4-pcov \ - php7.4-msgpack php7.4-igbinary php7.4-ldap \ - php7.4-redis php7.4-xdebug \ - && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ - && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ - && apt-get install -y nodejs \ - && npm install -g npm \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \ - && echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \ - && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && apt-get update \ - && apt-get install -y yarn \ - && apt-get install -y mysql-client \ - && apt-get install -y postgresql-client-$POSTGRES_VERSION \ - && apt-get update \ - && apt-get install -y cron \ - && 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/php7.4 - -RUN groupadd --force -g $WWWGROUP sail -RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail - -COPY start-container /usr/local/bin/start-container -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY php.ini /etc/php/7.4/cli/conf.d/99-sail.ini -RUN chmod +x /usr/local/bin/start-container - -COPY scheduler /etc/cron.d/scheduler -RUN chmod 0644 /etc/cron.d/scheduler -RUN crontab /etc/cron.d/scheduler - -EXPOSE 8000 - -ENTRYPOINT ["start-container"] diff --git a/docker/7.4/php.ini b/docker/7.4/php.ini deleted file mode 100644 index 66d04d5be..000000000 --- a/docker/7.4/php.ini +++ /dev/null @@ -1,4 +0,0 @@ -[PHP] -post_max_size = 100M -upload_max_filesize = 100M -variables_order = EGPCS diff --git a/docker/7.4/scheduler b/docker/7.4/scheduler deleted file mode 100644 index 69e95f100..000000000 --- a/docker/7.4/scheduler +++ /dev/null @@ -1 +0,0 @@ -* * * * * root cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1 diff --git a/docker/7.4/start-container b/docker/7.4/start-container deleted file mode 100644 index b86439907..000000000 --- a/docker/7.4/start-container +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 diff --git a/docker/7.4/supervisord.conf b/docker/7.4/supervisord.conf deleted file mode 100644 index a3b42f623..000000000 --- a/docker/7.4/supervisord.conf +++ /dev/null @@ -1,17 +0,0 @@ -[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 - -[include] -files=/var/www/html/supervisord/*.conf \ No newline at end of file diff --git a/docker/mysql/Dockerfile b/docker/mysql/Dockerfile new file mode 100644 index 000000000..0125006d5 --- /dev/null +++ b/docker/mysql/Dockerfile @@ -0,0 +1,7 @@ +FROM mysql/mysql-server:8.0 + +ENV TZ=UTC + +RUN mkdir /var/log/mysql \ + && chown mysql:mysql $_ \ + && chmod 777 $_ \ No newline at end of file diff --git a/docker/mysql/my.cnf b/docker/mysql/my.cnf new file mode 100644 index 000000000..ec28d94e7 --- /dev/null +++ b/docker/mysql/my.cnf @@ -0,0 +1,37 @@ +[mysqld] +# default +skip-host-cache +skip-name-resolve +datadir = /var/lib/mysql +socket = /var/lib/mysql/mysql.sock +secure-file-priv = /var/lib/mysql-files +user = mysql + +pid-file = /var/run/mysqld/mysqld.pid + +# character set / collation +character_set_server = utf8mb4 +collation_server = utf8mb4_0900_ai_ci + +# timezone +default-time-zone = SYSTEM +log_timestamps = SYSTEM + +# Error Log +log-error = /var/log/mysql/mysql-error.log + +# Slow Query Log +slow_query_log = 1 +slow_query_log_file = /var/log/mysql/mysql-slow.log +long_query_time = 1.0 +log_queries_not_using_indexes = 0 + +# General Log +general_log = 1 +general_log_file = /var/log/mysql/mysql-general.log + +[mysql] +default-character-set = utf8mb4 + +[client] +default-character-set = utf8mb4 \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 000000000..eb8f6bb79 --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,9 @@ +FROM nginx:1.25 + +WORKDIR /workspace + +ENV TZ=UTC + +COPY ./docker/nginx/*.conf /etc/nginx/conf.d/ + + diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf new file mode 100644 index 000000000..0160616a8 --- /dev/null +++ b/docker/nginx/default.conf @@ -0,0 +1,35 @@ +access_log /dev/stdout main; +error_log /dev/stderr warn; + +server { + listen 80; + listen [::]:80; + root /workspace/public; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + + index index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_pass php:9000; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } +} \ No newline at end of file diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 000000000..9b19c7c94 --- /dev/null +++ b/docker/php/Dockerfile @@ -0,0 +1,69 @@ +FROM php:8.2-fpm-bullseye AS base + +WORKDIR /workspace + +# timezone environment +ENV TZ=UTC \ + # locale + LANG=en_US.UTF-8 \ + LANGUAGE=en_US:en \ + LC_ALL=en_US.UTF-8 \ + # composer environment + COMPOSER_ALLOW_SUPERUSER=1 \ + COMPOSER_HOME=/composer + +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +RUN apt-get update \ + && apt-get -y install --no-install-recommends \ + locales \ + git \ + unzip \ + libzip-dev \ + libicu-dev \ + libonig-dev \ + libpq-dev \ + libcurl4-gnutls-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && locale-gen en_US.UTF-8 \ + && localedef -f UTF-8 -i en_US en_US.UTF-8 \ + && docker-php-ext-install \ + intl \ + pdo_mysql \ + zip \ + bcmath \ + && composer config -g process-timeout 3600 \ + && composer config -g repos.packagist composer https://packagist.org + +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ +RUN docker-php-ext-install gd + +COPY . . + +RUN ["chmod", "+x", "./docker/php/entrypoint.sh"] +#CMD ["docker/php/entrypoint.sh"] + +FROM base AS development + +COPY ./docker/php/php.development.ini /usr/local/etc/php/php.ini + +FROM development AS development-xdebug + +RUN pecl install xdebug && \ + docker-php-ext-enable xdebug + +COPY ./docker/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini + +FROM base AS deploy + +COPY ./docker/php/php.deploy.ini /usr/local/etc/php/php.ini +COPY ./ /workspace + +RUN composer install -q -n --no-ansi --no-dev --no-scripts --no-progress --prefer-dist \ + && chmod -R 777 storage bootstrap/cache \ + && php artisan optimize:clear \ + && php artisan optimize \ No newline at end of file diff --git a/docker/php/entrypoint.sh b/docker/php/entrypoint.sh new file mode 100755 index 000000000..ae8873b7b --- /dev/null +++ b/docker/php/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ ! -f "vendor/autoload.php" ]; then + composer install --no-progress --no-interaction +else + echo "composer. nothing to do." +fi + +if [ ! -f ".env" ]; then + echo "Creating env file for env from env-sail" + cp .env-sail .env +else + echo "env file exists. nothing to do." +fi + +while IFS= read -r line || [[ -n "$line" ]]; do + if [[ "$line" == "INSTALLED="* ]]; then + installed="${line#*=}" + installed=$(echo "$installed" | tr -d '[:space:]' | tr -d '[:punct:]') # Boşlukları ve özel karakterleri sil + break + fi +done < .env + +if [ "$installed" = "false" ]; then + echo ".env installed is false starting installing" + php artisan install --ready +fi + +php-fpm -R \ No newline at end of file diff --git a/docker/php/opcache.ini b/docker/php/opcache.ini new file mode 100644 index 000000000..fc9ed4d15 --- /dev/null +++ b/docker/php/opcache.ini @@ -0,0 +1,11 @@ +[opcache] +opcache.enable=1 +; 0 means it will check on every request +; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production +opcache.revalidate_freq=0 +opcache.validate_timestamps=1 +opcache.max_accelerated_files=10000 +opcache.memory_consumption=192 +opcache.max_wasted_percentage=10 +opcache.interned_strings_buffer=16 +opcache.fast_shutdown=1 \ No newline at end of file diff --git a/docker/php/php.deploy.ini b/docker/php/php.deploy.ini new file mode 100644 index 000000000..c1e65559f --- /dev/null +++ b/docker/php/php.deploy.ini @@ -0,0 +1,25 @@ +zend.exception_ignore_args = off +expose_php = off +max_execution_time = 30 +max_input_vars = 1000 +upload_max_filesize = 64M +post_max_size = 128M +memory_limit = 256M +error_reporting = E_ALL +display_errors = off +display_startup_errors = off +log_errors = on +error_log = /dev/stderr +default_charset = UTF-8 + +[Date] +date.timezone = ${TZ} + +[mysqlnd] +mysqlnd.collect_memory_statistics = off + +[Assertion] +zend.assertions = -1 + +[mbstring] +mbstring.language = Neutral \ No newline at end of file diff --git a/docker/php/php.development.ini b/docker/php/php.development.ini new file mode 100644 index 000000000..026f1fcd9 --- /dev/null +++ b/docker/php/php.development.ini @@ -0,0 +1,25 @@ +zend.exception_ignore_args = off +expose_php = on +max_execution_time = 30 +max_input_vars = 1000 +upload_max_filesize = 64M +post_max_size = 128M +memory_limit = 256M +error_reporting = E_ALL +display_errors = on +display_startup_errors = on +log_errors = on +error_log = /dev/stderr +default_charset = UTF-8 + +[Date] +date.timezone = ${TZ} + +[mysqlnd] +mysqlnd.collect_memory_statistics = on + +[Assertion] +zend.assertions = 1 + +[mbstring] +mbstring.language = Neutral \ No newline at end of file diff --git a/docker/php/xdebug.ini b/docker/php/xdebug.ini new file mode 100644 index 000000000..549ccaa28 --- /dev/null +++ b/docker/php/xdebug.ini @@ -0,0 +1,7 @@ +[xdebug] +xdebug.mode = debug +xdebug.start_with_request = yes +xdebug.client_host = host.docker.internal +xdebug.client_port = 9003 +xdebug.log = /tmp/xdebug.log +xdebug.idekey = "PHPSTORM" \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to docs/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/docs/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to docs/CONTRIBUTING.md diff --git a/LICENSE.md b/docs/LICENSE.md similarity index 100% rename from LICENSE.md rename to docs/LICENSE.md diff --git a/docs/cli-commands.md b/docs/cli-commands.md index fe36b7e6a..810a87429 100644 --- a/docs/cli-commands.md +++ b/docs/cli-commands.md @@ -231,3 +231,28 @@ Use the `--force` flag to overwrite the files should they already exist. ```bash php artisan addon:publish anomaly.module.store --force ``` + + +### Migrate All Addons + +```bash +php artisan migrate --all-addons --force +``` + +### Run Command Inside Docker + +```bash +docker exec -it oc_php php artisan install --ready +``` + +### Composer set private repo + +```bash +composer config repositories.repo-name composer https://abc.aaa.com +``` + + +### Composer set username and password for repo +```bash +composer config http-basic.abc.aaa.com openclassify pass +``` \ No newline at end of file diff --git a/docs/other-install-methods.md b/docs/other-install-methods.md new file mode 100644 index 000000000..37e8886f3 --- /dev/null +++ b/docs/other-install-methods.md @@ -0,0 +1,84 @@ + +## Via Composer + +> Do not create an `.env` file just yet - Installer will generate one for you.{.important} + +```bash +composer create-project openclassify/openclassify +``` + +### Host Configuration + +When you setup your web host be sure to point the web root to `public` directory. Just as you would a normal Laravel installation. + +#### Alternate Directories for cPanel or Virtualmin + +In some environments like cPanel or Virtualmin it may be difficult to use the `public` directory as the web root. In these cases we suggest symlinking the `public` directory to `public_html`: + +```bash +ln -s public public_html +``` + +You may also simply rename the `public` directory to `public_html`. Path hints will automatically use the correct path. + +### Directory Permissions + +After installing, you may need to configure some permissions in order to proceed. +Directories within the `storage`, `public/app`, and the `bootstrap/cache` directories should be writable by your web server. +If you are using the [Homestead](http://laravel.com/docs/homestead) virtual machine, these permissions should already be set. + + +## Installation + +### Running the Installation Wizard + +After downloading and it's dependencies with: + +```bash +composer install +``` +you will need to install the software in order to get started. +By this time you should be able to visit your site's URL which will +redirect you to the installer: `http://yoursite.com/installer` + +### Using the CLI Installer + + +```bash +php artisan install + +``` + +You will be prompted for details in order to proceed with the installation process. + +> You may need to run `ulimit -n 1024` before installing via CLI to temporarily increase your max open files limit. + +#### Automating the CLI Installer + +You can automate the installer by creating your own .env file with something like this: + +```bash +APP_ENV=local +APP_DEBUG=true +APP_KEY=zfesbnTkXvooWVcsKMw2r4SmPVNGbFoS +DB_CONNECTION=mysql +DB_HOST=localhost +DB_DATABASE=workbench +DB_USERNAME=root +DB_PASSWORD=root +APPLICATION_NAME=Default +APPLICATION_REFERENCE=default +APPLICATION_DOMAIN=localhost +ADMIN_EMAIL=info@openclassify.com +ADMIN_USERNAME=admin +ADMIN_PASSWORD=password +LOCALE=en +TIMEZONE=Turkey/Istanbul +``` +> The APP_KEY must be exactly 32 characters in length. + +Then run the installer and indicate that the system is ready to install: + +```bash +php artisan install --ready +``` diff --git a/install.sh b/install.sh new file mode 100644 index 000000000..1204cd7a3 --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "================================================" +echo "----------------- Openclassify -----------------" +echo "----- Automated install script with Docker -----" +echo "================================================" + +if [[ $(which docker) && $(docker --version) ]]; then + docker --version + + #if ubuntu install docker + if [ -n "$(uname -a | grep Ubuntu)" ]; then + if ! docker info > /dev/null 2>&1; then + systemctl --user start docker-desktop + echo "Docker is not running. I've started for you. Run it again" + exit + fi + fi + else + #if ubuntu install docker + if [ -n "$(uname -a | grep Ubuntu)" ]; then + sudo apt-get update + sudo apt-get install ca-certificates curl gnupg + sudo install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + sudo chmod a+r /etc/apt/keyrings/docker.gpg + echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + + + else + echo "Install docker and come back later" + exit + fi +fi + +cp .env-sail .env +docker compose up \ No newline at end of file diff --git a/nginx_app.conf b/nginx_app.conf deleted file mode 100644 index 4ab4e70c9..000000000 --- a/nginx_app.conf +++ /dev/null @@ -1,7 +0,0 @@ -location / { - try_files $uri @rewriteapp; -} - -location @rewriteapp { - rewrite ^(.*)$ /index.php$1 last; -} diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 000000000..4191aff1f --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo "|| ## Openclassify ## || " +echo "|| Removing Bye bye || " + +docker compose down -v +# TODO @fatihalp + +# reinstall +docker compose build --no-cache + +docker compose up --force-recreate +