Skip to content

Commit

Permalink
POS-6 adjustments for new dir structure and pre-init.d scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bricas committed Sep 4, 2024
1 parent fd6be9c commit 2479253
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 35 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ RUN apk --no-cache add bash php81-mysqli php81-session php81-gd \
# patch -p1 < /build/patches/credit-payment-types.patch && \
# patch -p1 < /build/patches/detailed-sales-report-time.patch && \
find /build/app-config -name composer.json|xargs -n 1 dirname|xargs -n 1 composer install --prefer-dist -d && \
mv /build/nginx/app.conf "$NGINX_APP_CONF_FILE" && \
${RSYNC_MOVE} /build/scripts/container/ /scripts/
# && \
# mv /build/www/index.html /app/html/public/index.html
${RSYNC_MOVE} /build/nginx/app.conf "$NGINX_APP_CONF_FILE" && \
${RSYNC_MOVE} /build/scripts/container/ /scripts/ && \
${RSYNC_MOVE} /build/www/index.html /app/html/index.html

# Volumes
VOLUME /app/hil/public/uploads
Expand Down
1 change: 0 additions & 1 deletion build/nginx/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ http {
return 403;
}
}
}
# APP CONFIG
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ if [[ "$DEPLOY_ENV" != "local" ]]; then
echo "Deploying instance for \"${i}\"..."

cp -r /tmp/ospos/* "/app/$i/"
cp /app-config/database.php "/app/$i/application/config/"
cp /build/app-config/database.php "/app/$i/application/config/"
sed -i "s|MYSQL_DATABASE|MYSQL_DATABASE_${i^^}|g" "/app/$i/application/config/database.php"
if [[ -d "/app-config/$i/" ]]
if [[ -d "/build/app-config/$i/" ]]
then
cp -r "/app-config/$i/" "/app/"
cp -r "/build/app-config/$i/" "/app/"
fi
NGINXDOM="$i"
if [[ "$DEPLOY_ENV" = "dev" ]]; then
NGINXDOM="dev-$i"
sed -i "s|https://${i}-pos|https://${NGINXDOM}-pos|g" /app/html/public/index.html
sed -i "s|https://${i}-pos|https://${NGINXDOM}-pos|g" /app/html/index.html
fi
CONFNEW=$(cat <<EOF
Expand Down Expand Up @@ -82,9 +82,9 @@ EOF

else
echo 'Deploying a single local instance...'
rm /app/html/public/index.html
rm /app/html/index.html
cp -r /tmp/ospos/* /app/html/
cp /app-config/database.php /app/html/application/config/
cp /build/app-config/database.php /app/html/application/config/

sed -i "s|MYSQL_HOSTNAME|$MYSQL_HOSTNAME|g" "/app/html/application/config/database.php"
sed -i "s|MYSQL_DATABASE|$MYSQL_DATABASE|g" "/app/html/application/config/database.php"
Expand All @@ -93,4 +93,4 @@ else
fi

echo "$CONF
}" >> /etc/nginx/conf.d/app.conf
}" >> /etc/nginx/http.d/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
if [ ! -f /tmp/OSPOS_DB_LIVE ] && [ "$DEPLOY_ENV" = "local" ];
then
# Create Database.
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h ${MYSQL_HOSTNAME} -P ${MYSQL_PORT} -e "DROP DATABASE IF EXISTS ${MYSQL_DATABASE}; CREATE DATABASE ${MYSQL_DATABASE} CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER '${MYSQL_USERNAME}'@'%' IDENTIFIED BY '$MYSQL_PASSWORD'; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USERNAME}'@'%' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h ${MYSQL_HOSTNAME} -P ${MYSQL_PORT} -e "DROP DATABASE IF EXISTS ${MYSQL_DATABASE}; CREATE DATABASE ${MYSQL_DATABASE} CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE OR REPLACE USER '${MYSQL_USERNAME}'@'%' IDENTIFIED BY '$MYSQL_PASSWORD'; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USERNAME}'@'%' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h ${MYSQL_HOSTNAME} -P ${MYSQL_PORT} ${MYSQL_DATABASE} < /app/html/database/database.sql
fi
5 changes: 0 additions & 5 deletions build/scripts/pre-init.d/18_set_newrelic_env.sh

This file was deleted.

17 changes: 0 additions & 17 deletions build/scripts/pre-init.d/90_enable_rsyslogd.sh

This file was deleted.

0 comments on commit 2479253

Please sign in to comment.