mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 15:46:23 -07:00
Remove incomplete SyncForMac Docker stuff, start splitting docker-compose into 4 files (mariadb, mysql, postgresql, sqlite)
This commit is contained in:
parent
e7ddcf1418
commit
02e8be97cc
13 changed files with 229 additions and 257 deletions
1
docker/.gitignore
vendored
1
docker/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
docker-compose.yml
|
||||
volumes/
|
|
@ -2,22 +2,26 @@ FROM golang:1.20-alpine3.18
|
|||
|
||||
COPY docker/build-image.sh .
|
||||
|
||||
RUN ["./build-image.sh"]
|
||||
|
||||
WORKDIR /opt/gochan
|
||||
|
||||
COPY examples/configs/gochan-fastcgi.nginx /etc/nginx/http.d/gochan.conf
|
||||
COPY examples/configs/gochan.example.json /etc/gochan/gochan.json
|
||||
|
||||
# Get all
|
||||
COPY . .
|
||||
|
||||
RUN apk add \
|
||||
mariadb-client \
|
||||
ffmpeg \
|
||||
python3 \
|
||||
git \
|
||||
gcc \
|
||||
musl-dev \
|
||||
openssl \
|
||||
exiftool && \
|
||||
mkdir -p /var/www/ && \
|
||||
ln -sn /opt/gochan/html/* /var/www/
|
||||
|
||||
|
||||
COPY docker/gochan-docker.json /etc/gochan/gochan.json
|
||||
|
||||
RUN ["./build.py"]
|
||||
RUN ["./build.py", "install"]
|
||||
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
|
||||
COPY docker/startup.sh /opt/gochan/startup.sh
|
||||
COPY docker/wait-for.sh /opt/gochan/wait-for.sh
|
||||
CMD ["/opt/gochan/docker/startup.sh"]
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
FROM alpine:3.18
|
||||
RUN apk --no-cache add rsync lsyncd
|
||||
# Declared in docker-compose
|
||||
#CMD lsyncd -delay 1 -nodaemon -rsync /source /cache
|
|
@ -1,11 +0,0 @@
|
|||
FROM alpine:3.18
|
||||
|
||||
WORKDIR /app
|
||||
RUN apk --update add mysql && rm -f /var/cache/apk/*
|
||||
|
||||
COPY startup.sh /startup.sh
|
||||
COPY my.cnf /etc/mysql/my.cnf
|
||||
|
||||
EXPOSE 3306
|
||||
CMD ["/startup.sh"]
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -d /app/mysql ]; then
|
||||
echo "[i] MySQL directory already present, skipping creation"
|
||||
else
|
||||
echo "[i] MySQL data directory not found, creating initial DBs"
|
||||
|
||||
mysql_install_db --user=root > /dev/null
|
||||
|
||||
if [ "$MYSQL_ROOT_PASSWORD" = "" ]; then
|
||||
echo "No password given"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MYSQL_DATABASE=${MYSQL_DATABASE:-""}
|
||||
MYSQL_USER=${MYSQL_USER:-""}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-""}
|
||||
|
||||
if [ ! -d "/run/mysqld" ]; then
|
||||
mkdir -p /run/mysqld
|
||||
fi
|
||||
|
||||
tfile=`mktemp`
|
||||
if [ ! -f "$tfile" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
cat << EOF > $tfile
|
||||
USE mysql;
|
||||
FLUSH PRIVILEGES ;
|
||||
GRANT ALL ON *.* TO 'root'@'localhost' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
|
||||
GRANT ALL ON *.* TO 'root'@'%' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
|
||||
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
|
||||
DROP DATABASE IF EXISTS test ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOF
|
||||
|
||||
# Create new database
|
||||
if [ "$MYSQL_DATABASE" != "" ] && [ "$MYSQL_USER" != "" ] && [ "$MYSQL_PASSWORD" != "" ]; then
|
||||
echo "[i] Creating database: $MYSQL_DATABASE"
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
|
||||
|
||||
# set new User and Password
|
||||
echo "[i] Creating user: $MYSQL_USER"
|
||||
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
|
||||
echo 'FLUSH PRIVILEGES;' >> $tfile
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%';" >> $tfile
|
||||
else
|
||||
echo "User, database, or password is empty."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo 'FLUSH PRIVILEGES;' >> $tfile
|
||||
echo "[i] run tempfile: $tfile"
|
||||
|
||||
/usr/bin/mysqld --user=root --bootstrap < $tfile
|
||||
# rm -f $tfile
|
||||
fi
|
||||
|
||||
|
||||
exec /usr/bin/mysqld --user=root --console --debug=d,general,query --skip-networking=0 --default-authentication-plugin=mysql_native_password
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
version: '3.2'
|
||||
services:
|
||||
gochan:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ../:/opt/gochan # note: this doesn't work too well in MacOS.
|
||||
environment:
|
||||
- DBTYPE=mysql
|
||||
- DATABASE_HOST=mysql
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=gochan
|
||||
- DATABASE_USER=gochan
|
||||
- DATABASE_PASSWORD=gochan
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
mysql:
|
||||
expose:
|
||||
- "3306"
|
||||
build: ./alpineMysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_DATABASE=gochan
|
||||
- MYSQL_USER=gochan
|
||||
- MYSQL_PASSWORD=gochan
|
44
docker/docker-compose-mariadb.yml
Normal file
44
docker/docker-compose-mariadb.yml
Normal file
|
@ -0,0 +1,44 @@
|
|||
services:
|
||||
gochan:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: gochan-server
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ../:/opt/gochan # note: this doesn't work too well in MacOS.
|
||||
- ./volumes/gochan/log:/var/log/gochan
|
||||
- ./volumes/gochan/www:/var/www
|
||||
networks:
|
||||
- gochan-bridge
|
||||
environment:
|
||||
- DBTYPE=mysql
|
||||
- DATABASE_HOST=gochan-mariadb
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=gochan
|
||||
- DATABASE_USER=gochan
|
||||
- DATABASE_PASSWORD=gochan
|
||||
depends_on:
|
||||
- mariadb
|
||||
|
||||
mariadb:
|
||||
image: mariadb:11.5.2-noble
|
||||
container_name: gochan-mariadb
|
||||
tty: true
|
||||
expose:
|
||||
- "3306"
|
||||
networks:
|
||||
- gochan-bridge
|
||||
environment:
|
||||
- MARIADB_ROOT_PASSWORD=root
|
||||
- MARIADB_DATABASE=gochan
|
||||
- MARIADB_USER=gochan
|
||||
- MARIADB_PASSWORD=gochan
|
||||
volumes:
|
||||
- ./volumes/mariadb:/var/lib/mysql
|
||||
|
||||
networks:
|
||||
gochan-bridge:
|
||||
name: gochan-bridge
|
||||
driver: bridge
|
|
@ -1,38 +0,0 @@
|
|||
# Reading host files from a docker container on MacOS is really slow. This is set up as a workaround.
|
||||
version: '3.2'
|
||||
services:
|
||||
gochan:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
environment:
|
||||
- DBTYPE=mysql # change this to 'postgresql' or 'sqlite3' if needed
|
||||
- DATABASE_HOST=host.docker.internal
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=gochan
|
||||
- DATABASE_USER=root
|
||||
- DATABASE_PASSWORD=root
|
||||
volumes:
|
||||
- type: volume
|
||||
source: api_volume
|
||||
target: /opt/gochan
|
||||
consistency: cached
|
||||
sync:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: SyncForMac
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../
|
||||
target: /source
|
||||
consistency: cached
|
||||
- type: volume
|
||||
source: api_volume
|
||||
target: /cache
|
||||
consistency: cached
|
||||
command: "lsyncd -delay 1 -nodaemon -rsync /source /cache"
|
||||
volumes:
|
||||
api_volume:
|
|
@ -1,18 +0,0 @@
|
|||
version: '3.2'
|
||||
services:
|
||||
gochan:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ../:/opt/gochan # note: this doesn't work too well in MacOS.
|
||||
environment:
|
||||
- DBTYPE=mysql # change this to 'postgresql' or 'sqlite3' if needed
|
||||
- DATABASE_HOST=host.docker.internal
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=gochan
|
||||
- DATABASE_USER=root
|
||||
- DATABASE_PASSWORD=root
|
146
docker/gochan-docker.json
Normal file
146
docker/gochan-docker.json
Normal file
|
@ -0,0 +1,146 @@
|
|||
{
|
||||
"ListenIP": "gochan-server",
|
||||
"Port": 80,
|
||||
"UseFastCGI": false,
|
||||
"DocumentRoot": "/var/www",
|
||||
"TemplateDir": "/opt/gochan/templates",
|
||||
"LogDir": "/var/log/gochan",
|
||||
"Plugins": null,
|
||||
"PluginSettings": null,
|
||||
"SiteHeaderURL": "",
|
||||
"WebRoot": "/",
|
||||
"SiteDomain": "127.0.0.1",
|
||||
"DBtype": "mysql",
|
||||
"DBhost": "gochan-mariadb:3306",
|
||||
"DBname": "gochan",
|
||||
"DBusername": "gochan",
|
||||
"DBpassword": "gochan",
|
||||
"DBprefix": "",
|
||||
"DBTimeoutSeconds": 15,
|
||||
"DBMaxOpenConnections": 10,
|
||||
"DBMaxIdleConnections": 10,
|
||||
"DBConnMaxLifetimeMin": 3,
|
||||
"DebugMode": true,
|
||||
"RandomSeed": "c,b25Y]]\"?:Q#^|f",
|
||||
"FirstPage": [
|
||||
"index.html",
|
||||
"firstrun.html",
|
||||
"1.html"
|
||||
],
|
||||
"Username": "",
|
||||
"CookieMaxAge": "1y",
|
||||
"StaffSessionDuration": "3mo",
|
||||
"Lockdown": false,
|
||||
"LockdownMessage": "This imageboard has temporarily disabled posting. We apologize for the inconvenience",
|
||||
"SiteName": "Gochan",
|
||||
"SiteSlogan": "",
|
||||
"Modboard": "",
|
||||
"MaxRecentPosts": 12,
|
||||
"RecentPostsWithNoFile": false,
|
||||
"EnableAppeals": true,
|
||||
"MinifyHTML": true,
|
||||
"MinifyJS": true,
|
||||
"GeoIPType": "",
|
||||
"GeoIPOptions": null,
|
||||
"Captcha": {
|
||||
"Type": "",
|
||||
"OnlyNeededForThreads": false,
|
||||
"SiteKey": "",
|
||||
"AccountSecret": ""
|
||||
},
|
||||
"FingerprintVideoThumbnails": false,
|
||||
"FingerprintHashLength": 0,
|
||||
"InheritGlobalStyles": false,
|
||||
"Styles": [
|
||||
{
|
||||
"Name": "Pipes",
|
||||
"Filename": "pipes.css"
|
||||
},
|
||||
{
|
||||
"Name": "BunkerChan",
|
||||
"Filename": "bunkerchan.css"
|
||||
},
|
||||
{
|
||||
"Name": "Burichan",
|
||||
"Filename": "burichan.css"
|
||||
},
|
||||
{
|
||||
"Name": "Clear",
|
||||
"Filename": "clear.css"
|
||||
},
|
||||
{
|
||||
"Name": "Dark",
|
||||
"Filename": "dark.css"
|
||||
},
|
||||
{
|
||||
"Name": "Photon",
|
||||
"Filename": "photon.css"
|
||||
},
|
||||
{
|
||||
"Name": "Yotsuba",
|
||||
"Filename": "yotsuba.css"
|
||||
},
|
||||
{
|
||||
"Name": "Yotsuba B",
|
||||
"Filename": "yotsubab.css"
|
||||
},
|
||||
{
|
||||
"Name": "Windows 9x",
|
||||
"Filename": "win9x.css"
|
||||
}
|
||||
],
|
||||
"DefaultStyle": "pipes.css",
|
||||
"Banners": [
|
||||
{
|
||||
"Filename": "gochan_go-parody.png",
|
||||
"Width": 300,
|
||||
"Height": 100
|
||||
}
|
||||
],
|
||||
"MaxLineLength": 150,
|
||||
"ReservedTrips": [
|
||||
"thischangesto##this",
|
||||
"andthischangesto##this"
|
||||
],
|
||||
"RepliesOnBoardPage": 3,
|
||||
"StickyRepliesOnBoardPage": 1,
|
||||
"NewThreadsRequireUpload": false,
|
||||
"CyclicalThreadNumPosts": 500,
|
||||
"BanColors": [
|
||||
"admin:#0000A0",
|
||||
"somemod:blue"
|
||||
],
|
||||
"BanMessage": "USER WAS BANNED FOR THIS POST",
|
||||
"EmbedWidth": 200,
|
||||
"EmbedHeight": 164,
|
||||
"EnableEmbeds": true,
|
||||
"ImagesOpenNewTab": true,
|
||||
"NewTabOnOutlinks": true,
|
||||
"DisableBBcode": false,
|
||||
"RejectDuplicateImages": false,
|
||||
"ThumbWidth": 200,
|
||||
"ThumbHeight": 200,
|
||||
"ThumbWidthReply": 125,
|
||||
"ThumbHeightReply": 125,
|
||||
"ThumbWidthCatalog": 50,
|
||||
"ThumbHeightCatalog": 50,
|
||||
"AllowOtherExtensions": null,
|
||||
"StripImageMetadata": "none",
|
||||
"ExiftoolPath": "",
|
||||
"DateTimeFormat": "Mon, January 02, 2006 3:04 PM",
|
||||
"ShowPosterID": false,
|
||||
"EnableSpoileredImages": true,
|
||||
"EnableSpoileredThreads": true,
|
||||
"Worksafe": true,
|
||||
"ThreadPage": 0,
|
||||
"Cooldowns": {
|
||||
"threads": 30,
|
||||
"replies": 7,
|
||||
"images": 7
|
||||
},
|
||||
"RenderURLsAsLinks": true,
|
||||
"ThreadsPerPage": 15,
|
||||
"EnableGeoIP": false,
|
||||
"EnableNoFlag": false,
|
||||
"CustomFlags": null
|
||||
}
|
|
@ -2,31 +2,6 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [ ! -f /etc/gochan/.installed ]; then
|
||||
sed -i "/etc/gochan/gochan.json" \
|
||||
-e "s/\"Port\": 8080/\"Port\": 9000/" \
|
||||
-e "s/\"UseFastCGI\": false/\"UseFastCGI\": true/" \
|
||||
-e "s/\"Username\": \".*\",//" \
|
||||
-e "s#\"DocumentRoot\": \"html\"#\"DocumentRoot\": \"/srv/gochan\"#" \
|
||||
-e "s#\"TemplateDir\": \"templates\"#\"TemplateDir\": \"/usr/share/gochan/templates\"#" \
|
||||
-e "s#\"LogDir\": \"log\"#\"LogDir\": \"/var/log/gochan\"#" \
|
||||
-e "s/\"Verbosity\": 0/\"Verbosity\": 1/" \
|
||||
-e "s/\"DBtype\".*/\"DBtype\": \"${DBTYPE}\",/" \
|
||||
-e "s/\"DBhost\".*/\"DBhost\": \"tcp(${DATABASE_HOST}:${DATABASE_PORT})\",/" \
|
||||
-e "s/\"DBname\".*/\"DBname\": \"${DATABASE_NAME}\",/" \
|
||||
-e "s/\"DBusername\".*/\"DBusername\": \"${DATABASE_USER}\",/" \
|
||||
-e "s/\"DBpassword\".*/\"DBpassword\": \"${DATABASE_PASSWORD}\",/"
|
||||
echo "Finished first-time Gochan configuration"
|
||||
git config --global --add safe.directory /opt/gochan
|
||||
./build.py
|
||||
./build.py install
|
||||
touch /etc/gochan/.installed
|
||||
fi
|
||||
|
||||
|
||||
nginx
|
||||
echo "pinging db, DBTYPE: '$DBTYPE'"
|
||||
|
||||
/opt/gochan/docker/wait-for.sh "$DATABASE_HOST:$DATABASE_PORT" -t 30
|
||||
/opt/gochan/gochan -rebuild all
|
||||
/opt/gochan/gochan
|
Loading…
Add table
Add a link
Reference in a new issue