[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can Docker/Artanis run on a network server?
From: |
Mortimer Cladwell |
Subject: |
Re: Can Docker/Artanis run on a network server? |
Date: |
Thu, 8 Apr 2021 06:48:38 -0400 |
Hi Nala,
I downloaded and installed the main branch of artanis, reinitialized the database, after a few logins over a couple of days I look at the sessions table:
sid | data | expires | client
----------------------------------+------+-------------------------------+------------
9999999999 | | Sat, 31 Oct 2020 13:41:27 GMT |
5c88c489290de67c1bf2706a22a07cc6 | () | Tue, 06 Apr 2021 00:53:34 GMT | Unknown IP
f0d4747d31f9386218947fbc715f3f0b | () | Tue, 06 Apr 2021 12:15:39 GMT | Unknown IP
7fe23eefa1de75a8d216f6d3ad359321 | () | Wed, 07 Apr 2021 11:52:00 GMT | Unknown IP
6694e0d2e064f12975190b88e4d459ce | () | Wed, 07 Apr 2021 19:54:07 GMT | Unknown IP
2b25a16b1c9a14d3edd7b26441a62325 | () | Wed, 07 Apr 2021 20:00:14 GMT | Unknown IP
f8e442fbb98b0dcced2017bd95dc5554 | () | Wed, 07 Apr 2021 21:05:22 GMT | Unknown IP
One caveat though, I do not let "art work" create the sessions table. I have my own initialization script that creates the table, and initializes a fake session #1 (sid=9999...) which is required for the creation of many other objects in the database, which all must be associated with a sid upon creation. This is how I bootstrap the app. I changed the CREATE TABLE sessions command in my init script to mimic yours in this new version :
create table if not exists Sessions (sid varchar(32) ,data text ,expires varchar(29) ,client varchar(39) ,PRIMARY KEY (sid)) ;
So given that caveat it seems to be working, though client is Unknown IP for a locally running dockerized (both client and server) app. If I move the dockerized server to a remote LAN machine and run undockerized artanis/myapp on my local workstation - still get Unknown IP.
sid | data | expires | client
----------------------------------+------+-------------------------------+------------
9999999999 | | Sat, 31 Oct 2020 13:41:27 GMT |
f413dcb300111bf5f4ae3faba0932933 | () | Thu, 08 Apr 2021 16:34:17 GMT | Unknown IP
Mortimer
On Sun, Apr 4, 2021 at 5:05 AM Nala Ginrut <
mulei@gnu.org> wrote:
Hi Mortimer!
I've removed the useless valid field in session.
Could you try the vanilla master to test you current case?
If everything is OK, then I think it's time to release 0.5.1 ;-)
Best regards.
Mortimer Cladwell writes:
> Hello!
> Has anyone gotten a Dockerified Artanis app to run on a LAN server?
>
> In the table below I share my experience trying. The definition of the
> various columns are as follows:
>
> Location: local - my office workstation; LAN - a server on the internal LAN
> with an ip of 192.168.1.17
>
> Docker: yes - I am using docker running with the command "docker run --rm
> -p 3000:3000 -v /tmp:/myapp/pub/tmp myapp";
> no - I have guile and artanis installed on the OS (Debian 10) and I
> am using "art work" at a terminal prompt.
>
> ip: the ip address in artanis.conf e.g. host.addr =127.0.0.1
>
> entrypoint: the ip in the entrypoint command in Dockerfile e.g. 0.0.0.0 for
> the command "ENTRYPOINT [ "art", "work", "-h0.0.0.0" ]
>
> success?: Yes - it worked; No - there are problems
>
>
> location Docker ip entrypoint success?
> ======== ===== == ========== ========
> local no 127.0.0.1 0.0.0.0 yes
> LAN no 192.168.1.17 0.0.0.0 yes
> local yes 127.0.0.1 0.0.0.0 yes
>
> LAN yes 192.168.1.17 0.0.0.0 no
> LAN yes 127.0.0.1 0.0.0.0 no
> LAN yes 192.168.1.17 192.168.1.17 no
> LAN yes 127.0.0.1 192.168.1.17 no
>
>
>
> Failure has two varieties:
> 1. The only entrypoint I find that works is 0.0.0.0 All others give an
> error like:
> In artanis/server/ragnarok.scm:
> 630:10 4 (establish-http-gateway _)
> 443:16 3 (ragnarok-http-gateway-run _)
> 90:24 2 (ragnarok-open #:host _ #:family _ #:addr _ #:port _)
> 70:4 1 (make-listen-socket 2 3232235793 3000)
> In unknown file:
> 0 (bind #<input-output: socket 24> 2 3232235793 3000)
>
> ERROR: In procedure bind:
> In procedure bind: Cannot assign requested address
>
> 2. With entrypoint 0.0.0.0 and artanis.conf host.addr 127.0.0.1 or
> 192.168.1.17 the app works as expected except for redirects i.e any
> controller that uses (redirect-to rc "/test/page2") will redirect me to:
>
> 0.0.0.0:3000/test/page2
>
> which is a fail. However if I manually substitute 192.168.1.17 for 0.0.0.0
> in the browser address bar, I can get to page2. So the problem I am having
> is with redirection. All controllers that use (view-render "page1"
> (the-environment)) work fine.
>
> Any ideas?
> Are there other flags for art work (besides "-h")?
>
> Thanks
> Mortimer
>
> ===========================================================================================
> My simplified controllers/views for testing redirection:
>
>
> (define-artanis-controller test) ; DO NOT REMOVE THIS LINE!!!
>
> (test-define page1
> (lambda (rc)
> (view-render "page1" (the-environment))
> ))
>
> (post "/test/page1action"
> (lambda (rc)
> (redirect-to rc "/test/page2")
> ))
>
> (test-define page2
> (lambda (rc)
> (view-render "page2" (the-environment))
> ))
>
> <html><body>
> <h1>Page 1</h1>
> <form action="" method="POST">
> <input type="submit" value="Send Request">
> </form></body> </html>
>
> <html><body>
> <h1>Page 2</h1>
> </body></html>
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058