Commit 4390f155 authored by Addshore's avatar Addshore 🏄
Browse files

dev: Make it harder to fall over T287654

Require users to always specify the DB type that they want to
install, to avoid people using sqlite by default perhaps, and
then encountering T287654.

Also if people do choose sqlite, then end the install step
with a WARNING to them, linking to the phab ticket.

Bug: T287654
parent 872b1a88
......@@ -200,6 +200,14 @@ var mwddMediawikiInstallCmd = &cobra.Command{
Short: "Installs a new MediaWiki site using install.php",
Aliases: []string{"i"},
Run: func(cmd *cobra.Command, args []string) {
// Make it harder for people to fall over https://phabricator.wikimedia.org/T287654 for now
if DbType != "sqlite" && DbType != "mysql" && DbType != "postgres" {
fmt.Println("You must specify a valid dbtype (mysql, postgres, sqlite)")
os.Exit(1)
}
// TODO check that the required DB services is running? OR start it up?
mediawiki, _ := mediawiki.ForDirectory(mwdd.DefaultForUser().Env().Get("MEDIAWIKI_VOLUMES_CODE"))
if !mediawiki.LocalSettingsIsPresent() {
prompt := promptui.Prompt{
......@@ -356,6 +364,11 @@ var mwddMediawikiInstallCmd = &cobra.Command{
fmt.Println("Pass: " + adminPass)
fmt.Println("Link: " + serverLink)
fmt.Println("***************************************")
// TODO remove once https://phabricator.wikimedia.org/T287654 is solved
if DbType == "sqlite" {
fmt.Println("WARNING: The sqlite development environemtn currently suffers an issue, https://phabricator.wikimedia.org/T287654")
}
},
}
......@@ -473,7 +486,7 @@ func init() {
mwddMediawikiCmd.AddCommand(mwddMediawikiResumeCmd)
mwddMediawikiCmd.AddCommand(mwddMediawikiInstallCmd)
mwddMediawikiInstallCmd.Flags().StringVarP(&DbName, "dbname", "", "default", "Name of the database to install (must be accepted by MediaWiki, stick to letters and numbers)")
mwddMediawikiInstallCmd.Flags().StringVarP(&DbType, "dbtype", "", "sqlite", "Type of database to install (sqlite, mysql, postgres)")
mwddMediawikiInstallCmd.Flags().StringVarP(&DbType, "dbtype", "", "", "Type of database to install (mysql, postgres, sqlite)")
mwddMediawikiCmd.AddCommand(mwddMediawikiComposerCmd)
mwddMediawikiComposerCmd.Flags().StringVarP(&User, "user", "u", mwdd.UserAndGroupForDockerExecution(), "User to run as, defaults to current OS user uid:gid")
mwddMediawikiCmd.AddCommand(mwddMediawikiPhpunitCmd)
......
......@@ -17,7 +17,7 @@ trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
CURL=$(curl -s -L -N http://default.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "Is your database running and wiki database created"
# Install sqlite & check
./bin/mw docker mediawiki install
./bin/mw docker mediawiki install --dbtype sqlite
CURL=$(curl -s -L -N http://default.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "MediaWiki has been installed"
# docker-compose: Make sure it appears to work
......
......@@ -24,7 +24,7 @@ CURL=$(curl -s -L -N http://default.mediawiki.mwdd.localhost:8080) && echo $CURL
# Install everything (mysql, postgres, sqlite)
./bin/mw docker mediawiki install --dbname mysqlwiki --dbtype mysql
./bin/mw docker mediawiki install --dbname postgreswiki --dbtype postgres
./bin/mw docker mediawiki install
./bin/mw docker mediawiki install --dbtype sqlite
# Check the DB tools (phpmyadmin, adminer)
CURL=$(curl -s -L -N http://phpmyadmin.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "Open new phpMyAdmin window"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment