Content
Change database folder
Added by Pietro Chiavaccini about 9 years ago
Hello everybody
I am a new user of Openproject-CE. I installed in Ubuntu 14.02 and everything works fine. I am wondering how to modify the location of database/file attachemnt folder. The general idea is:
- to keep Open Project in one harddisk (sda1- 160 GB capacity) where the OS is installed;
- to place all the databases in a different harddisk (sdc1- 1TB size) that I can easily backup
Now the problems start….
I understood that I have to change the configuration.ylm file.
This is the original:
…
default:
rails_cache_store: <%= ENV.fetch(‘RAILS_CACHE_STORE’) { :memcache }.to_sym %>
session_store: <%= ENV.fetch(‘SESSION_STORE’) { :cache_store }.to_sym %>
email_delivery_method: <%= ENV.fetch(‘EMAIL_DELIVERY_METHOD’) { :sendmail } %>
smtp_address: <%= ENV[‘SMTP_HOST’] %>
smtp_port: <%= ENV.fetch(‘SMTP_PORT’) { 25 }.to_i %>
smtp_domain: <%= ENV.fetch(‘SMTP_DOMAIN’) { ENV[‘HOSTNAME’] } %>
smtp_authentication: <%= ENV.fetch(‘SMTP_AUTHENTICATION’) { :login }.to_sym %>
smtp_user_name: <%= ENV[‘SMTP_USERNAME’] %>
smtp_password: <%= ENV[‘SMTP_PASSWORD’] %>
attachments_storage_path: <%= ENV.fetch(‘ATTACHMENTS_STORAGE_PATH’) { “/var/db/_APP_NAME_/files” } %>
I tried to change attachments_storage_path in this way
attachments_storage_path: /media/myfolder/discodati/db/openproject-ce/files
I restarted the service (sudo service openproject-ce restart) but nothing changed…
So I have to conclude that the procedure is not the rigth one.
Similar problem for the database location
My database.ylm is this:
<%
require ‘cgi’
require ‘uri’
begin
uri = URI.parse(ENV[“DATABASE_URL”])
rescue URI::InvalidURIError
raise “Invalid DATABASE_URL”
end
raise “No RACK_ENV or RAILS_ENV found” unless ENV[“RAILS_ENV”] || ENV[“RACK_ENV”]
def attribute(name, value, force_string = false)
if value
value_string =
if force_string
‘“’ + value + ’”’
else
value
end
“#{name}: #{value_string}”
else
“”
end
end
adapter = uri.scheme
adapter = “postgresql” if adapter == “postgres”
database = (uri.path || “”).split(“/”)[1]
username = uri.user
password = uri.password
host = uri.host
port = uri.port
params = CGI.parse(uri.query || “”)
%>
<%= ENV[“RAILS_ENV”] || ENV[“RACK_ENV”] %>:
<%= attribute “adapter”, adapter %>
<%= attribute “database”, database %>
<%= attribute “username”, username %>
<%= attribute “password”, password, true %>
<%= attribute “host”, host %>
<%= attribute “port”, port %>
<% params.each do |key, value| %>
<%= key : <= value.first %>
<% end %>
I don’t see any folder indication that I change to migrate the database.
The only thing I succeeded is to change the repository of the project in the general settings of the project itself
file:///media/myfolder/discodati/db/openproject-ce/svn/pt-174-14
But I don’t think it is enough for my purpose
Any help is really appreciated
Replies (1)
Hi Pietro,
the packager installation works a little bit different from what you know about a standard rails app. In detail the packager installation uses environment variables to configure the app.
So what you want to to is:
Show your configuration:
openproject-ce config
Change your configuration (example change of the attachment path):
openproject-ce config:set ATTACHMENTS_STORAGE_PATH=/var/db/openproject/files
Use the wizard to change things:
openproject-ce reconfigure
Please make sure to set everything back to the defaults before you start changing your configuration. Please also keep in mind that you have to restart the openproject-ce app every time you want to changes to apply (
service opennproject-ce restart
).Cheers,
Karsten