Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F1669765
Rosario Docker PHP GIMP Italia provision
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
valerio.bozzolan
Dec 1 2022, 02:25
2022-12-01 02:25:24 (UTC+1)
Size
2 KB
Referenced Files
None
Subscribers
None
Rosario Docker PHP GIMP Italia provision
View Options
#!/bin/sh
# die in case of any error
set -e
# CONFIG: original zip file
ZIPFILE_BEFORE="DUMP GIMPITALIA 2.zip"
# CONFIG: what we find after extraction
CONTENT_ARCHIVE_DIR="DUMP GIMPITALIA"
CONTENT_ARCHIVE="gimpitalia.it.tar.bz2"
CONTENT_DUMPONE="lazzameb_gimpitalia.sql"
MARIADB_USER='lazzameb_gimpitalia'
MARIADB_DBNM='lazzameb_gimpitalia'
MARIADB_PSWD='<redacted>'
# CONFIG: webserver base document root
WEB_DOCUMENT_ROOT="/var/www/html"
# MUST to run apt install
#apt-get update
# SHOULD: install security patches
export DEBIAN_FRONTEND=noninteractive
apt-get upgrade --yes
# MUST
apt-get install --yes apache2 libapache2-mod-php \
php-mysql \
php-xml \
php-mbstring \
php-curl \
php-gd \
php-zip
# MUST: enable apache2 mod rewrite
a2enmod rewrite
# MUST: enable .htaccess
cat > /etc/apache2/conf-available/my-allow-override.conf <<EOF
<Directory /var/www/html>
AllowOverride All
</Directory>
EOF
# MUST: enable .htaccess really
a2enconf my-allow-override
# MUST: load new modules
systemctl reload apache2
# SHOULD
apt-get install --yes mariadb-server unzip
# MUST extract shit
unzip "$ZIPFILE_BEFORE"
# MUST enter in the unzipped directory
cd "$CONTENT_ARCHIVE_DIR"
# MUST: extract shit in the unzipped directory
tar -xf "$CONTENT_ARCHIVE"
# MUST remove shit
rm --force --recursive /var/www/html
# MUST: move shit to the web document root
mv gimpitalia.it /var/www/html
# MUST: hardening (and fix unexisting Unix users)
chown --recursive root: /var/www/html
# MUST: change downloaded zip (750) to 755 (as standard FHS)
chmod 755 /var/www/html
# MUST allow write on some directories
chown --recursive www-data: /var/www/html/cache/
chown --recursive www-data: /var/www/html/backup/
chown --recursive www-data: /var/www/html/logs/
chown --recursive www-data: /var/www/html/images/
chown --recursive www-data: /var/www/html/assets/
chown --recursive www-data: /var/www/html/user/data/
chown --recursive www-data: /var/www/html/tmp/
chown --recursive www-data: /var/www/html/forum/cache/
# MUST create database and a dedicated user
mysql --execute="CREATE USER \`$MARIADB_USER\`@localhost IDENTIFIED BY '$MARIADB_PSWD'"
mysql --execute="CREATE DATABASE \`$MARIADB_DBNM\`"
mysql --execute="GRANT ALL PRIVILEGES ON \`$MARIADB_DBNM\`.* TO \`$MARIADB_USER\`@localhost"
# MUST import database
mysql "$MARIADB_DBNM" < "$CONTENT_DUMPONE"
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
176462
Default Alt Text
Rosario Docker PHP GIMP Italia provision (2 KB)
Attached To
Mode
P21 Rosario Docker PHP GIMP Italia provision
Attached
Detach File
Event Timeline
Log In to Comment