If a domain is created incorrectly initially (i.e. test.host.com) when it should have been (test.hm2.host.com) it is not recreated/fixed.

Comments

anarcat’s picture

Status: Active » Postponed (maintainer needs more info)

I don't think I understand what you mean here. What are the steps necessary to recreate the bug? What behavior were you expecting?

I guess you mean that we can't rename a site, but I wouldn't expect that as a feature just yet.

adrian’s picture

Title: Domain Aliasing » Rename sites
Category: bug » feature
Status: Postponed (maintainer needs more info) » Active

You can now however alias sites.

adrian’s picture

Version: 5.x-0.1-alpha2 » 6.x-0.1-rc1
Status: Active » Needs work

I added a 'deploy' command, which allows you to deploy a backup of a site under a new url.

it also handles the files directory changes.

there's no 'rename' command per se tho, but i imagine it will be a slight differentiation on the existing 'migrate' command

anarcat’s picture

Title: Rename sites » Rename sites (provision/backend)
anarcat’s picture

Issue tags: +aegir-0.4

We are going to have problems with uploaded files when renaming (or cloning) sites. Maybe we need to abstract that away right now?

Should we have a rewrite rule like this?

RewriteRule /files/ /sites/%{HTTP_HOST}/files/

That would save us a lot of trouble... I'm not sure, however, that Drupal can handle a different frontend and backend path...

anarcat’s picture

The files issue is a separate one: #275022: When moving or aliasing sites, permanently redirect sites/somesite.com/files to sites/$site_url/files..

The only thing missing here is probably a "rename" command that wraps around all this stuff (backup + deploy, whereas deploy fixes files urls).

univate’s picture

One of the things I have tried in the past (which works) is use a generic name under my sites folder and then use a symbolic links for domain paths. That would allow you to have the same site deployed across multiple platforms under different domains (e.g. dev/staging/productions) but always keep the file paths the same. The idea is that the site name would be unique in aegir and every platform that had a site folder with that specific unique name could be linked back to the one site object in aegir. That would force every site to have a name that should never change, but you could change the domains easily.

Is that something that could be explored here:

e.g.

Site name: example (a unique site name, but can exist in multiple platforms)
Domain name: example.com (unique across all sites and platforms)

Platform 1:
/sites
  /example
  /example.com -> example

Platform 2 (maybe this i a staging platform):
/sites
  /example
  /staging.example.com -> example

When you looked in aegir at the site "example" it would show versions of itself under each platform.
1. Platform 1 at the url - example.com
2. Platform 2 at the url - staging.example.com

The settings.php should also be updated to always use the file path:
sites/{site_name}/files (rather then the current domain name)

This also has a side effect of often smaller/cleaner urls for file paths (particularly subdomains):
e.g.
http://staging.example.com/sites/example/files/download.pdf
instead of
http://staging.example.com/sites/staging.example.com/files/download.pdf

anarcat’s picture

Site name: example (a unique site name, but can exist in multiple platforms)

see that's already a problem: what happens when you migrate to a platform where that name already exists?

i think we should stick with the unique name (the domain name) for storage. we can update the body and the files table on deploy, the only issue is the external links.

let's take the files issue to #275022: When moving or aliasing sites, permanently redirect sites/somesite.com/files to sites/$site_url/files. (since they also apply to clone) and keep this related to the actual rename stuff.

univate’s picture

First off I should define the terms I am using:

site
a project for one client/user in the system, we may want to launch multiple versions of their website for testing/staging changes
website
one instance of the site at a particular domain

The idea here is that "site name" would have to be unique (aegir would need to check that it is a unique name before creating or importing a sites, just like it checks that the domain name is unique).

If you are trying to migrate a website to a platform where the site name already exists it wouldn't be a migration it would be a replacement. As the existence of the same named website would mean it is the same site (just a different versions of the site e.g. testing/production). The only way you would get another version of a site under a different platform would be via a 'clone' operation, creating or importing sites would not allow this to happen. Clone could then provide two outcomes:

  1. an exact clone of the same website to a different platform for test or staging a new version of the same site for later migration
  2. create a new site based on the current website - this would be a permanent fork of that website for a different site

Replacement is a perfectly valid operation, as there are cases where you want to test out features, show them to a client on a non live version of their website and then when they approve the change migrate (replace) the website for real.

What you get with this solution:

  • a unique name for sites (in this context a site is not a website, but rather potentially a collection of websites of the same site at different code versions of itself)
  • a simple process to change the domain name of a website (as it just requires a new symbolic link)
  • changing domain names doesn't break anything related to the website like the file paths as they never depended on the domain name to start with (I have read the other issue, this solution provides a solution to both these problems, so I think it is worth mentioning here with this issue)

Also this site name doesn't have to be something the users creates themselves, it could easily be created by aegir, e.g. it could just be a node_id

I don't see a lot of reasons to having the same website running on the same platform, normally when you are testing out new features they are related to code changes and therefore a new platform.

anarcat’s picture

So I *think* I agree with you, but what you are really talking about here is clone, not rename, so see #448692: site clone support for that. I will answer in that other issue.

Anonymous’s picture

Status: Needs work » Needs review

I've written an early Rename feature/task. Seems to work, needs some work still, but early reviews welcome.

Branches on my git.mig5.net (git clone git://git.mig5.net/drupal/{profiles/hostmaster , modules/provision}

275737_site_rename

Hostmaster diff
Provision diff

adrian’s picture

Status: Needs review » Needs work

This shouldn't delete the node and recreate it on the front end.

it should just set the $node->title of the node.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new3.68 KB
new4.66 KB

Please test the new 275737_site_rename branch via git://git.mig5.net/drupal/{profiles/hostmaster,modules/provision} . Node->title is simple updated, no silly destroying of old and creating new.

Also attached are basic patches for review.

Anonymous’s picture

StatusFileSize
new3.68 KB

Uh, updated Provision patch, I forgot to apply a stash that contained fixes for hyphenated drush commands..

Anonymous’s picture

I've moved these branches to git.aegirproject.org as dev branches 'dev-site_rename' in both provision and hostmaster.

Anonymous’s picture

If $node->revision = TRUE, hosting_site_update() switches to hosting_site_insert() as it assumes a new node or a new revision. Is this actually deliberate in the case of where a node is NOT new, but a revision is being made?

The problem I have with Site Rename is that I set $node->revision = TRUE to make an entry in node_revisions that the $node->title has changed. But what happens is I end up getting a duplicate row in hosting_site (well, with the new vid). This isn't good because there are a number of queries that are made against hosting_site on the value of $nid, which are identical in cases like this, and not $vid.

I can set no revision, and then all is well, but then I lose the history of the change in node_revisions which is also not desirable.

So what do we do?

1) Set no revision when renaming the site and then the database integrity is clean

2) Set a revision, but go through all the Hosting code and update SELECT queries that are made against hosting_site to be based on the vid or something?

Perhaps we can set a conditional in hosting_site_update() to check for not just $node->revision but also $task_type != 'site_rename' but I don't think the $task is available at that time.

or 3) We don't tell hosting_site_update to check for $node->revision but something else that *only* can occur when a node is new and not just getting a revision (Does such a check exist? I think at that point the $node->nid already exists)

Thoughts?

Anonymous’s picture

Status: Needs review » Fixed

After various discussions I committed the current working version to the master branch. We currently do not save a revision of the site node when changing its title. When we refactor various parts of Hosting to select from tables like hosting_site by vid rather than nid, we can fix this. But that refactoring needs to be a separate issue, as it affects a large number of things such as batch migrate and more.

Status: Fixed » Closed (fixed)
Issue tags: -aegir-0.4

Automatically closed -- issue fixed for 2 weeks with no activity.