cofoundry-cms / cofoundry

Cofoundry is an extensible and flexible .NET Core CMS & application framework focusing on code first development
https://www.cofoundry.org
MIT License
835 stars 146 forks source link

the application is being updated. please try again shortly #442

Closed endrehegyi closed 3 years ago

endrehegyi commented 3 years ago

Hi,

I have been successfully running a .net core 2.1 app on a shared hosting platform (smarterasp), with a db on that same platform.

I've now tried to migrate to DigitalOcean VPS where I have other sites running well (no cofoundry).

After setting up routing etc.. I run the application and it just stays on "the application is being updated. please try again shortly"

I'm really stuck as to why this is happening?

It's connected to the same database. It works fine if I run it locally.

HeyJoel commented 3 years ago

That message occurs while Cofoundry is trying run the auto-updater, it locks out the application while it is doing this and if an exception occurs it will wait for a moment and re-try, hoping that the error has been resolved (e.g. intermittent db failure).

I would suspect that if you have just set this up that there is an issue connecting to the database e.g. connection string or firewall/permissions.

If you need to see the error and the site isn't yet public you can enable the developer exception page by setting the Cofoundry:Debug:DeveloperExceptionPageMode setting to On, see Debug Setting. Or if you enable .NET logging to the filesystem you can inspect the error there.

endrehegyi commented 3 years ago

It's really weird because im running an identical copy of the application with the same db config string etc, nothing changed. The only thing changed is where the client application is ran from.

I'm guessing it must be a digital ocean droplet (their VPS) firewall blocking something. I'll have a look later on. Any idea which port it may be blocking?

HeyJoel commented 3 years ago

The default port for SQLServer is 1433, but it can be changed.

Do you mean that you have your db on one host and your app server on another?

endrehegyi commented 3 years ago

Yes I have my db on the old original host (I haven't moved it) and then my app server on Digital Ocean.

JornWildt commented 3 years ago

If you use the same "old" connection string on the new website then it is very likely that either 1) the database host name is unknown on the Internet and thus unreachable from the new webserver, or 2) the database is blocked by a firewall to protect it from outside access.

Have you tried to connect to the database from your own development machine? Does that work? If so, then maybe there is an outgoing firewall rule on the new webserver (which would be a bit odd)?

endrehegyi commented 3 years ago

It connects and works with well if ran from a dev machine. So the host should be accessible, I can also connect to just the db from my local dev machine np. On the app server I have 'Ngnx Full' on my firewall which allows HTTP and HTTPS only (:80,:443) ports.

EDIT: I have added port 1433 to the firewall on the server but same issue, - stuck on message.

HeyJoel commented 3 years ago

Have you checked the error yet to verify that the issue is with the database connection?

endrehegyi commented 3 years ago

Yes checked it with the added Cofoundry DeveloperExceptionPage setting On but still it's the same, no extra information.

HeyJoel commented 3 years ago

There's a few things you can try.

  1. Enable .NET logging to the file system and check for errors
  2. Disable the auto update process so you can see if the applications runs without it. Use setting Cofoundry:AutoUpdate:Disabled, set it to true.
  3. Check the distributed lock table to see if a lock is being added select * from Cofoundry.DistributedLock where DistributedLockId = 'COFUPD' - if the date is recent it means the application is connecting to the database and is able to create a lock. If this is the case then something else is the problem. You can check the ModuleUpdateError table to see if there is an error running the installation for a particular module: select * from Cofoundry.ModuleUpdateError - I doubt this is the case though, because you say that nothing has changed in the installation.
  4. Is your old instance still connected to the database? It shouldn't matter if the applications are the same, as Cofoundry will startup fine in a multi-server environment, but I wonder if the old instance might be holding the lock? I guess then the other instance would also be showing the "updating" page though.
endrehegyi commented 3 years ago

I've tried all and this is what I got:

  1. no error messages
  2. no visible change
  3. no entries in those 2 db tables,
  4. The old instance is connected to the db yes. I can also connect to that same db from a local machine without issues.

I think the request to the db from the server is blocked somehow on DigitalOcean, or MSSQL connections don't work on Ubuntu 20.04 on DigitalOcean,

HeyJoel commented 3 years ago

It's been a while since Cofoundry ran on .NET Core 2.1, which version of Cofoundry are you running?

HeyJoel commented 3 years ago

Closing - inactive.