Hello! I've built a web app using Genie + Stipple and I would like to deploy it to

Hello! I’ve built a web app using Genie + Stipple and I would like to deploy it to my website (i.e. with a julia process running in the background). Has anyone done this before?

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

1 Like

Perhaps @essenciary can chime in.

1 Like

I imagine he has more important things to do :smiley: and I have a feeling that anyone with a slightly better grasp of web servers than mine would be able to point me in the right direction.

blind leading the blind here, but, currently, what is “your” website?

I have grav setup with nginx and letsencrypt, so it’s accessible via ports 80 and 443 (I have only a tenuous grasp of what that means btw). The main thing I was wondering was how to convert:

route("/", ui)
up(8000, open_browser=true)

To what you should do on a web server. Do I replace it with up(443) ? How do I “link” the app within my website?

EDIT: linked to the wrong grav website.

Hi Sebastian - happy to help. Depending on your hosting, two of the most common options are:

For Heroku deployments there is also Genie.Deploy.Heroku which uses the Heroku CLI to make deployments very easy but there is no tutorial yet.

I’m also successfully using Apache as a proxy instead of Nginx but I didn’t have the time to write a doc about it yet. But if you plan to use Apache let me know and I can pass you the Apache config.

Ping me if you need help.

6 Likes

Thanks for the link to the documentation, I should have checked that out first.

It seems that the nginx route assumes that the only thing running on your server would be the Genie app (or at least I wouldn’t know how to modify the nginx config to also have it serve up my grav website).

Would it be easier to do this if I used a docker container as suggested in the docs? And if I did, how would I integrate this into my website, i.e. have a page which says “Click here to checkout my app” and then it takes you to a page on my website were you can interact with the app. (FYI I host my website on a Hetzner server).

If this is more difficult than I expect then I’m fine with that, and I’ll just e.g. set this app standalone on Heroku and link that from my website.

It shouldn’t be that hard to set up.

Are you using Apache now on the server?

Basically the steps are:
1 - set up the Julia/Genie app to run on port 8000 (or whatever non-root non-public port)
2 - create a virtual host (how you do this is different for Apache or Nginx but there are tons of tutorials) to forward traffic from port 80 (where Apache or Nginx is setup) to port 8000

If you want to run multiple websites on the same server (as it usually is the case) you need to assign different domains or subdomains to the hosts, so Apache/Nginx will know how to handle the traffic by domain.

If you’re on Apache, I can forward you a config that we’re using at work.

1 Like

I’m on Nginx, so I’ll do some googling about setting up a virtual host and get back to you (that might be a while though, I’m just messing around with this in my spare time).

Looking forward to some blog/post showcasing this process. It should prove really useful! Awesome stuff @essenciary !!!

Key word is “reverse proxy”

Shudder I know that word from the days when I was trying to setup my home unRAID server. Let’s see if I understand what that’s all about this time round.

Ok, so the basic steps I followed are:

  1. Cloned my repository (see here) on my server
  2. Started Julia and ran src/build_web_app.jl which produced the following output:
Web Server running at http://127.0.0.1:8000
  1. Created a new file at /etc/nginx/conf.d/reverse-proxies.config which looks like this:
server {
        listen 80;
        server_name countdown.gobs.brussels;
        location / {
                proxy_pass      http://<server_ip_address>:8000; # I had tried replacing the ip address 
        }
}
  1. Restarted nginx: sudo systemctl restart nginx.

As I understand, I should be able to go to countdown.gobs.brussels and see my app, but this is not the case. I’ll have another stab at it at some point, but just thought I’d give an update. FYI I was following this tutorial for reverse proxies

I had made a silly mistake, now my web app is available at countdown.gobs.eu. It doesn’t work however - clicking solve should produce the output 1000//1 obtained by: (2 + 3) * (4 * 50), but nothing happens. @essenciary what can I do to troubleshoot? The web app works when I run it on my local machine.

There seems to be an issue with the WebSockets connection on the server. Can you look into that?

PS - I will tag new Genie and Stipple releases which also work exclusively over HTTP (so no need for WebSockets), you’ll be able to use that if WS is not available on the server (I think by end of today).

2 Likes

Thanks for getting back to me! I must admit I’m not familiar with WebSockets, so I’ll just wait for those releases and see if that fixes this.

Check this:

3 Likes

IT WORKS! Thanks so much @essenciary . As you can see, the use case is pretty trivial, but now I’ll be ready for when I want to do something actually useful in the future.

I wrote up a short blog post about it here for anyone whose interested.

4 Likes