Limitations of open source server

I intend to create an app that will be used in mainland China. Generally, external servers provided by western commercial firms can’t be accessed in China. Same applies for example to Google and Facebook components (accessed from the normal servers). Therefore I intend to deploy the app on a Lightsail server (these are accessible in mainland China) making use of the open source Anvil server.

My question is, are there any limitations of the open source server in comparison with the normal Anvil server that I should be aware of? Any dependencies that might cause a problem in this scenario?

I’ve deployed an app via the open-source server in Mongolia. While we don’t have blocking issues like in China, we often have incredibly slow access to outside Mongolia resources. So I have a few recommendations:

  • External CSS resources (fonts, animations, etc) should be coded directly into the app instead of referenced. Google fonts probably won’t work for example. The user’s browser will fail back to the default fonts, but it degrades the user experience.
  • Email doesn’t work the same way in the open-source app server. Use an email provider that will work in China. Your app will need to be able to connect to the email server to send and receive emails (if you need that functionality).
  • By default the app server uses Let’s Encrypt for SSL certificates. Works very well, but you should consider that if the server is physically located in China you may have extra requirements to be allowed an SSL certificate. Extra work may be needed there.

For me the main limitation was speed. I noticed that BEFORE the recent update the open-source server was slower than the hosted one. Various reasons behind this (including that my host isn’t superfast). But the two most recent versions of the app server are much much faster.

Also, consider whether your server will be able to git pull from Anvils servers when you need to deploy or update your app. If not you will need to download to your local machine and SFTP it to your Lightsail server.

Problems are definitely solvable, and in the end, the user experience won’t really be any different.

When I deployed my first Anvil app to a server I had to reimage the server three times because I kept messing things up. It’s a learning experience, but more recently I was able to go from clean image to deployed app in about an hour.

9 Likes

Thanks, Robert, that is very helpful. My company has deployed a couple of web apps (not Anvil) targeting China. Usually, we host in HK (no website certificate required if not in the mainland) or Japan (good fiber connections to China). For resources from Google or FB we just made copies on our local server. From HK or Japan there was no problem connecting to external email servers. We used commercial SSL certs (I understand that Let’s Encrypt is rate-limited). I believe that Github works on the mainland as well, but in any case, we had no problem with it in HK.

For hosting we use Lightsail or normal AWS, as these are both accessible in China (Digital Ocean and some other lower-cost services aren’t). In one case we used Alicloud from HK. I was glad to see that Anvil has instructions for deployment on Lightsail, which is what I will go with.

To ensure that the site worked on the mainland we used https://webpagetest.org/ which allows you to test loading on a server in Beijing, in addition to asking our contacts there to try things out.

2 Likes

When the number of users go up, it is kind hard to scale. Using Lightsail, load balancers and external database helps, but it hits the limit as well.

1 Like

Hi Tony, thanks for that. Do you mean that this issue only comes up with the open-source version? I presume that the hosted version is able to handle a fairly large number of users.

1 Like

So with the hosted version you can pay for a higher plan, which will give you multiple machines hosting your app. Users are load balanced to the next machine.

If you have some experience using a reverse proxy like nginx I don’t see why you couldn’t do this yourself, assuming your database was external. But to get started with I didn’t see much of an issue with a few dozen users at a time assuming the machine is beefy enough.

If you hope to scale then you will want to quickly learn the vagaries of distributed application hosting. It’s a LOT easier than 10 years ago (when you literally needed to be a level 35 mage or something like that), but still not easy.

3 Likes

Thanks, Robert, that’s a good summary of the options.

It is SysOp skills that help you scale your app, you can move your app to another aws (ec2, …) after lightsail but that is exactly what hosted version offers.

You dont need to manage servers security update … yourself.

Depending on how you process data, if most data is loaded and processed in client, not much scaling is required, but it comes with security cost.

Loading and processing most data from server is very secured, but scaling is the issue.

1 Like

FYI, I have been using the open source servers for more than a year, just after few days of the release and found that the hosted version is the best, I can just code my app without worrying anything else.

I stop using the open source now, too much headache.

3 Likes

Thanks Tony, having used other open-source versions of commercial products, that does make sense to me.

Hi @robert, are you able to run load balance with your servers or there is just a single server now? Thanks so much.

Just a single server for now.

The trick will be getting SSL to work with the pass through. With something like Apache or Nginx this basically just works with minimal config. No idea about Anvils app server.

I use Digital Ocean load balancer and SSL just works fine, but it is the session expiration notification showing immediately when page load, even with no SSL and http port 80 configuration.

I am trying docker now, but quite hard to get SSL work.