Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Host Web API

Host Web API

Scheduled Pinned Locked Moved The Lounge
databasecloudjsonhelpquestion
20 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pkfoxP pkfox

    Host it yourself ! I do this a lot using Net 6 - I have a SBC on my LAN running Linux with a database(postgres) the dotnet sdk and runtimes installed, publish your API to a folder in /var/www/ (can be anywhere) , create a systemd service file and put it in /etc/systemd/system folder (so you can control it) - job done. To start it - systemctl start myapi.service, if you want it started at boot time - systemctl enable myapi.service Sample service file

    \[Unit\]
    Description=Pete Kane Commands API net core  
    StartLimitIntervalSec=0
      
    \[Service\]  
    ExecStart=/usr/bin/dotnet /var/www/CommandsAPI/CommandsAPI.dll
    WorkingDirectory=         /var/www/CommandsAPI/
    User=pjk  
    Group=pjk  
    Restart=on-failure  
    SyslogIdentifier=Commands-API
    PrivateTmp=true  
    \[Install\]  
    WantedBy=multi-user.target  
    

    Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

    N Offline
    N Offline
    NPowDev
    wrote on last edited by
    #10

    A very nice and helpful tip how simple it may be! :thumbsup: For someone with only .NET desktop experience, I'm today still staying away from the .NET back end stuff, and still a newbie. I stay still away on the old PHP solution way. :-O

    Something about which we often break our head: "In the name of the Compiler, the Stack, and the Bug-Free Code. Amen." (source unknown)

    1 Reply Last reply
    0
    • K Kevin Marois

      I'd like to host a Web API for a prototype project. Free would be nice, but what's really important is 'easy'. I don't want to have to jump through hoops to publish it and maintain it. Keep it simple. Also, I'll need access a SQL DB from within it. I'm looking at AWS and Azure. Any other recommendations? Thanks

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      V Offline
      V Offline
      Vaso Elias
      wrote on last edited by
      #11

      Azure Apps has free tier for Linux and Windows, 60 CPU minutes / day might be enough for prototyping App Service Pricing | Microsoft Azure[^]

      1 Reply Last reply
      0
      • K Kevin Marois

        I'd like to host a Web API for a prototype project. Free would be nice, but what's really important is 'easy'. I don't want to have to jump through hoops to publish it and maintain it. Keep it simple. Also, I'll need access a SQL DB from within it. I'm looking at AWS and Azure. Any other recommendations? Thanks

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        P Offline
        P Offline
        Peter Shaw
        wrote on last edited by
        #12

        I host my own :-) About 5 years ago I pooled together about £400 gbp, and bought a second hand Dell server that was only 2 years old from a local dealer. The server was a 4 Node C6100 server, with each node/sled fully populated (8 cores and 24gb Ram + 3 1Tb drives), However, what I'm about to describe can be run on any bit of old PC hardware built within the last 10 years or so, as long as it has a CPU with virtualisation extensions added, which today is all Xeons, and most i5/i7 series. Put a decent size hard drive in the machine, download the latest Ubuntu Server LTS version (Currently 22.04 as I write this [I personally am still on 20.04]), burn the ISO to a CD or a keychain, and boot and install the PC with it. Go with the defaults, if you download the server version you should not get asked if you want a desktop or anything on it, if you do though... the answer is NO, you don't need a GUI or anything on this system, just an SSH server (Which you may also get asked if you want) Once you have the base installed, then you first want to do an update:

        apt update; apt upgrade

        Just to make sure everything's up to date. Following that, you want LXD installing, no point in repeating what others have written, so you you can find all you need to know here: [https://www.cyberciti.biz/faq/install-lxd-on-ubuntu-20-04-lts-using-apt/\](https://www.cyberciti.biz/faq/install-lxd-on-ubuntu-20-04-lts-using-apt/) For performance reasons on a single stand alone PC, you probably want the "snap" version, and when you init your default storage pool "btrfs" as the file system type, unless of course you want access from your host machine direct into the containers you create then your storage type wants to be "dir", the rest are for more specialist cases and require too much overhead to maintain. Once you have your Server set up, and LXD installed and initialised, then your ready to rock and roll:

        lxc launch ubuntu:20.04 myfirstcontainer

        Will spin up your first container running ubuntu LTS 20.04 ready for you to "lxc exec bash" into it and start adding users, software etc to it. LXD/LXC containers running ubuntu, use something called cloud-init, which allows you to add provisioning steps directly to your containers at creation time, I've already created a profile script to add to LXD and you can grab a copy from github here: [LXD Profile to add to your LXD install, allowing the creation of lightweight DOTNET 6 containers when using "lxc launch"](https://gist.github

        pkfoxP 1 Reply Last reply
        0
        • K Kevin Marois

          I'd like to host a Web API for a prototype project. Free would be nice, but what's really important is 'easy'. I don't want to have to jump through hoops to publish it and maintain it. Keep it simple. Also, I'll need access a SQL DB from within it. I'm looking at AWS and Azure. Any other recommendations? Thanks

          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

          M Offline
          M Offline
          MikeCO10
          wrote on last edited by
          #13

          Can we get some more info? "API" is a pretty wide generic term, meaning very little by itself - What language are you looking to write it in? - Scale? Lots of parts and pieces to this, but on a simple level, there's a big difference between serving up a few thousand hits a day and a million. - DB? Accessing SQL DB - SQL Server, Postgres, MySQL/Maria? Scope again - Select only, Insert, Upsert, Delete, number of tables, linkages, etc? -Instancing? Do you need Docker containers? -Security? Need API key management? Basically, what are you trying to do? Given the last question, I found Azure to be a tad easier than AWS. For me, for proof-of-concept, I'd use a LAPP server to start. I'm partial to Postgres and most *nixes are set and forget. PHP/Postgres is good for prototyping data access. With a few tools, I could have a basic data API up and running in a few hours. Returning JSON, XML, or even an HTML block. Major clouds can all handle scale. I use PHP for prototypes, but I generally know the magnitude of scale. Even unknown, I don't concern myself much with it. I always figure if it becomes an issue, it'll be making enough money to spend the time or cost to do something different.

          1 Reply Last reply
          0
          • R RickZeeland

            If you have a Postgres database, I can recommend Postgrest.

            M Offline
            M Offline
            MikeCO10
            wrote on last edited by
            #14

            Postgrest looks interesting. I need to find some time to play with that. Looks like it automates a lot of things I hate doing, lol.

            1 Reply Last reply
            0
            • P Peter Shaw

              I host my own :-) About 5 years ago I pooled together about £400 gbp, and bought a second hand Dell server that was only 2 years old from a local dealer. The server was a 4 Node C6100 server, with each node/sled fully populated (8 cores and 24gb Ram + 3 1Tb drives), However, what I'm about to describe can be run on any bit of old PC hardware built within the last 10 years or so, as long as it has a CPU with virtualisation extensions added, which today is all Xeons, and most i5/i7 series. Put a decent size hard drive in the machine, download the latest Ubuntu Server LTS version (Currently 22.04 as I write this [I personally am still on 20.04]), burn the ISO to a CD or a keychain, and boot and install the PC with it. Go with the defaults, if you download the server version you should not get asked if you want a desktop or anything on it, if you do though... the answer is NO, you don't need a GUI or anything on this system, just an SSH server (Which you may also get asked if you want) Once you have the base installed, then you first want to do an update:

              apt update; apt upgrade

              Just to make sure everything's up to date. Following that, you want LXD installing, no point in repeating what others have written, so you you can find all you need to know here: [https://www.cyberciti.biz/faq/install-lxd-on-ubuntu-20-04-lts-using-apt/\](https://www.cyberciti.biz/faq/install-lxd-on-ubuntu-20-04-lts-using-apt/) For performance reasons on a single stand alone PC, you probably want the "snap" version, and when you init your default storage pool "btrfs" as the file system type, unless of course you want access from your host machine direct into the containers you create then your storage type wants to be "dir", the rest are for more specialist cases and require too much overhead to maintain. Once you have your Server set up, and LXD installed and initialised, then your ready to rock and roll:

              lxc launch ubuntu:20.04 myfirstcontainer

              Will spin up your first container running ubuntu LTS 20.04 ready for you to "lxc exec bash" into it and start adding users, software etc to it. LXD/LXC containers running ubuntu, use something called cloud-init, which allows you to add provisioning steps directly to your containers at creation time, I've already created a profile script to add to LXD and you can grab a copy from github here: [LXD Profile to add to your LXD install, allowing the creation of lightweight DOTNET 6 containers when using "lxc launch"](https://gist.github

              pkfoxP Offline
              pkfoxP Offline
              pkfox
              wrote on last edited by
              #15

              It's apt update not apt install update same for upgrade

              Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

              P 1 Reply Last reply
              0
              • K Kevin Marois

                I'd like to host a Web API for a prototype project. Free would be nice, but what's really important is 'easy'. I don't want to have to jump through hoops to publish it and maintain it. Keep it simple. Also, I'll need access a SQL DB from within it. I'm looking at AWS and Azure. Any other recommendations? Thanks

                If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                L Offline
                L Offline
                L Braun
                wrote on last edited by
                #16

                I have never done anything like that, but perhaps this helps: Penny Pinching in the Cloud: Azure Static Web Apps are saving me money - Scott Hanselman's Blog[^] and from that: Azure Static Web Apps – App Service | Microsoft Azure[^] "Pay as you grow Always free for hobby/personal projects. Easily move between pricing options based on your business needs."

                1 Reply Last reply
                0
                • pkfoxP pkfox

                  It's apt update not apt install update same for upgrade

                  Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                  P Offline
                  P Offline
                  Peter Shaw
                  wrote on last edited by
                  #17

                  aye, so a minor keyboard slip occured... meh...

                  pkfoxP 1 Reply Last reply
                  0
                  • K Kevin Marois

                    I'd like to host a Web API for a prototype project. Free would be nice, but what's really important is 'easy'. I don't want to have to jump through hoops to publish it and maintain it. Keep it simple. Also, I'll need access a SQL DB from within it. I'm looking at AWS and Azure. Any other recommendations? Thanks

                    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                    J Offline
                    J Offline
                    Joss451
                    wrote on last edited by
                    #18

                    For the prototype of my project, I am using DreamCompute from DreamHost. I pay under $40 per month. I'm using Rust with the actix_web crate to build out the API, packaging it in a Docker container, and using Nginx for routing and reverse proxying. MySql is the DB. So far, so good.

                    1 Reply Last reply
                    0
                    • P Peter Shaw

                      aye, so a minor keyboard slip occured... meh...

                      pkfoxP Offline
                      pkfoxP Offline
                      pkfox
                      wrote on last edited by
                      #19

                      It was a minor obervation Pete :)

                      Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                      P 1 Reply Last reply
                      0
                      • pkfoxP pkfox

                        It was a minor obervation Pete :)

                        Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                        P Offline
                        P Offline
                        Peter Shaw
                        wrote on last edited by
                        #20

                        Ya I know.... :-) You just caught me on the back of dealing with some woke idiots on Quora :-) sa'll good.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups