Skip to content

Commit

Permalink
fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Jun 20, 2021
1 parent 9770368 commit 4b1712c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mwdocker/docker.py
Expand Up @@ -141,6 +141,12 @@ def genWikiSQLDump(self,**kwArgs):
'''
self.generate(f"mwWiki{self.shortVersion}.sql",f"{self.dockerPath}/wiki.sql",**kwArgs)

def genInitDB(self):
'''
generate the initialize database script (in fact just copying)
'''
self.generate("initdb.sh",f"{self.dockerPath}/initdb.sh",**kwArgs)

def generateAll(self):
'''
generate all files needed for the docker handling
Expand All @@ -149,6 +155,7 @@ def generateAll(self):
self.genComposerFile()
self.genLocalSettings()
self.genWikiSQLDump()
self.genInitDB()

def up(self,forceRebuild:bool=False):
'''
Expand Down
8 changes: 8 additions & 0 deletions resources/templates/initdb.sh
@@ -0,0 +1,8 @@
#!/bin/bash
# Initialize the MediaWiki database
# WF 2021-06-20
# get the database password from Localsettings.php
password=$(grep wgDBpassword /var/www/html/LocalSettings.php | cut -f2 -d'"')
# initialize the database from the sql backup
cat /tmp/wiki.sql | mysql --host db -u wikiuser wiki --password="$password"

6 changes: 6 additions & 0 deletions resources/templates/mwDockerfile
Expand Up @@ -28,3 +28,9 @@ COPY LocalSettings.php /var/www/html

# copy the SQL dump
COPY wiki.sql /tmp

# copy the initdb.sh script
COPY initdb.sh /tmp

# RUN the initdb.sh script
RUN /tmp/initdb.sh

0 comments on commit 4b1712c

Please sign in to comment.