Skip to content

Commit d59e1a4

Browse files
oleksandrkitstomonormanthekevinm
authored
DreamFactory 7 Release (#116)
* DP-513 Add web.config deny setting to nginx server configuration * use ubuntu20 image * update readme * Update dreamfactory.conf Support for PHP 8.3 * Update docker-entrypoint.sh Add support for PHP 8.3 * Testing Laravel 11 * Laravel 11 OSS rebuild * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update docker-entrypoint.sh * Update docker-entrypoint.sh --------- Co-authored-by: Tomo Norman <tomo.l.norman@gmail.com> Co-authored-by: Kevin McGahey <36458555+thekevinm@users.noreply.github.com> Co-authored-by: Kevin McGahey <kevinmcgahey1114@gmail.com>
1 parent 92a129e commit d59e1a4

File tree

5 files changed

+55
-53
lines changed

5 files changed

+55
-53
lines changed

Dockerfile

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,38 @@
1-
ARG BASE=dreamfactorysoftware/df-base-img:v6
2-
FROM $BASE
1+
FROM dreamfactorysoftware/df-base-img:shift
32

43
# Configure Nginx
54
COPY dreamfactory.conf /etc/nginx/sites-available/dreamfactory.conf
65

76
# Get DreamFactory
8-
ARG BRANCH=master
7+
ARG BRANCH=shift-124321
98
RUN git clone --branch $BRANCH https://github.com/dreamfactorysoftware/dreamfactory.git /opt/dreamfactory
109

1110
WORKDIR /opt/dreamfactory
1211

13-
# Uncomment lines 14 & 51 if you would like to upgrade your environment while replacing the License Key value with your issued Key and adding the license files to the df-docker directory.
14-
# COPY composer.* /opt/dreamfactory/
15-
16-
# Set environment variables
17-
ENV REPO_OWNER=dreamfactorysoftware/df-admin-interface
18-
ENV REPO_URL=https://github.com/$REPO_OWNER
19-
ENV DF_FOLDER=/opt/dreamfactory
20-
ENV DESTINATION_FOLDER=$DF_FOLDER/public
21-
ENV TEMP_FOLDER=/tmp/df-ui
22-
ENV RELEASE_FILENAME=release.zip
23-
ENV FOLDERS_TO_REMOVE="dreamfactory filemanager df-api-docs-ui assets"
24-
25-
# Create necessary directories
26-
RUN mkdir -p $TEMP_FOLDER $DESTINATION_FOLDER
27-
28-
# Download and install DreamFactory frontend
29-
RUN cd $TEMP_FOLDER && \
30-
response=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/$REPO_OWNER/releases") && \
31-
latest_release=1.3.5 && \
32-
release_url="$REPO_URL/releases/download/$latest_release/release.zip" && \
33-
curl -LO "$release_url" && \
34-
find "$DESTINATION_FOLDER" -type f \( -name "*.js" -o -name "*.css" \) -exec rm {} \; && \
35-
for folder in $FOLDERS_TO_REMOVE; do \
36-
if [ -d "$DESTINATION_FOLDER/$folder" ]; then rm -rf "$DESTINATION_FOLDER/$folder"; fi; \
37-
done && \
38-
unzip -qo "$RELEASE_FILENAME" -d "$TEMP_FOLDER" && \
39-
mv dist/index.html "$DF_FOLDER/resources/views/index.blade.php" && \
40-
mv dist/* "$DESTINATION_FOLDER" && \
41-
cd .. && rm -rf "$TEMP_FOLDER"
42-
43-
# Install packages
44-
RUN composer install --no-dev --ignore-platform-reqs && \
12+
# Create storage structure and set permissions first
13+
RUN mkdir -p /opt/dreamfactory/storage/app \
14+
&& mkdir -p /opt/dreamfactory/storage/framework/cache \
15+
&& mkdir -p /opt/dreamfactory/storage/framework/sessions \
16+
&& mkdir -p /opt/dreamfactory/storage/framework/views \
17+
&& mkdir -p /opt/dreamfactory/storage/logs \
18+
&& mkdir -p /opt/dreamfactory/bootstrap/cache \
19+
&& chown -R www-data:www-data /opt/dreamfactory/storage \
20+
&& chown -R www-data:www-data /opt/dreamfactory/bootstrap/cache \
21+
&& chmod -R 775 /opt/dreamfactory/storage \
22+
&& chmod -R 775 /opt/dreamfactory/bootstrap/cache
23+
24+
# Clear composer cache and install packages
25+
RUN composer clear-cache && \
26+
COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev --ignore-platform-reqs --no-scripts && \
27+
COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev --ignore-platform-reqs && \
4528
php artisan df:env --db_connection=sqlite --df_install=Docker && \
4629
chown -R www-data:www-data /opt/dreamfactory && \
4730
rm /etc/nginx/sites-enabled/default
4831

4932
COPY docker-entrypoint.sh /docker-entrypoint.sh
5033

51-
# RUN sed -i "s,\#DF_REGISTER_CONTACT=,DF_LICENSE_KEY=YOUR_LICENSE_KEY," /opt/dreamfactory/.env
52-
5334
# Set proper permission to docker-entrypoint.sh script and forward error logs to docker log collector
54-
RUN chmod +x /docker-entrypoint.sh && ln -sf /dev/stderr /var/log/nginx/error.log && rm -rf /var/lib/apt/lists/*
35+
RUN chmod +x /docker-entrypoint.sh && ln -sf /dev/stderr /var/log/nginx/error.log
5536

5637
# Clean up
5738
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* <a href="#feedback">Feedback</a>
3333

3434
<a name="prerequisites"></a>
35+
3536
## Prerequisites
3637

3738
### Install Docker

docker-compose.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ services:
99
image: mysql:5.7
1010
volumes:
1111
- df-mysql:/var/lib/mysql
12-
12+
1313
example_data:
1414
environment:
1515
DATASETS: pagila
1616
POSTGRES_PASSWORD: root_pw
17-
image: aa8y/postgres-dataset
17+
image: aa8y/postgres-dataset
1818

1919
redis:
2020
image: redis
@@ -24,7 +24,7 @@ services:
2424
- mysql
2525
environment:
2626
SERVERNAME: dreamfactory.local
27-
# HTTPS_HEADER: "on"
27+
# HTTPS_HEADER: "on"
2828
# APP_KEY: YOUR_APP_KEY
2929
DB_DRIVER: mysql
3030
DB_HOST: mysql
@@ -36,9 +36,9 @@ services:
3636
CACHE_DATABASE: 0
3737
CACHE_PORT: 6379
3838

39-
# APP_LOG_LEVEL: debug
39+
APP_LOG_LEVEL: debug
4040
# LOG_TO_STDOUT: "true"
41-
# APP_DEBUG: "true"
41+
APP_DEBUG: "true"
4242

4343
# Uncomment and configure to enable emailing
4444
# SENDMAIL_DEFAULT_COMMAND: "/usr/sbin/sendmail -t"
@@ -59,6 +59,7 @@ services:
5959
# LOGSDB_ENABLED: "true"
6060
volumes:
6161
- df-storage:/opt/dreamfactory/storage
62+
# - ../dreamfactory-development-packages:/src/dreamfactory
6263
build: .
6364
ports:
6465
- "80:80"

docker-entrypoint.sh

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@ rm -f $CONF
88
# Check if the directory already exists.
99
if [ ! -d "$CONF" ]; then
1010
### Take action if $DIR exists ###
11-
mkdir /etc/ssmtp
11+
mkdir /etc/ssmtp -p
1212
fi
1313

1414
# Filter the env variables for ssmtp configs and write them to the config file
1515
env | awk -F'\n' '/^SSMTP_/ { print substr($1, 7) }' > "$CONF"
1616

1717
# Configure NGINX and www.conf
1818
ln -s /etc/nginx/sites-available/dreamfactory.conf /etc/nginx/sites-enabled/dreamfactory.conf && \
19-
sed -i "s/pm.max_children = 5/pm.max_children = 5000/" /etc/php/8.1/fpm/pool.d/www.conf && \
20-
sed -i "s/pm.start_servers = 2/pm.start_servers = 150/" /etc/php/8.1/fpm/pool.d/www.conf && \
21-
sed -i "s/pm.min_spare_servers = 1/pm.min_spare_servers = 100/" /etc/php/8.1/fpm/pool.d/www.conf && \
22-
sed -i "s/pm.max_spare_servers = 3/pm.max_spare_servers = 200/" /etc/php/8.1/fpm/pool.d/www.conf && \
23-
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php/8.1/fpm/pool.d/www.conf && \
19+
sed -i "s/pm.max_children = 5/pm.max_children = 5000/" /etc/php/8.3/fpm/pool.d/www.conf && \
20+
sed -i "s/pm.start_servers = 2/pm.start_servers = 150/" /etc/php/8.3/fpm/pool.d/www.conf && \
21+
sed -i "s/pm.min_spare_servers = 1/pm.min_spare_servers = 100/" /etc/php/8.3/fpm/pool.d/www.conf && \
22+
sed -i "s/pm.max_spare_servers = 3/pm.max_spare_servers = 200/" /etc/php/8.3/fpm/pool.d/www.conf && \
23+
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php/8.3/fpm/pool.d/www.conf && \
2424
sed -i "s/worker_connections 768;/worker_connections 2048;/" /etc/nginx/nginx.conf && \
2525
sed -i "s/keepalive_timeout 65;/keepalive_timeout 10;/" /etc/nginx/nginx.conf
26+
sed -i 's/DF_INSTALL=.*/DF_INSTALL=Docker/' .env
2627

2728
# update site configuration
2829
# if no servername is provided use dreamfactory.app as default
@@ -31,6 +32,24 @@ sed -i "s;%SERVERNAME%;${SERVERNAME:=dreamfactory.app};g" /etc/nginx/sites-avail
3132
# Allow Laravel to accept requests from top level reverse proxy if it is using HTTPS. "off" by default.
3233
sed -i "s;%HTTPS_HEADER%;${HTTPS_HEADER:=off};g" /etc/nginx/sites-available/dreamfactory.conf
3334

35+
# Wait for MySQL to be ready if using MySQL
36+
if [ "$DB_CONNECTION" = "mysql" ]; then
37+
echo "Waiting for MySQL to be ready..."
38+
for i in {1..30}; do
39+
if mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "SELECT 1" >/dev/null 2>&1; then
40+
echo "MySQL is ready"
41+
break
42+
fi
43+
echo "MySQL not ready yet... waiting"
44+
sleep 1
45+
done
46+
fi
47+
48+
if [ ! -d "/opt/dreamfactory/public/dreamfactory" ]; then
49+
cd /opt/dreamfactory
50+
composer install --no-dev --ignore-platform-reqs
51+
fi
52+
3453
# do we have configs for a cache ?
3554
if [ -n "$CACHE_DRIVER" ]; then
3655
echo "Setting CACHE_DRIVER, CACHE_HOST, CACHE_DATABASE"
@@ -195,8 +214,8 @@ if [ -n "$SENDMAIL_DEFAULT_COMMAND" ]; then
195214
sed -i "s/#SENDMAIL_DEFAULT_COMMAND=.*/SENDMAIL_DEFAULT_COMMAND=\"$(echo "$SENDMAIL_DEFAULT_COMMAND" | sed 's/\//\\\//g')\"/" .env
196215
fi
197216

198-
# start php8.1-fpm
199-
service php8.1-fpm start
217+
# start php8.3-fpm
218+
service php8.3-fpm start
200219

201220
# start cron service for df-scheduler
202221
service cron start

dreamfactory.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
upstream php_handler {
2-
server unix:/var/run/php/php8.1-fpm.sock;
2+
server unix:/var/run/php/php8.3-fpm.sock;
33
#server 127.0.0.1:9000 backup;
44
}
55

@@ -64,4 +64,4 @@ server {
6464
location ~ /web.config {
6565
deny all;
6666
}
67-
}
67+
}

0 commit comments

Comments
 (0)