Installation fails in db:migrate with Finnish locale

Thanks for the pointer! Apparently “entropy” means the number of distinct characters, which is not how my statistics teacher would define it, but it’s used as just a label for the property of the title not being something like “abababababab”. I could get a Discourse site up in Finnish with these changes:

diff --git a/templates/postgres.template.yml b/templates/postgres.template.yml
index 76fb51d..74e1bbf 100644
--- a/templates/postgres.template.yml
+++ b/templates/postgres.template.yml
@@ -20,6 +20,7 @@ hooks:
        to: sv start postgres || exit 1
 
 run:
+  - exec: locale-gen fi_FI.UTF-8
   - exec: mkdir -p /shared/postgres_run
   - exec: chown postgres:postgres /shared/postgres_run
   - exec: chmod 775 /shared/postgres_run
diff --git a/templates/web.template.yml b/templates/web.template.yml
index d0b7519..7237b67 100644
--- a/templates/web.template.yml
+++ b/templates/web.template.yml
@@ -77,10 +77,11 @@ run:
         - git remote set-branches --add origin master
         - git pull
         - git fetch origin $version
-        - git checkout $version
+        - git checkout origin/$version
         - mkdir -p tmp/pids
         - mkdir -p tmp/sockets
         - touch tmp/.gitkeep
+        - perl -pi -e 's/10$/5/ if /title_min_entropy/' config/site_settings.yml
         - mkdir -p                    /shared/log/rails
         - bash -c "touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr}.log"
         - bash -c "ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr}.log $home/log"

I’m not sure that the locale-gen line is critical, but it suppressed a lot of warnings from perl. The git checkout looks like an oversight in the script: it retrieves origin/$version (where $version is something like tests-passed) but then checks out the local $version without merging in the latest changes. The locale-gen and perl commands are really quick-and-dirty modifications; you folks probably have some better ways of doing that.

1 Like