Error asigning web server to client

Discussion in 'ISPConfig 3 Priority Support' started by kaostc, Feb 7, 2025.

  1. kaostc

    kaostc Member HowtoForge Supporter

    I had a client with three servers (say server1, server2, server3) asigned in web server limits, and some sites created in server1 and server2.
    I tried to asign server4 as web server and got this error:
    El servidor que está intentando borrar de este cliente está siendo utilizado como servidor web. Por favor asegúrese de que este servidor no esté siendo utilizado por este cliente antes de borrarlo.
    The server you are trying to delete for this client is being used as a web server. Please make sure this server is not already in use by this client before deleting it.
    I wasn't deleting any server... strange. I removed all web server from the client (sites still created) and It was accepted. Now I hasn't asigned any server... but when I try to asign any I get the same error.
    Cay you provide help, please?
    Thanks.
     
  2. remkoh

    remkoh Active Member HowtoForge Supporter

    Apparently you tried to delete a server in the user settings but there are still websites or maybe ftp or ssh accounts active on that server.
    Therefor you can't delete it.
     
  3. kaostc

    kaostc Member HowtoForge Supporter

    Please read carefully my first post.
    - The first time I received the error I was adding, not deleting a server.
    - Then I delete all server, it would be logic that now I receive the message, but I didn't ?¿?¿ All servers was deleted from client settings.
    - Now I receive the error every time I try to add a server ?¿¿?¿
    So the behaviour is strange... :|
     
  4. remkoh

    remkoh Active Member HowtoForge Supporter

    Yes I've read it.
    But the error doesn't just comes out of the blue.
    I've seen it myself several times, always thinking I didn't do anything wrong, but in the end it always was user error and the error was correct.

    Only adding a new server, leaving existing servers in place, cannot create that error.
     
  5. kaostc

    kaostc Member HowtoForge Supporter

    Glad to know about your experience.

    I am quite sure I am doing something wrong since ISPConfig is a widely used software and I am not experienced with it. Just because of that I am asking for support, to know what I am doing wrong.

    In fact, deleting all the servers for the users maybe was not a clever step... but I thought that maybe starting from scratch with the user/client would solve the problem. But note that the error was not consistent from the beginning: When it appeared for first time, I was adding a server and it said that I could not delete a server.

    Just to clarify: At the moment the user/client has no servers assigned, and when I try to add one, I get the error saying I cannot delete a server for the user. And the user has sites assigned. Maybe the solution is to move all sites to another client, then try to add the servers to the troubled client, and if it works, move the sites back, but I will wait a bit more for support to avoid messing it up more.

    Thanks for your attention.
     
  6. remkoh

    remkoh Active Member HowtoForge Supporter

    You can't start from scratch when websites etc already are created.
    You then can't delete servers and will get that error when you try.
    Everything in ISPC is linked together by client and server id's in the ISPC database.

    Only when a server has no websites etc for that client you can delete that server from the client.

    If you do want to start from scratch without deleting anything you'll have to change all websites etc owners (clients) to a temporary client for example so your clients have no more websites etc linked to the servers.
    Only then you can start again with your server settings per client and after that you restore the owners (clients).
     
    Last edited: Feb 7, 2025
  7. kaostc

    kaostc Member HowtoForge Supporter

    Are you aware that I am not deleting the server itself, but deleting from limits tab of client configuration?
    - I got the error about deleting a server when I try to add a new server to limits tab of an user/client configuration, which is weird.
    - Then I was able to remove the three servers from limits tab, which is weird also (It would have been an expected behaviour to receive the error at this point)
    - Now I get the error any time I try to add a server, which stills weird.
    Definitely I will try what I was thinking in my last message = what you propose.
    Thanks a lot.
     
  8. kaostc

    kaostc Member HowtoForge Supporter

    I have moved any sites, databases, etc... to another client.
    I still cannot add server to the limits tab of troubled client.
    If I log as the user associated with the troubled client, I still seeing the sites.
    Any help is appreciated.
     
  9. remkoh

    remkoh Active Member HowtoForge Supporter

    Yes I'm aware
    That's clearly the cause of your problems.
    Unfortunately I've got no clue about why this happens and how to solve it.
    You did do all the client changes etc within the ISPC interface and did not hack into the ISPC database to change things I hope?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    If this error occurs, then there must be records assigned to the server that get removed or changed for that client. Did you maybe move websites from one client to another client? There is one issue in ISPConfig when moving an asset from one client to another, which is that every record has a user and group associated to it, the client is the group where the user is the user that initially created the item, so when you move a item from one client to another, the creator stays the same.
     
  11. kaostc

    kaostc Member HowtoForge Supporter

    @remkoh I did not make any hack in the database that could cause the problem. @till you are right, I had moved sites from one client to another.

    I got the problem solved digging into the database and trying to understand it. I realized what you say about groups and users, @till. First of all, I returned the moved sites back to its clients using ISPConfig interface. The problem persisted. I realized that it was a "phantom site" that was in the database but not in the interface. It domain name was NULL. I carefully removed it directly in the database: I removed first in the master server and then in the server that hosted the site. And then I was able to modify the web servers assigned to client without any error. I added the servers in which the client has sites created and I think that now everything is working ok. I am also happy to learn a bit about how ISPConfig stores the information. :D

    I would be please if you can solve some doubts for me:

    1. For my peace of mind, I would like to now if the hack I made that solved the problem (removing the "phantom site") is consistent. I mean, has I to do something more in the database, some table to check for remaining stuff of the "phantom site". I removed it from web_domain table of both master server and the server that hosted the site.

    2. Moving sites from one client to another is quite useful for me. Can I do that taking care about manually changing user in the database directly? I should do that in master and in the server that host the site, true? Or simply I shouldn't move sites from one client to another anymore?

    3. Is there any documentation about how ISPConfig stores data in the database, or a relational model of the database?

    Thanks a lot four your help, and congrats for develop such intuitive and self-explained database model!
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    That is fine and should solve the issue. This phantom record was indeed the cause of the problem.

    First, I hope we can fix that issue in general in ISPConfig, but you can also do that manually in the database. All you have to do is also to change the sys_userid of the record to the new sys_userid of the user (see sys_user table to get the ID). The record can be in web_domain and additionally e.g. ftp_user if the site has or in the cron table e.g. web_database or web_database_user, its the same for any record that has a sys_userid and sys_groupid column.

    Sadly not, but in general, it's very similar to how, e.g., the Linux user and group system works.
    You have a login user in sys_user table, this user has a userid, which is referred to as sys_userid in almost all other tables.
    You have groups, they are stored in sys_group table. Each client has its own group. The ID of this group is referred to as sys_groupid in most other tables.

    Now, any record in the database that needs any kind of owner permissions has such a sys_userid and sys_groupid, similar to how any file on Linux is owned by a user and a group. The other sys_* fields in records like the ones in web_domain table describe how the user and group may access the record. Mostly you find there 'riud' which stands for read, insert, update and delete permission. So as you can see, I had inspired myself with the way the Linux filesystem works too here. If you change the 'client' in the ISPConfig GUI, all that happens is that the sys_groupid gets changed to the new group, but the 'creator', in this case the sys_userid' does not gets changed. and as user and group have typically access to a record, this leads to the issue that a records remains partially assigned to its creator, which you can fix by altering the sys_userid. I hope this explanation helps a bit to understand what's going on behind the scenes.
     
  13. kaostc

    kaostc Member HowtoForge Supporter

    Great @till!

    I will keep an eye on sys_userd for moved records when I change a site from one client to another, until the issue is solved.

    A last thing, how did the master-slave database sinchronization occurs? If I make changes to master database they are replicated to the slave somewhen? Or have I to do the tricks both in master and slave server? And what about added_by field? Seems to be merely informative, and to not affect on who can access to the sites/databases/etc... is that true?

    Thankyou very much, I learned a lot about ISPConfig internals with this issue.
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    You do not have to update it on the slave as the permissions are evaluated by the GUI only, which always connects to master database.

    Synchronisation between servers works like this: There is a table sys_datalog. When you change something in ISPConfig GUI, a serialized record of the before and after state of the record is saved to the sys_datalog table. The slave node now asks the master once per minute if there are new changes in sys_datalog and pulls these into its own database if needed. If there are pending changes, the red dot blinks in the upper nav bar. Afterwards, the slave node executes the required config changes. That's also why changing something manually in the ISPConfig database does not influence your server config, if there is no transaction record in sys_datalog, nothing will get applied. To apply manual database changes use Tools > resync, it artificially creates change-records for everything in sys_datalog, therefore enforcing the systems to re-apply changes and also re-sync with master.
     
  15. kaostc

    kaostc Member HowtoForge Supporter

    Another last thing: In system->system_users, does the User id column shows the client_id instead of the userid? Cause it show 0 for my admin user (userid = 1) and 56 for my last user (userid = 57).

    Thanks.
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, the list shows the client_id
     
  17. kaostc

    kaostc Member HowtoForge Supporter

    Thanks a lot for this great support!
     

Share This Page