mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 11:46:22 -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
48
build.py
48
build.py
|
@ -200,7 +200,7 @@ def set_vars(goos=""):
|
||||||
migration_exe = "gochan-migration" + exe
|
migration_exe = "gochan-migration" + exe
|
||||||
|
|
||||||
|
|
||||||
def build(debugging=False, plugin_path=""):
|
def build(debugging=False, plugin_path="", static_templates=False):
|
||||||
"""Build the gochan executable for the current GOOS"""
|
"""Build the gochan executable for the current GOOS"""
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
trimpath = f"-trimpath={pwd}"
|
trimpath = f"-trimpath={pwd}"
|
||||||
|
@ -211,6 +211,7 @@ def build(debugging=False, plugin_path=""):
|
||||||
ldflags = f"-ldflags=-X main.versionStr={GOCHAN_VERSION} -X main.dbVersionStr={DATABASE_VERSION} {ldflags_debug}"
|
ldflags = f"-ldflags=-X main.versionStr={GOCHAN_VERSION} -X main.dbVersionStr={DATABASE_VERSION} {ldflags_debug}"
|
||||||
build_cmd_base = ["go", "build", "-v", "-trimpath", gcflags, ldflags]
|
build_cmd_base = ["go", "build", "-v", "-trimpath", gcflags, ldflags]
|
||||||
|
|
||||||
|
if static_templates:
|
||||||
print("Building error pages from templates")
|
print("Building error pages from templates")
|
||||||
with open("templates/404.html", "r") as tmpl404:
|
with open("templates/404.html", "r") as tmpl404:
|
||||||
tmpl404str = tmpl404.read().strip()
|
tmpl404str = tmpl404.read().strip()
|
||||||
|
@ -260,28 +261,6 @@ def clean():
|
||||||
delete(del_file)
|
delete(del_file)
|
||||||
|
|
||||||
|
|
||||||
def dependencies():
|
|
||||||
print("Installing dependencies for gochan")
|
|
||||||
run_cmd(("go", "get"), realtime=True, print_command=True)
|
|
||||||
|
|
||||||
|
|
||||||
def docker(option="guestdb", attached=False):
|
|
||||||
db_option = ""
|
|
||||||
if option == "guestdb":
|
|
||||||
db_option = "docker/docker-compose-mariadb.yaml"
|
|
||||||
elif option == "hostdb":
|
|
||||||
db_option = "docker/docker-compose.yml.default"
|
|
||||||
elif option == "macos":
|
|
||||||
db_option = "docker/docker-compose-syncForMac.yaml"
|
|
||||||
cmd = ["docker-compose", "-f", db_option, "up", "--build"]
|
|
||||||
if attached is False:
|
|
||||||
cmd += ["--detach"]
|
|
||||||
status = run_cmd(cmd, print_output=True, realtime=True, print_command=True)[1]
|
|
||||||
if status != 0:
|
|
||||||
print("Failed starting a docker container, exited with status code", status)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def install(prefix="/usr", document_root="/srv/gochan", symlinks=False, js_only=False, css_only=False, templates_only=False):
|
def install(prefix="/usr", document_root="/srv/gochan", symlinks=False, js_only=False, css_only=False, templates_only=False):
|
||||||
if gcos == "windows":
|
if gcos == "windows":
|
||||||
print("Installation is not currently supported for Windows, use the respective directory created by running `python build.py release`")
|
print("Installation is not currently supported for Windows, use the respective directory created by running `python build.py release`")
|
||||||
|
@ -463,11 +442,10 @@ if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
if action.startswith("-") is False:
|
if action.startswith("-") is False:
|
||||||
sys.argv.insert(1, action)
|
sys.argv.insert(1, action)
|
||||||
if action != "dependencies":
|
|
||||||
set_vars()
|
set_vars()
|
||||||
|
|
||||||
valid_actions = (
|
valid_actions = (
|
||||||
"build", "clean", "dependencies", "docker", "install", "js", "release", "sass", "test", "selenium"
|
"build", "clean", "install", "js", "release", "sass", "test", "selenium"
|
||||||
)
|
)
|
||||||
parser = argparse.ArgumentParser(description="gochan build script")
|
parser = argparse.ArgumentParser(description="gochan build script")
|
||||||
parser.add_argument("action", nargs=1, default="build", choices=valid_actions)
|
parser.add_argument("action", nargs=1, default="build", choices=valid_actions)
|
||||||
|
@ -481,26 +459,14 @@ if __name__ == "__main__":
|
||||||
action="store_true")
|
action="store_true")
|
||||||
parser.add_argument("--plugin",
|
parser.add_argument("--plugin",
|
||||||
help="if used, builds the gochan-compatible Go plugin at the specified directory")
|
help="if used, builds the gochan-compatible Go plugin at the specified directory")
|
||||||
|
parser.add_argument("--static-templates",
|
||||||
|
help="if used, also (re)builds the static error page templates based on the current gochan version",
|
||||||
|
action="store_true")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
build(args.debug, args.plugin)
|
build(args.debug, args.plugin, args.static_templates)
|
||||||
elif action == "clean":
|
elif action == "clean":
|
||||||
clean()
|
clean()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif action == "dependencies":
|
|
||||||
dependencies()
|
|
||||||
elif action == "docker":
|
|
||||||
parser.add_argument("--option",
|
|
||||||
default="guestdb",
|
|
||||||
choices=["guestdb", "hostdb", "macos"],
|
|
||||||
help="create a Docker container, see docker/README.md for more info")
|
|
||||||
parser.add_argument("--attached",
|
|
||||||
action="store_true",
|
|
||||||
help="keep the command line attached to the container while it runs")
|
|
||||||
args = parser.parse_args()
|
|
||||||
try:
|
|
||||||
docker(args.option, args.attached)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("Received keyboard interrupt, exiting")
|
|
||||||
elif action == "install":
|
elif action == "install":
|
||||||
parser.add_argument("--js",
|
parser.add_argument("--js",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
|
1
docker/.gitignore
vendored
1
docker/.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
volumes/
|
|
@ -2,22 +2,26 @@ FROM golang:1.20-alpine3.18
|
||||||
|
|
||||||
COPY docker/build-image.sh .
|
COPY docker/build-image.sh .
|
||||||
|
|
||||||
RUN ["./build-image.sh"]
|
|
||||||
|
|
||||||
WORKDIR /opt/gochan
|
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
|
# Get all
|
||||||
COPY . .
|
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"]
|
||||||
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"]
|
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
|
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'"
|
echo "pinging db, DBTYPE: '$DBTYPE'"
|
||||||
|
|
||||||
/opt/gochan/docker/wait-for.sh "$DATABASE_HOST:$DATABASE_PORT" -t 30
|
/opt/gochan/docker/wait-for.sh "$DATABASE_HOST:$DATABASE_PORT" -t 30
|
||||||
/opt/gochan/gochan -rebuild all
|
|
||||||
/opt/gochan/gochan
|
/opt/gochan/gochan
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
@ -42,9 +41,9 @@ type GochanConfig struct {
|
||||||
// ValidateValues checks to make sure that the configuration options are usable
|
// ValidateValues checks to make sure that the configuration options are usable
|
||||||
// (e.g., ListenIP is a valid IP address, Port isn't a negative number, etc)
|
// (e.g., ListenIP is a valid IP address, Port isn't a negative number, etc)
|
||||||
func (gcfg *GochanConfig) ValidateValues() error {
|
func (gcfg *GochanConfig) ValidateValues() error {
|
||||||
if net.ParseIP(gcfg.ListenIP) == nil {
|
// if net.ParseIP(gcfg.ListenIP) == nil {
|
||||||
return &InvalidValueError{Field: "ListenIP", Value: gcfg.ListenIP}
|
// return &InvalidValueError{Field: "ListenIP", Value: gcfg.ListenIP}
|
||||||
}
|
// }
|
||||||
changed := false
|
changed := false
|
||||||
|
|
||||||
_, err := durationutil.ParseLongerDuration(gcfg.CookieMaxAge)
|
_, err := durationutil.ParseLongerDuration(gcfg.CookieMaxAge)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue