Difference between revisions of "SMWConTalk2022-10"

From BITPlan Wiki
Jump to navigation Jump to search
Line 21: Line 21:
  
 
==⌘⌘ Automating Mediawiki Installation ==
 
==⌘⌘ Automating Mediawiki Installation ==
 +
In 2015 we started with 1000 line bash script
 +
Here is an excerpt:
 +
```bash
 +
#
 +
# get the passwords
 +
# and save them in the given shell file
 +
# paramams
 +
#  1: l_pwconfig - the file for the password configuration
 +
#
 +
get_passwords() {
 +
  local l_pwconfig="$1"
 +
  if [ -f $l_pwconfig ]
 +
  then
 +
    # get the sysop password
 +
    export SYSOP_PASSWD=$(cat $l_pwconfig  | grep SYSOP_PASSWD | cut -f2 -d'"')
 +
    export MYSQL_PASSWORD=$(cat $l_pwconfig  | grep MYSQL_PASSWORD | cut -f2 -d'"')
 +
  else
 +
    if [ "$random_passwords" = "true" ]
 +
    then
 +
      # create a random SYSOP passsword
 +
      export SYSOP_PASSWD=$(random_password)
 +
      export MYSQL_PASSWORD=$(random_password)
 +
    else
 +
      password_dialog "ProfiWiki Setup" "Please specify passwords"
 +
  fi
 +
  local l_now=$(timestamp)
 +
  cat << EOF > $l_pwconfig
 +
#!/bin/bash
 +
# generated by $0 at $l_now
 +
export SYSOP_PASSWD="$SYSOP_PASSWD"
 +
export MYSQL_PASSWORD="$MYSQL_PASSWORD"
 +
EOF
 +
  fi
 +
}
 +
```

Revision as of 09:04, 26 October 2022

<slideshow style="bitplan" headingmark="⌘⌘" incmark="…" scaled="true" font="Arial" >

title
BITPlan
WolfgangFahl.png

pymediawikidocker
author

Wolfgang Fahl info@bitplan.com
footer
Tutorial
subfooter
SMW Con Fall 2020

</slideshow>

⌘⌘ Agenda

  • Docker
  • Mediawiki Docker images
  • Limitations of Docker files
  • Automating Mediawiki Installation

⌘⌘ Docker

Docker

⌘⌘ Mediawiki Docker images

Mediawiki official docker images

⌘⌘ Limitations of Dockerfiles

The Dockerfile syntax and semantic does not allow for proper programming logic - see e.g. iterate in run command stackoverflow question

⌘⌘ Automating Mediawiki Installation

In 2015 we started with 1000 line bash script Here is an excerpt: ```bash

  1. get the passwords
  2. and save them in the given shell file
  3. paramams
  4. 1: l_pwconfig - the file for the password configuration

get_passwords() {

 local l_pwconfig="$1"
 if [ -f $l_pwconfig ]
 then
   # get the sysop password
   export SYSOP_PASSWD=$(cat $l_pwconfig  | grep SYSOP_PASSWD | cut -f2 -d'"')
   export MYSQL_PASSWORD=$(cat $l_pwconfig  | grep MYSQL_PASSWORD | cut -f2 -d'"')
 else
   if [ "$random_passwords" = "true" ]
   then
     # create a random SYSOP passsword
     export SYSOP_PASSWD=$(random_password)
     export MYSQL_PASSWORD=$(random_password)
   else
     password_dialog "ProfiWiki Setup" "Please specify passwords"
  fi
  local l_now=$(timestamp)
  cat << EOF > $l_pwconfig
  1. !/bin/bash
  2. generated by $0 at $l_now

export SYSOP_PASSWD="$SYSOP_PASSWD" export MYSQL_PASSWORD="$MYSQL_PASSWORD" EOF

 fi

} ```