comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Persson" <Bjorn@xn--rombobjrn-67a.se>
Subject: Re: Ada/GNAT/AWS-friendly web hosting
Date: Fri, 13 Sep 2024 16:33:15 +0200	[thread overview]
Message-ID: <20240913163315.7ec71431@tag.xn--rombobjrn-67a.se> (raw)
In-Reply-To: vbutl5$8a99$5@dont-email.me

Marius Alves wrote:
> Researching how to build an HTTP server (serving a website) on a local 
> machine (MacOS) using AWS (Ada Web Server) and deploy it on a web 
> 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). 
> 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 
> 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) 
> required, right? GNAT does that, right?

GCC – and thus GNAT – can be built as a cross-compiler. Perhaps 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 
> 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örn Persson

  parent reply	other threads:[~2024-09-13 14:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 14:25 Ada/GNAT/AWS-friendly web hosting Marius Alves
2024-09-12 14:48 ` J-P. Rosen
2024-09-12 14:54 ` DrPi
2024-09-12 17:06   ` J-P. Rosen
2024-09-12 17:16     ` Kevin Chadwick
2024-09-12 22:35     ` Lawrence D'Oliveiro
2024-09-13  6:46       ` J-P. Rosen
2024-09-14  6:38       ` Randy Brukardt
2024-09-12 22:40   ` Lawrence D'Oliveiro
2024-09-12 16:22 ` Jeffrey R.Carter
2024-09-12 22:29   ` Lawrence D'Oliveiro
2024-09-13  9:03     ` Jeffrey R.Carter
2024-09-12 18:48 ` Dmitry A. Kazakov
2024-09-13 13:15 ` Stéphane Rivière
2024-09-13 14:33 ` Björn Persson [this message]
2024-09-13 22:09   ` Lawrence D'Oliveiro
2024-09-14  7:01     ` Stéphane Rivière
2024-09-14  7:26       ` Lawrence D'Oliveiro
2024-09-14  8:51         ` Stéphane Rivière
2024-09-14  9:41           ` Lawrence D'Oliveiro
2024-09-14 10:29             ` Stéphane Rivière
2024-09-14 12:02               ` Kevin Chadwick
2024-09-14 13:00                 ` Stéphane Rivière
2024-09-14 14:34                   ` Jeffrey R.Carter
2024-09-14 16:11                     ` Stéphane Rivière
2024-09-14 18:04                       ` Jeffrey R.Carter
2024-09-13 17:36 ` Nioclás Pól Caileán de Ghloucester
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox