Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
removed all shared volumes from docker environment - only use for dev, drop httpd container
Ronald A. Richardson6d4d037d2f05
diff --git a/api/composer.json b/api/composer.jsonindex 9cfdf8a3..6aaec2dd 100644--- a/api/composer.json+++ b/api/composer.json@@ -6,7 +6,7 @@"license": "MIT","require": {"php": "^7.3|^8.0",- "fleetbase/core-api": "^1.0.7-alpha",+ "fleetbase/core-api": "^1.0.8-alpha","fleetbase/fleetops-api": "^1.0.2-alpha","fleetbase/storefront-api": "^1.0.2-alpha","fruitcake/laravel-cors": "^2.0",diff --git a/api/composer.lock b/api/composer.lockindex 217db63c..22fa86c8 100644--- a/api/composer.lock+++ b/api/composer.lock@@ -4,7 +4,7 @@"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],- "content-hash": "11e7059f6f618ea6033dd2ab553e0d4c",+ "content-hash": "826dc512e204fa573464c081ccc63408","packages": [{"name": "aloha/twilio",@@ -192,16 +192,16 @@},{"name": "aws/aws-sdk-php",- "version": "3.272.0",+ "version": "3.272.1","source": {"type": "git","url": "https://github.com/aws/aws-sdk-php.git",- "reference": "2448f5c4ffd0125fa86df6aa12d0a41aa2de68da"+ "reference": "a0accaf4a16565c0b4438109c978602f27dff3a0"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2448f5c4ffd0125fa86df6aa12d0a41aa2de68da",- "reference": "2448f5c4ffd0125fa86df6aa12d0a41aa2de68da",+ "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a0accaf4a16565c0b4438109c978602f27dff3a0",+ "reference": "a0accaf4a16565c0b4438109c978602f27dff3a0","shasum": ""},"require": {@@ -281,9 +281,9 @@"support": {"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80","issues": "https://github.com/aws/aws-sdk-php/issues",- "source": "https://github.com/aws/aws-sdk-php/tree/3.272.0"+ "source": "https://github.com/aws/aws-sdk-php/tree/3.272.1"},- "time": "2023-06-08T18:21:03+00:00"+ "time": "2023-06-09T18:21:02+00:00"},{"name": "aws/aws-sdk-php-laravel",@@ -2002,16 +2002,16 @@},{"name": "fleetbase/core-api",- "version": "1.0.7-alpha",+ "version": "1.0.8-alpha","source": {"type": "git","url": "https://github.com/fleetbase/core-api.git",- "reference": "f3e10518eaa1f3f2f43778ed441497c6289e8bf0"+ "reference": "04c9e13efb21fa352fa5d821ae316e1f2bfb9e45"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/fleetbase/core-api/zipball/f3e10518eaa1f3f2f43778ed441497c6289e8bf0",- "reference": "f3e10518eaa1f3f2f43778ed441497c6289e8bf0",+ "url": "https://api.github.com/repos/fleetbase/core-api/zipball/04c9e13efb21fa352fa5d821ae316e1f2bfb9e45",+ "reference": "04c9e13efb21fa352fa5d821ae316e1f2bfb9e45","shasum": ""},"require": {@@ -2085,7 +2085,7 @@],"support": {"issues": "https://github.com/fleetbase/core-api/issues",- "source": "https://github.com/fleetbase/core-api/tree/v1.0.7-alpha"+ "source": "https://github.com/fleetbase/core-api/tree/v1.0.8-alpha"},"funding": [{@@ -2093,7 +2093,7 @@"type": "github"}],- "time": "2023-06-09T07:41:45+00:00"+ "time": "2023-06-11T02:52:00+00:00"},{"name": "fleetbase/fleetops-api",@@ -3897,16 +3897,16 @@},{"name": "kreait/firebase-php",- "version": "6.9.5",+ "version": "6.9.6","source": {"type": "git","url": "https://github.com/kreait/firebase-php.git",- "reference": "e64ce87a2d3be0acef91c33aea6269bbd528b12f"+ "reference": "d6592be9b27a7c0b13f484f5af494e278901e441"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/kreait/firebase-php/zipball/e64ce87a2d3be0acef91c33aea6269bbd528b12f",- "reference": "e64ce87a2d3be0acef91c33aea6269bbd528b12f",+ "url": "https://api.github.com/repos/kreait/firebase-php/zipball/d6592be9b27a7c0b13f484f5af494e278901e441",+ "reference": "d6592be9b27a7c0b13f484f5af494e278901e441","shasum": ""},"require": {@@ -3926,7 +3926,6 @@"mtdowling/jmespath.php": "^2.6.1","php": "^7.4|^8.0","psr/cache": "^1.0.1|^2.0|^3.0",- "psr/http-message": "^1.0.1","psr/log": "^1.1|^2.0|^3.0","riverline/multipart-parser": "^2.0.8","symfony/polyfill-php80": "^1.23",@@ -3987,7 +3986,7 @@"type": "github"}],- "time": "2023-01-27T09:30:40+00:00"+ "time": "2023-06-10T06:44:56+00:00"},{"name": "kreait/firebase-tokens",diff --git a/docker-compose.yml b/docker-compose.ymlindex ebfd9d73..66073d02 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -19,7 +19,7 @@ services:context: .dockerfile: socket/Dockerfileargs:- ENVIRONMENT: dev+ ENVIRONMENT: productionports:- "38000:8000"environment:@@ -35,17 +35,17 @@ services:context: .dockerfile: console/Dockerfileargs:- ENVIRONMENT: development+ ENVIRONMENT: productionapplication:- volumes:- - .:/var/www/htmlbuild:context: .dockerfile: docker/Dockerfile- target: app-dev+ target: appargs:- ENVIRONMENT: development+ ENVIRONMENT: production+ ports:+ - "8000:80"environment:DATABASE_URL: "mysql://root@database/fleetbase"CACHE_DRIVER: redis@@ -59,17 +59,3 @@ services:depends_on:- database- cache-- httpd:- volumes:- - ./api/storage:/var/www/html/api/storage- build:- context: .- dockerfile: docker/httpd/Dockerfile- ports:- - "8000:80"- depends_on:- - application--volumes:- storage:diff --git a/docker/Dockerfile b/docker/Dockerfileindex 71899ad7..2cb65308 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -8,9 +8,9 @@ RUN mkdir -p /usr/src/php/ext \# Install required packages and PHP extensionsRUN apt-get update \- && apt-get install -y git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \+ && apt-get install -y nano git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \imagemagick libmagickwand-dev --no-install-recommends libmemcached-dev libgeos-dev libgmp-dev \- default-mysql-client libicu-dev tmux \+ default-mysql-client libicu-dev tmux nginx dnsutils \&& pecl install imagick \&& docker-php-ext-enable imagick \&& docker-php-ext-configure gd --with-external-gd \@@ -19,6 +19,9 @@ RUN apt-get update \&& pecl install redis-4.3.0 memcached-3.1.3 \&& docker-php-ext-enable redis memcached opcache bcmath+# Clear cache+RUN apt-get clean && rm -rf /var/lib/apt/lists/*+# Update PHP configurationsRUN sed -e 's/^expose_php.*/expose_php = Off/' "$PHP_INI_DIR/php.ini-production" > "$PHP_INI_DIR/php.ini" \&& sed -i -e 's/^upload_max_filesize.*/upload_max_filesize = 600M/' -e 's/^post_max_size.*/post_max_size = 0/' \@@ -30,21 +33,29 @@ RUN curl -L https://github.com/springload/ssm-parent/releases/download/v1.4.3/ss&& rm /tmp/ssm-parent.tar.gz# Install Composer-WORKDIR /var/www-COPY docker/composer-install.sh ./-RUN chmod +x ./composer-install.sh && ./composer-install.sh+COPY --from=composer:latest /usr/bin/composer /usr/bin/composer# Setup applicationWORKDIR /var/www/html/api-RUN mkdir -p ./storage/logs/ && ln -sf /dev/stdout ./storage/logs/laravel-$(date +'%Y-%m-%d').log-RUN chown -R www-data:www-data /var/www/html/apiCOPY --chown=www-data:nogroup api ./+RUN chown -R www-data:www-data /var/www/html/api+RUN mkdir -p ./storage/logs/ && ln -sf /dev/stdout ./storage/logs/laravel-$(date +'%Y-%m-%d').logUSER www-data-RUN composer install --no-dev --no-scripts --no-autoloader+RUN composer installRUN composer dumpautoload# ContinueUSER root+WORKDIR /++# Copy nginx config+COPY nginx.conf /etc/nginx/sites-enabled/default++# Copy the startup script into the Docker image+COPY startup.sh /startup.sh++# Make sure the script is executable+RUN chmod +x /startup.sh# Set environmentARG ENVIRONMENT=production@@ -70,13 +81,14 @@ CMD ["go-crond", "--verbose", "--no-auto", "root:./crontab"]# Application dev stageFROM base as app-dev-ENTRYPOINT ["docker-php-entrypoint"]-CMD ["php-fpm"]+ENTRYPOINT ["docker-php-entrypoint"]+EXPOSE 80+CMD ["/startup.sh"]# Events stageFROM base as eventsENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]-CMD ["php", "artisan", "queue:work", "events"]+CMD ["php", "artisan", "queue:work", "events"]2# Jobs stageFROM base as jobs@@ -86,4 +98,5 @@ CMD ["php", "artisan", "queue:work", "sqs"]# Application stageFROM base as appENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]-CMD ["php-fpm"]\ No newline at end of file+EXPOSE 80+CMD ["/startup.sh"]\ No newline at end of filediff --git a/nginx.conf b/nginx.confnew file mode 100644index 00000000..2adf349b--- /dev/null+++ b/nginx.conf@@ -0,0 +1,40 @@+server {+ listen 80;+ server_name localhost;+ root /var/www/html/api/public;+ # hide nginx version for security purposes+ server_tokens off;++ index index.php;++ location / {+ try_files $uri $uri/ /index.php?$args;+ }++ location /uploads {+ alias /var/www/html/api/storage/app/uploads;+ autoindex on;+ try_files $uri $uri/ /index.php?$query_string;+ }++ location /storage {+ alias /var/www/html/api/storage/app/public;+ autoindex on;+ try_files $uri $uri/ /index.php?$query_string;+ }++ location ~ [^/]\.php(/|$) {+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;+ if (!-f $document_root$fastcgi_script_name) {+ return 404;+ }++ include fastcgi_params;+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;+ fastcgi_param PATH_INFO $fastcgi_path_info;+ fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;++ fastcgi_pass application:9000;+ fastcgi_index index.php;+ }+}\ No newline at end of filediff --git a/packages/core-api b/packages/core-apiindex f3e10518..04c9e13e 160000--- a/packages/core-api+++ b/packages/core-api@@ -1 +1 @@-Subproject commit f3e10518eaa1f3f2f43778ed441497c6289e8bf0+Subproject commit 04c9e13efb21fa352fa5d821ae316e1f2bfb9e45diff --git a/startup.sh b/startup.shnew file mode 100644index 00000000..70e5313d--- /dev/null+++ b/startup.sh@@ -0,0 +1,35 @@+#!/bin/bash++# Start PHP-FPM in the background+php-fpm -D+status=$?+if [ $status -ne 0 ]; then+ echo "Failed to start php-fpm: $status"+ exit $status+fi++# Start Nginx in the foreground+nginx -g "daemon off;"+status=$?+if [ $status -ne 0 ]; then+ echo "Failed to start nginx: $status"+ exit $status+fi++# Naive check runs checks once a minute to see if either of the processes exited.+while sleep 60; do+ ps aux | grep php-fpm | grep -q -v grep+ PROCESS_1_STATUS=$?+ ps aux |grep nginx |grep -q -v grep+ PROCESS_2_STATUS=$?++ if [ $PROCESS_1_STATUS -ne 0 ]; then+ echo "PHP-FPM process has already exited."+ exit 1+ fi++ if [ $PROCESS_2_STATUS -ne 0 ]; then+ echo "Nginx process has already exited."+ exit 1+ fi+done