mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-04 02:46:23 +00:00
added bookstack
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
################################################################################
|
||||
# use like this: python3 run.py > test.sql
|
||||
################################################################################
|
||||
|
||||
import os
|
||||
import html
|
||||
directory = '/home/nick/tmp/emails'
|
||||
|
||||
# The insert statement to insert a page
|
||||
print("INSERT INTO `pages` (`id`, `book_id`, `chapter_id`, `name`, `slug`, `html`, `text`, `priority`, `created_at`, `updated_at`, `created_by`, `updated_by`, `restricted`, `draft`, `markdown`, `revision_count`, `template`) VALUES" )
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
if filename.endswith(".txt"):
|
||||
f = open(filename)
|
||||
|
||||
#print filename
|
||||
#print(filename)
|
||||
|
||||
#print filenmae with no extension
|
||||
base=os.path.basename(filename)
|
||||
filenoext=os.path.splitext(base)
|
||||
filenoext=str(filenoext[0])
|
||||
#print(filenoext[0])
|
||||
|
||||
# print file contents html safe
|
||||
lines = f.read()
|
||||
htmlcontentdirty=str(html.escape(lines))
|
||||
htmlcontentspaces=htmlcontentdirty.replace('\r', '<br />').replace('\n', '<br />')
|
||||
htmlcontent=' '.join(htmlcontentspaces.split())
|
||||
|
||||
#generate slug
|
||||
slugnospace=str(filenoext[0]).replace(" ", "_")
|
||||
slug=slugnospace.lower()
|
||||
|
||||
# now write the sql query
|
||||
print("(NULL, '2', '0', '", end = '')
|
||||
print(filenoext, end = '')
|
||||
print("', '", end = '')
|
||||
print(slug, end = '')
|
||||
print("', '", end = '')
|
||||
print(htmlcontent, end = '')
|
||||
print("', 'text_var', '0', NOW(), NOW(), '1', '1', '0', '0', 'markdown_var', '0', '0'),")
|
||||
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
|
||||
# TODO: you need to change the last comma to a semi colon for it to work in mysql
|
||||
@@ -0,0 +1,70 @@
|
||||
################################################################################
|
||||
# make sure you use the $PREFIX from .env for project_name
|
||||
# docker-compose -p project_name up -d
|
||||
#
|
||||
# If you are importing directly using the db you have to do the following in the container:
|
||||
# php artisan bookstack:regenerate-permissions
|
||||
################################################################################
|
||||
|
||||
version: '2'
|
||||
|
||||
volumes:
|
||||
bookstack-db:
|
||||
bookstack-uploads:
|
||||
bookstack-storage:
|
||||
|
||||
networks:
|
||||
traefik_web:
|
||||
external:
|
||||
name: traefik_web
|
||||
|
||||
services:
|
||||
|
||||
bookstack-db:
|
||||
image: mariadb:10.4.11
|
||||
restart: always
|
||||
volumes:
|
||||
- bookstack-db:/var/lib/mysql
|
||||
networks:
|
||||
- traefik_web
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_USER: bookstack
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
MYSQL_DATABASE: bookstack
|
||||
|
||||
# It's only exposed if someone knows the ip
|
||||
bookstack-phpdb:
|
||||
#https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags
|
||||
image: phpmyadmin/phpmyadmin:5.0
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
external_links:
|
||||
- bookstack-db
|
||||
depends_on:
|
||||
- bookstack-db
|
||||
networks:
|
||||
- traefik_web
|
||||
|
||||
# https://hub.docker.com/r/solidnerd/bookstack
|
||||
bookstack:
|
||||
image: solidnerd/bookstack:0.29.0
|
||||
depends_on:
|
||||
- bookstack-db
|
||||
environment:
|
||||
- DB_HOST=${PREFIX}_bookstack-db_1:3306
|
||||
- DB_DATABASE=bookstack
|
||||
- DB_USERNAME=bookstack
|
||||
- DB_PASSWORD=${MYSQL_PASSWORD}
|
||||
- APP_URL=https://${DOMAIN_NAME}
|
||||
networks:
|
||||
- traefik_web
|
||||
volumes:
|
||||
- bookstack-uploads:/var/www/bookstack/public/uploads
|
||||
- bookstack-storage:/var/www/bookstack/storage/uploads
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.${PREFIX}_bookstack.rule=Host(`${DOMAIN_NAME}`)"
|
||||
- "traefik.http.routers.${PREFIX}_bookstack.entrypoints=websecure"
|
||||
- "traefik.http.routers.${PREFIX}_bookstack.tls=true"
|
||||
- "traefik.http.services.${PREFIX}_bookstack.loadbalancer.server.port=8080"
|
||||
@@ -0,0 +1,4 @@
|
||||
MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass!
|
||||
MYSQL_PASSWORD=Again2ASecurepass!
|
||||
DOMAIN_NAME=bookstack.nickyeoman.com
|
||||
PREFIX=p1
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
version: '3.3'
|
||||
|
||||
################################################################################
|
||||
# Update the .env file
|
||||
# make sure you use the $PREFIX from .env for project_name
|
||||
# docker-compose -p project_name up -d
|
||||
################################################################################
|
||||
version: '3.3'
|
||||
|
||||
volumes:
|
||||
mariadb:
|
||||
joomla:
|
||||
|
||||
Reference in New Issue
Block a user