initial commit

This commit is contained in:
2024-02-21 18:14:59 -08:00
commit 6c74b43359
5 changed files with 132 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*~

25
Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
FROM php:5-fpm-alpine
ENV DB_HOST "$DB_HOST"
ENV DB_USER "$DB_USER"
ENV DB_PASSWD "$DB_PASSWD"
ENV DB_SCHEMA "$DB_SCHEMA"
COPY brewblogger-2.3.2-docker-config.patch /tmp/
RUN docker-php-ext-install mysql && \
echo "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING" >/usr/local/etc/php/conf.d/no_warnings.ini && \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
cd /tmp && \
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/brewblogger/BrewBlogger2.3.2.tar.gz && \
cd /var/www && \
tar xf /tmp/BrewBlogger2.3.2.tar.gz && \
cd BrewBlogger2.3.2 && \
apk add --no-cache patch && \
patch -p1 </tmp/brewblogger-2.3.2-docker-config.patch && \
apk del patch && \
cd .. && \
cp -r BrewBlogger2.3.2/brewblogger/. html/ && \
cp -r BrewBlogger2.3.2/sql/2.3.2_new_install.sql html/db-schema.sql && \
rm -r BrewBlogger2.3.2 /tmp/* && \
apk add --no-cache joe mariadb-client
USER www-data
VOLUME /var/www/html
EXPOSE 9000/tcp

59
README.md Normal file
View File

@@ -0,0 +1,59 @@
This is [BrewBlogger](https://code.google.com/archive/p/brewblogger/) 2.3.2,
running in a PHP-FPM container. BrewBlogger can be thought of as kind of an
online version of ProMash or BeerSmith. (If you're not a homebrewer, those
names probably mean nothing to you.)
Quick-and-dirty instructions to bring it up:
1. ```docker volume create brewblogger-html```
2. ```docker create --restart=unless-stopped --name brewblogger -p 9000:9000 -e DB_HOST=db_host -e DB_USER=db_user -e DB_PASSWD=db_passwd -e DB_SCHEMA=brewblogger -v brewblogger-html:/var/www/html salfter/brewblogger```
3. ```docker run -it --rm salfter/brewblogger ash```
4. ```mysql -h db_host -u root -p``` (then enter the root password for your database server)
5. ```create database brewblogger;```
6. ```grant all privileges on brewblogger.* to db_user@'%' identified by 'db_passwd';```
7. ```flush privileges```
8. press Ctrl-D
9. ```mysql -h db_host -u db_user --password=db_passwd <db-schema.sql```
10. press Ctrl-D
11. ```docker start brewblogger```
12. configure your webserver to send traffic to port 9000
13. initial login credentials: username is admin, password is user
example Nginx config block, lightly edited from what I'm using (note that I
use two Docker networks: www to carry traffic between Nginx and the various
website containers, and sql to carry traffic between MariaDB and containers
that need database access):
```
server
{
listen 443 ssl;
listen [::]:443 ssl;
server_name example.invalid.tld;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
root /var/www/brewblogger;
index index.php;
location ~ [^/]\.php(/|$)
{
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name)
{
return 404;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass brewblogger.www:9000;
fastcgi_index index.php;
}
}
```
The brewblogger-html volume is intended to be mounted by your webserver
container as well as BrewBlogger.

View File

@@ -0,0 +1,45 @@
--- BrewBlogger2.3.2/brewblogger/Connections/config.php
+++ BrewBlogger2.3.2/brewblogger/Connections/config.php
@@ -2,7 +2,7 @@
/*******Set up MySQL connection variables*******
Generally, this line is left alone.
*/
-$hostname_brewblog = "localhost";
+$hostname_brewblog = getenv("DB_HOST");
/*
Change the word root to the username for your database (generally the same as your login code for your web hosting company).
@@ -10,21 +10,21 @@
For example, if your username is fred then the line should read $username_brewblog = "fred".
*/
-$username_brewblog = "";
+$username_brewblog = getenv("DB_USER");
/*
INSERT YOUR PASSWORD BETWEEN THE DOUBLE-QUOTATION MARKS ("").
For example, if your password is flintstone then the line should read $password_brewblog = "flintsone".
*/
-$password_brewblog = "";
+$password_brewblog = getenv("DB_PASSWD");
/*
The following line is the name of your MySQL database you set up already.
If you haven't set up the database yet, please refer to http://www.brewblogger.net/ for setup instructions.
*/
-$database_brewing = "";
+$database_brewing = getenv("DB_SCHEMA");
/*
This line strings the information together and connects to MySQL.
@@ -57,6 +57,6 @@
******************************************************************************
*/
-$images_dir = "";
+$images_dir = "/var/www/html/label_images";
?>
\ No newline at end of file

2
build.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
docker build --no-cache -t salfter/brewblogger .