-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/15.1' into dev
- Loading branch information
Showing
19 changed files
with
173 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) the OpenProject GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License version 3. | ||
# | ||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
# Copyright (C) 2006-2013 Jean-Philippe Lang | ||
# Copyright (C) 2010-2013 the ChiliProject Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# See COPYRIGHT and LICENSE files for more details. | ||
#++ | ||
|
||
if ENV["OPENPROJECT_SKIP_DB_ENCODING_CHECK"].blank? | ||
icu_incompatible_encodings = %w[ | ||
EUC_JIS_2004 | ||
LATIN10 | ||
MULE_INTERNAL | ||
SQL_ASCII | ||
WIN874 | ||
] | ||
|
||
database_encoding = ActiveRecord::Base.connection.select_value("SHOW SERVER_ENCODING") | ||
|
||
if database_encoding.in?(icu_incompatible_encodings) | ||
abort <<~ERROR | ||
INCOMPATIBLE DATABASE ENCODING DETECTED | ||
Your database encoding is #{database_encoding}, which is incompatible with ICU | ||
collation used in OpenProject v15. | ||
Please check the instructions on how to change database encoding: | ||
https://www.openproject.org/docs/installation-and-operations/misc/changing-database-encoding/ | ||
This check can be skipped by setting environment variable OPENPROJECT_SKIP_DB_ENCODING_CHECK=true | ||
ERROR | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
docs/installation-and-operations/misc/changing-database-encoding/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Changing database encoding | ||
|
||
This instructions are primarily intended to help with an error encountered when migrating to OpenProject 15. | ||
The error happens when migration tries to create an ICU collation and database encoding doesn't support it. | ||
We suggest to use unicode encoding for maximum compatibility. | ||
|
||
## Preconditions | ||
|
||
* Credentials with the permission to create a database in the database server the OpenProject installation is running against. | ||
* Shell access to the OpenProject server. | ||
|
||
## 1. Create a database dump | ||
|
||
This and following steps assume that you are using built in `openproject` command. | ||
|
||
```shell | ||
openproject run backup | ||
``` | ||
|
||
Ensure it finished successfully and note down the path after `Generating database backup` that should normally be | ||
in form `/var/db/openproject/backup/postgresql-dump-<DATE_TIME_DIGITS>.pgdump`. | ||
|
||
See also [Backing up your OpenProject installation page](../../operation/backing-up). | ||
|
||
## 2. Create a new database with different encoding | ||
|
||
Note down the database connection URL that should be in form `postgres://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>`: | ||
|
||
```shell | ||
openproject config:get DATABASE_URL | ||
``` | ||
|
||
Create new database using `psql` command, after deciding on the name, for example `openproject-unicode`: | ||
|
||
```shell | ||
psql '<DATABASE_URL>' -c 'CREATE DATABASE "<NEW_DATABASE_NAME>" ENCODING UNICODE' | ||
``` | ||
|
||
Options for `CREATE DATABASE` can be found at [PostgreSQL documentation page](https://www.postgresql.org/docs/current/sql-createdatabase.html). | ||
|
||
Or alternatively using `createdb` command: | ||
|
||
```shell | ||
su postgres -c createdb -E UNICODE -O <dbusernamer> openproject_backup | ||
``` | ||
|
||
Instructions for `createdb` command can be found at [PostgreSQL documentation page](https://www.postgresql.org/docs/17/app-createdb.html). | ||
|
||
## 3. Restore the dump to the new database | ||
|
||
To get the new database URL you need to replace the old database name with the new database name in the connection URL that you got in the previous step. | ||
For example if it was `postgres://openproject:hard-password@some-host:5432/openproject` and new database name was chosen to be `openproject-unicode`, then | ||
new database URL will be `postgres://openproject:hard-password@some-host:5432/openproject-unicode`. | ||
|
||
```shell | ||
pg_restore -d '<NEW_DATABASE_URL>' '<PATH_TO_THE_DATABASE_DUMP>' | ||
``` | ||
|
||
See also [Restoring an OpenProject backup](../../operation/restoring/). | ||
|
||
## 4. Change configuration to use the new database | ||
|
||
Using the new database URL from previous step: | ||
|
||
```shell | ||
openproject config:set DATABASE_URL=<NEW_DATABASE_URL> | ||
``` | ||
|
||
See also [Configuring a custom database server page](../../configuration/database/). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters