From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: =?UTF-8?B?QmrDtnJu?= Persson Newsgroups: comp.lang.ada Subject: Re: Ada/GNAT/AWS-friendly web hosting Date: Fri, 13 Sep 2024 16:33:15 +0200 Message-ID: <20240913163315.7ec71431@tag.xn--rombobjrn-67a.se> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: individual.net j1aozLB+jqtQc/Di48yLnwFKjAQX11p/+FqJI2PKFArmsuSK7H Cancel-Lock: sha1:Ya6gitOXXj+wh1PKGQaYwu71qNM= sha256:qv3lawKv6YZJSEgrZNZB4Md4zetHObYhwDfpzCZAXuw= X-Newsreader: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) Xref: news.eternal-september.org comp.lang.ada:66363 List-Id: Marius Alves wrote: > Researching how to build an HTTP server (serving a website) on a local=20 > machine (MacOS) using AWS (Ada Web Server) and deploy it on a web=20 > hosting provider (e.g. 1dollar-webhosting.com). I don't know about 1dollar, but a typical web hosting provider will only let you upload static files (HTML, pictures et cetera), limited snippets of web server configuration, and certain kinds of programs that run under their web server's control. PHP is common. Some might run Perl programs with mod_perl, or Python programs using WSGI. Maybe some web hosts support CGI or FastCGI. Those interfaces can be implemented in Ada. I think you'll have limited use for AWS in that case, as the HTTP parsing is handled by the web server. I think it would be hard to find a web host that lets you run arbitrary network-facing daemons. To run your own web server you want a VPS (or a physical server in a collocation facility, but if your security needs don't rule out a web host, then a VPS is also fine). > The host is already running an HTTP server program (probably Apache).=20 > Must it be turned off? How? A typical web host won't let you turn off their web server. They serve many customers' content from the same Apache instance, so turning that off would break all those websites. > In general, can the executable be launched on a VPS (Virtual Private=20 > Server)? Sure. In a VPS you have the whole operating system to yourself (maybe except for the kernel if the VPS provider uses OpenVZ). You install and run whatever programs you want, just like on your own physical computer. Maybe you'll be able to get a VPS with MacOS, if that's your preference. In a VPS it's also your responsibility to install updates regularly, and upgrade to a new major OS version from time to time. If you fail to keep up, then criminals will take over your VPS and use it as a relay when attacking others. Make sure that you'll be notified automatically when there are updates to install. > If the host runs on Linux then cross-building (from MacOS to Linux)=20 > required, right? GNAT does that, right? GCC =E2=80=93 and thus GNAT =E2=80=93 can be built as a cross-compiler. Per= haps you can find one that someone has built and packaged for MacOS. Otherwise you'll need to build your own from the GCC source code, configuring it to be a cross-compiler. (That's theoretical knowledge. I have no practical experience with cross-compilation). > Or, must the program be built in the host? (Thus requiring GNAT be there.) No, but in my opinion it's much easier that way. Either build on the computer you'll run on, or on another computer of the same processor architecture, running the same version of the same operating system. That way you don't need to worry about getting the wrong version of some library or build tool. > Will dynamic linking work? I'm guessing not, so, static; but then, will=20 > GNAT integrate the right libraries for Linux in the executable? Cross-compilation should be able to work with shared libraries. Regardless of whether the libraries are shared or static, libraries for the target machine must be available on the build host. I guess you would either install packaged libraries on the target machine, and copy those to the build host, or else cross-compile the libraries too. You need to configure search paths carefully so that both the compiler and the linker find the cross-libraries instead of the native ones. This is one of the complications you avoid by building natively. > Which port? Normally port 443, because of course you'll use HTTPS, won't you? Optionally you can also have an HTTP server on port 80 that responds to every request with a redirection to HTTPS. If you choose to put AWS behind a reverse proxy like DrPi suggested, then the reverse proxy listens on port 443 on your public IP address, and you tell AWS to listen on some other port and only on the localhost address, ::1 or 127.0.0.1. Bj=C3=B6rn Persson