Giter Club home page Giter Club logo

helpcovid's Introduction

  • 👋 Hi, I’m @bstarynk

I am Basile Starynkevitch (born in 1959, living in France near Paris, husband, father and grandfather)

My personal web page is http://starynkevitch.net/Basile/ (where you can find my mobile phone number and resume and postal adress)

  • 👀 I’m interested in open source projects and artificial intelligence
  • 🌱 I’m currently learning ...
  • 💞️ I’m looking to collaborate on RefPerSys
  • 📫 How to reach me : by email : at home to [email protected]

helpcovid's People

Contributors

achakravarti avatar bstarynk avatar montao avatar nimeshneema avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

montao maxfork

helpcovid's Issues

Test with public server

I have a test up and running http://34.77.173.218:8089/ Please check if you can find something interesting. It is a VM with 1.7 GB memory. It has ssh access if you want to look around (ask me for access). I tried to register and got the following output. I suppose it is issue #14

{
 "gitid" : "e15d232b25301182f098400cf55d149a83b56214+",
 "unimplemented_cxx_file" : "hcv_views.cc",
 "unimplemented_cxx_function" : "hcv_expand_template_file",
 "unimplemented_cxx_line" : 204,
 "unimplemented_request_number" : 5,
 "unimplemented_request_path" : "/register"
}

Create script to get database dump

As was discussed on 31 March, we need a script that creates a dump of the HelpCovid database. This script may either be a Shell script or a Python script, and it needs to read the HelpCovid configuration file generated by the generate-config.py script to determine the database connection string. This script will also need to take into account that the path of the HelpCovid configuration file may be different from the default $HOME/.helpcovidrc

fails with simple configuration file.

In commit 12274c2 we fail with a simple configuration file $HOME/helpcovid.conf such as:

## fichier ~/helpcovid.conf - Basile file $HOME/helpcovid.conf
[helpcovid]
	log_message= hello from Basile helpcobvid.conf
	startup_popen_command= date +'startup Basile helpcobvid.conf %c'

[web]
	url= http://localhost:8089/
	root= /home/basile/helpcovid/webroot

document the HTTP exchanges.

In commit 6c5868a we need a documentation in written English of all the HTTP exchanges (requests and their URL, methods and arguments, replies and content and MIME types) done by helpcovid.

In particular Bootstrap is doing some HTTP which I Basile do not understand.

backup-database.py does not work well

In commit a42534f our backup-database.py

  • has an option --dry-run which should dump to stdout and be named --to-stdout

  • is asking for a PostGreSQL password, but should use what was given at generate-config.py or should document in English a way to set the PostGreSQL password

Please document in written English in DATABASE.md how to use that script

Show how to set up as per-user services in systemd and nosh service management

Per https://unix.stackexchange.com/a/578832/5132 , after #32 is in place the program can be run as a per-user or indeed system-wide service under systemd, the nosh toolset's service management, or anything else that provides the other side of the LISTEN_FDS mechanism. There are some quick and dirty socket and service units in that StackExchange answer that need tidying up, commenting, and inclusion in the tree here, somewhere.

This can then be documented in the readme:

Running as a systemd service

The helpcovid.socket and helpcovid.service files, provided here, can be used to run helpcovidas a so-called socket-activated service under systemd, either at the user level or at the system level.
To run it at user level, place these files in your $HOME/.config/systemd/user/ directory and issue systemctl --user daemon-reload to tell systemd to rescan that directory and find them.

To start/stop/enable/disable the program, address the socket unit; so (for example) issue systemctl --user enable helpcovid.socket.
The listening socket port and IP address are configured by adjusting the ListenStream= setting in the helpcovid.socket file in the normal systemd manner.
Note that systemd allows multiple port and IP address combinations in a single socket unit, with multiple ListenStream= settings.

All environment variables are set by modifying the service unit, either directly or with separate .conf file drop-ins (documented in the systemd.unit(1) manual page) that have individual Environment=WIBBLE=wobble lines).
That is where the LC_ALL environment variable, for specifying the locale, is set, as shown in the service unit provided.
Command-line flags can be altered by setting a flags variable, as referenced by the ExecStart= setting, notice.
The EnvironmentDirectory setting is not there for systemd; it is there for nosh service management, discussed in the next section.

systemd pushes the standard output and error of the service to your user part of the central systemd journal, which you can read with journalctl --user .

Running as a system-level service is much the same (without the --user and putting the unit files in the /etc/systemd/system/ directory instead).
Note that running as a system-level service involves privileged access and entails paying more attention to security, issues that this readme does not go into for brevity.
Unless you really need to bind to a super-user-only TCP port number, prefer running this as a user-level service under systemd.

Note that systemd starts your (enabled) user-level services when you first log in, and stops them when you log out of your final login session.

Running under nosh service management

Take the helpcovid.socket and helpcovid.service units for systemd, and pass them through system-control convert-systemd-units ./helpcovid.socket .
Place the generated service bundle directory (see the system-control(1) manual for what this is) in your$HOME/.config/service-bundles/services/directory as a helpcovid subdirectory.
Run system-control --user start helpcovid, and so forth.

Environment variables are read from an "envdir" (as documented in the envdir(1) manual page).
You can set them with (for example) system-control --user set-service-env helpcovid flags '--wibble' and print them with system-control --user print-service-env helpcovid.
This does not involve editing the helpcovid/service/run and helpcovid/service/service files, except perhaps to delete the setenv LC_ALL fr_FR.UTF-8 line so that you can override it from the envdir (which is read first).

Change the TCP port number and IP address by editing the tcp-socket-accept line in helpcovid/service/run.
Multiple port and address combinations can be set up by adding further tcp-socket-accept lines, all with (importantly) the --systemd-compatibility flag.

To log, create a second service bundle, named (for example) cyclog@helpcovid that runs cyclog ./main, and connect the first service to the second by symbolically linking helpcovid/log to ../cyclog@helpcovid.
There are lots of logging services that come with the nosh toolset that show how this is done.
You can read the log in cyclog@helpcovid/main/current and related files.

cleanup code is incomplete

In commit 8ec3726 we do have some

--cleanup

program option. That program flag is supposed to be run by ./helpcovid launched from some crontab(5) job running e.g. every five or ten minutes. It runs the hcv_background_periodic_cleanup C++ function in C++ file hcv_background.cc which should also be run periodically.

That hcv_background_periodic_cleanup C++ function is incomplete, and should cleanup both the database and any global data structure (protected by some std::mutex or std::recursive_mutex).
We may need to use also some std::condition_variable and/or synchronize threads using hcv_bg_event_fd so eventfd(2).

We might also synchronize threads using pipe(7) or temporary fifo(7).

generate-config.py fails

In commit 88a4b16 our generate-config.py script fails. Like below:

piotr ~/helpcovid 15:03 % ./generate-config.py 
Starting HelpCovid configuration generator...
See https://github.com/bstarynk/helpcovid and its README.md


 ==== HelpCovid web configuration =====

Enter web served URL, e.g. http://localhost:8089/ or https://example.com/

url: http://localhost:8089/
[url = http://localhost:8089/]
Enter web document root, a local directory containing web served resources (e.g. HTML files, CSS stylesheets)

... e.g. /home/basile/helpcovid/webroot/
root: /home/basile/helpcovid/webroot/
[root = /home/basile/helpcovid/webroot/]
Enter the OpenSSL public certificate, for HTTPS - can be left empty; see https://www.openssl.org/

sslcert: 
[sslcert = ]
Enter the OpenSSL private key, for HTTPS
sskey: 
[sskey = ]

 ==== HelpCovid PostGreSQL database configuration, see https://www.postgresql.org/ ====

Enter the PostGreSQL connnection string, see https://www.postgresql.org/docs/current/libpq-connect.html
Example: dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432
connection: dbname=helpcovid_db user=helpcovid_usr password=passwd1234helpcovid hostaddr=127.0.0.1 port=5432
[connection = dbname=helpcovid_db user=helpcovid_usr password=passwd1234helpcovid hostaddr=127.0.0.1 port=5432]
Enter *full path* of the HelpCovid PostgreSQL password file
... e.g. /home/basile/.helpcovid-pg-password
passfile: /home/basile/.helpcovid-pg-password
[passfile = /home/basile/.helpcovid-pg-password]

 ==== HelpCovid HTML template tags configuration ====

Enter HTML for <?hcv_datacontroller?>
Example: <a href="mailto:[email protected]>John Doe</a>
hcv_datacontroller_tag: <a href="mailto:[email protected]>John Doe</a>
[hcv_datacontroller_tag = <a href="mailto:[email protected]>John Doe</a>]

Configuration file saved to /home/basile/.helpcovidrc]
Traceback (most recent call last):
  File "./generate-config.py", line 228, in <module>
    main()
  File "./generate-config.py", line 220, in main
    write_connection_keys(conn)
  File "./generate-config.py", line 133, in write_connection_keys
    config_dict['database'] = split[0].split('=')[1]
IndexError: list index out of range

build problem with make

I get compilation error trying to run make. It looks like my C++ configuration has some conflicting version. If it helps then I can reproduce the error and presumably also produce a working build in a Debian VM or container. The first error I get is the following (but if I comment out and trick myself around it there comes next build problem)
hcv_web.cc:313:33: error: conversion from ‘long int’ to ‘Json::Value’ is ambiguous

privacy issues

Every private or personal data concerning any user, for example Basile Starynkevitch, should be viewable, in understandable form (that is, in French for me Basile, but in English for you Abhishek concerning your data) to that user.

That user should give explicit consent (e.g. click an "I agree" item) for sharing the data.

That user should give an explicit consent for some of the data being visible by neighbours.

Every user should have some way to clear all the data about him with a single mouse click, effective within the next 6 hours. We could provide a way to "undo" the pending clear.

In addition, a written mention should give the geographical location of the server, of the data controller person (with first and last name).

Personal data should not be kept for more than 6 months and automatically erased after that

Simplify locale configuration

Per https://unix.stackexchange.com/a/578832/5132 there's no need for --locale or a HELPCOVID_LOCALE environment variable, and these are just superfluous knobs. Just call setlocale() with "" to set the locale from the standard LC_* and LANG environment variables. Users can set locale with those standard environment variables, on the command line or in service definitions for systemd and otherwise, in the ways that they already expect.

SIGTERM is not handled properly

In commit f5a5e81 the SIGTERM signal is not handled as it should be by signalfd(2) facilities of C++ file hcv_background.cc

To exercise the bug after suitable configuration, run

./helpcovid --clear-database -D -T2 --write-pid=/tmp/helpcovid.pid

then (in some other terminal) kill $(cat /tmp/helpcovid.pid)

generate-i18n.py does not work properly with --subscript

In commit 190b6d9 the ./generate-i18n.py does not work properly with --subscript option.

When you run it with an existing helpcovid/webroot/i18n/helpcovid.fr-fr.po file as ./generate-i18n.py --subscript fr-fr that file is replaced by something starting with

msgid "₀₁LOGIN_COOKIEAGREE"
msgstr "Vous approuvez l'utilisation de cookies. Voir <a href='https://fr.wikipedia.org/wiki/Cookie_(informatique)'>ceci</a> pour les détails"

msgid "₀₂LOGIN_COOKIECLOSE"
msgstr "Fermer la fenêtre login"

msgid "₀₃LOGIN_COOKIEMORE"
msgstr "Approbation"

with the previous version of that file starting with

msgid "LOGIN_COOKIEAGREE"
msgstr "Vous approuvez l'utilisation de cookies. Voir <a href='https://fr.wikipedia.org/wiki/Cookie_(informatique)'>ceci</a> pour les détails"

msgid "LOGIN_COOKIECLOSE"
msgstr "Fermer la fenêtre login"

msgid "LOGIN_COOKIEMORE"
msgstr "Approbation"

The msgstr, not the msgid lines should get subscripts. And they should be on three digits, not two.

Please read again msgfmt(1) and documentation of GNU gettext notably section on the format of PO files

localization

In commit 6cca4ab we have some localization: program argument --locale, environment variable $HELPCOVID_LOCALE used in function hcv_initialize_templates file hcv_templates.cc for <?hcv msg MESSAGEID message content?> processing instructions.

However, we need a PO file and a script (perhaps generate-po.py ?) to help generating or updating it, and scanning HTML files for such <?hcv PI.

That script should check unicity of the MESSAGEID for <?hcv msg PI

See examples of such PI in file webroot/html/login.html etc...

Run from inside container

I changed a line in hcv_web.cc to make it listen on all interfaces
hcv_webserver->listen("0.0.0.0", webport);
If I do that (from the code inside the container), the webserver will respond from inside a container if I map the ports:
sudo docker run -it -p 8089:8089 debian bash
Everything else was straightforward once I tried with a clean Debian image .

Incomplete register HTTP POST request

In commit 49b1464 when filling the http://localhost:8089/register form (e.g. with First name Pierre, Last name Curie, Male gender, +33 45678 phone number, and [email protected] as email, and having agreed to share data, then pressing Sign Up / Register the HTTP POST request has no parameters except the gender as shown by Firefox web developer tool, and while running ./helpcovid --clear-database -D -T 2 we have simply the Gender in the parameters of the POST request, and


rimski.x86_64 ~/helpcovid 14:42 .130 % ./helpcovid --clear-database -D -T 2
./helpcovid --clear-database -D -T 2
./helpcovid[1945788]: HelpCovid 49b14649970e plugins can initialize the database if so needed, using their hcvplugin_initialize_database program arguments:
... ./helpcovid --clear-database -D -T 2
./helpcovid[1945788]: hcv_main.cc:537 -  !! parsed 5 program arguments
./helpcovid[1945788]: hcv_main.cc:796 -  !! start of ./helpcovid
 version:github.com/bstarynk/helpcovid built Fri 03 Apr 2020 02:31:20 PM MEST
... gitcommit 49b14649970e plugins can initialize the database if so needed, using their hcvplugin_initialize_database
... md5sum 83f10a0c46efcd6057325611c7bceed9 on rimski
 at Fri Apr  3 14:43:04 2020 MEST on rimski
./helpcovid[1945788]: hcv_main.cc:590 -  !! loading configuration file /home/basile/.helpcovidrc
./helpcovid[1945788]: hcv_main.cc:596 -  !! helpcovid loaded configuration file /home/basile/.helpcovidrc
./helpcovid[1945788]: hcv_web.cc:78 -  !! hcv_initialize_web: weburl='http://localhost:8089/', webroot='/home/basile/helpcovid/webroot/', opensslcert='', opensslkey=''
./helpcovid[1945788]: hcv_web.cc:116 -  !! starting plain HTTP server using weburl http://localhost:8089/ and webroot /home/basile/helpcovid/webroot/ hcv_webserver@0x5608df8a70f0
./helpcovid[1945788]: hcv_main.cc:876 -  !! helpcovid debugging enabled
./helpcovid[1945788]: ΔBG!hcv_main.cc:877▪ 00.00 s‣  helpcovid is debugging
./helpcovid[1945788]: hcv_main.cc:923 -  !! helpcovid unable to write builtin pidfile /var/run/helpcovid.pid
-: Permission denied
./helpcovid[1945788]: hcv_database.cc:114 -  !! using 'dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432' as PostGreSQL connection string.
./helpcovid[1945788]: hcv_database.cc:129 -  !! hcv_initialize_database connstr=dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432
./helpcovid[1945788]: hcv_database.cc:133 -  !! hcv_initialize_database for connstr=dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432 hcv_dbconn is 0x5608df8a3e00
./helpcovid[1945788]: hcv_database.cc:153 -  !! hcv_initialize_database cleared database
./helpcovid[1945788]: ΔBG!hcv_database.cc:175▪ 00.06 s‣  hcv_initialize_database: fullreqbuf=DO $$BEGIN RAISE LOG 'starting HelpCovid git 49b14649970eb99d9d4+ (built Fri 03 Apr 2020 02:31:20 PM MEST, md5 83f10a0c46efcd605732...) cleared on rimski pid 1945788'; END;$$;
./helpcovid[1945788]: hcv_database.cc:183 -  !! hcv_initialize_database got PostGreSQL version PostgreSQL 12.2 (Debian 12.2-4) on x86_64-pc-linux-gnu, compiled by gcc (Debian 9.3.0-8) 9.3.0, 64-bit(server version 12.2 (Debian 12.2-4))
./helpcovid[1945788]: ΔBG!hcv_database.cc:261▪ 00.06 s‣  hcv_initialize_database before preparing statements in dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432
./helpcovid[1945788]: ΔBG!hcv_database.cc:291▪ 00.06 s‣  preparing find_user_by_email_pstm
./helpcovid[1945788]: ΔBG!hcv_database.cc:318▪ 00.06 s‣  Registering prepared SQL statement user_create_pstm
./helpcovid[1945788]: ΔBG!hcv_database.cc:318▪ 00.06 s‣  Registering prepared SQL statement user_get_password_by_email_pstm
./helpcovid[1945788]: ΔBG!hcv_plugins.cc:215▪ 00.06 s‣  hcv_initialize_plugins_for_database starting with 0 plugins
./helpcovid[1945788]: hcv_database.cc:264 -  !! PostGreSQL database dbname=helpcovid_db user=helpcovid_usr password=passwd1234 hostaddr=127.0.0.1 port=5432 successfully initialized
./helpcovid[1945788]: ΔBG!hcv_background.cc:200▪ 00.06 s‣  hcv_start_background_thread did start hcv_bgthread of id 140435747223296
./helpcovid[1945788]: hcv_web.cc:564 -  !! Starting HelpCovid web server hcv_webserver@0x5608df8a70f0 with hcv_weburl=http://localhost:8089/ and 2 threads and 16777216 maximal payload
./helpcovid[1945788]: hcv_web.cc:577 -  !! weburl=http://localhost:8089/ listening on webhost=localhost webport=8089
./helpcovid[1945788]: ΔBG!hcv_web.cc:601▪ 00.06 s‣  hcv_webserver_run webport=8089 weburl= http://localhost:8089/
./helpcovid[1945788]: hcv_background.cc:65 -  !! hcv_background_thread_body starting thread hcovibg1945788
./helpcovid[1945788]: ΔBG!hcv_plugins.cc:189▪ 00.06 s‣  hcv_initialize_plugins_for_web starting with 0 plugins
./helpcovid[1945788]: ΔBG!hcv_web.cc:745▪ 08.18 s‣  register URL handling POST path '/register' req#1
./helpcovid[1945788]: ΔBG!hcv_views.cc:183▪ 08.18 s‣  hcv_register_view_post reqpath:/register req#1
 .. regtoken=
 .. firstname=
 .. lastname=
 .. phonestr=
 .. emailstr=
 .. cookiestr=
./helpcovid[1945788]: hcv_views.cc:193 -  !! hcv_register_view_post incomplete /register req#1
./helpcovid[1945788]: ΔBG!hcv_views.cc:209▪ 08.18 s‣  hcv_register_view_post reqpath:/register unimplemented; jsonres=
{
 "gitid" : "49b14649970eb99d9d44bf6eba0b088e9aed4146+",
 "unimplemented_cxx_file" : "hcv_views.cc",
 "unimplemented_cxx_function" : "hcv_expand_template_file",
 "unimplemented_cxx_line" : 205,
 "unimplemented_request_number" : 1,
 "unimplemented_request_path" : "/register"
}
./helpcovid[1945788]: ΔBG!hcv_web.cc:751▪ 08.18 s‣  register URL handling POST sending 277 bytes in response
./helpcovid[1945788]: ΔBG!hcv_background.cc:94▪ 16.52 s‣  hcv_background_thread_body:! timed-out #1 at 2020/Apr/03 14:43:21 MEST
./helpcovid[1945788]: ΔBG!hcv_background.cc:94▪ 32.99 s‣  hcv_background_thread_body:! timed-out #2 at 2020/Apr/03 14:43:37 MEST
 "unimplemented_cxx_line" : 205,  C-c C-c^C

Add Bootstrap assets

Suggest that we use the Bootstrap framework for the web page front-end -- it's comparatively simple to use to create a responsive design. Suggest that Web front-end assets (such as HTML, CSS, and JS) reside within an assets directory.

generate-config.py does not work

commit 6cba80b


rimski.x86_64 ~/helpcovid 9:48 .0 % ./generate-config.py 
Starting HelpCovid configuration generator...
See https://github.com/bstarynk/helpcovid and its README.md


 ==== HelpCovid web configuration =====

Enter web served URL, e.g. http://localhost:8089/ or https://example.com/

url: http://localhost:8089/
[url = http://localhost:8089/]
Enter web document root, a local directory containing web served resources (e.g. HTML files, CSS stylesheets)

root: /home/basile/helpcovid/webroot
[root = /home/basile/helpcovid/webroot]
Enter the OpenSSL public certificate, for HTTPS - can be left empty; see https://www.openssl.org/

sslcert: 
[sslcert = ]
Enter the OpenSSL private key, for HTTPS
sskey: 
[sskey = ]

 ==== HelpCovid PostGreSQL database configuration, see https://www.postgresql.org/ ====

Enter the PostGreSQL connnection string, see https://www.postgresql.org/docs/current/libpq-connect.html
connection: host=localhost port=5432 dbname=helpcovid_db
[connection = host=localhost port=5432 dbname=helpcovid_db]
Enter the HelpCovid PostgreSQL password file
passfile: /home/basile/helpcovid_dbpasswd
[passfile = /home/basile/helpcovid_dbpasswd]

Configuration file saved to /home/basile/.helpcovidrc]
Traceback (most recent call last):
  File "./generate-config.py", line 199, in <module>
    main()
  File "./generate-config.py", line 191, in main
    write_connection_keys(conn)
  File "./generate-config.py", line 117, in write_connection_keys
    config_dict['user'] = split[1]
IndexError: list index out of range

Show how to run as a service with Laurent Bercot's s6

Per https://unix.stackexchange.com/a/578832/5132 , after #32 is in place this can be run as an ad hoc, user level, service with Laurent Bercot's s6 and s6-networking tools. I didn't provide fully-fledged run and finish programs for this in the StackExchange answer.

This can then be documented in the readme:

Running as an s6 service

The files in the s6/ directory supplied here show (roughly) how to run helpcovid under Laurent Bercot's s6, with M. Bercot's s6-networking tools and M. Bercot's execline to glue it all together.
Unlike systemd and nosh, this does not require that a per-user service manager be in place.
It can also be used on operating systems with OpenRC or van Smoorenburg rc.

Simply place the files in a helpcovid directory, somewhere of your choice, and then invoke the supervisor to supervise them with s6-supervise ${SOMEWHERE}/helpcovid.

The IP address and port are configurable in the helpcovid/run script.
Environment variables, such as LC_ALL to set the locale, can be added with (for example) export LC_ALL fr_FR.UTF-8 in the same script.

To log, albeit somewhat crudely, redirect the output of s6-supervise through a pipe to s6-log pointing to some log directory that you create: s6-supervise ${SOMEWHERE}/helpcovid | s6-log ${SOMEWHERE}/helpcovid/log/main.
You can read the log in ${SOMEWHERE}/helpcovid/log/main/current and related files.
A less crude and more reliable form of logging is to set up a second, logging, service in ${SOMEWHERE}/helpcovid/log with its own run file that invokes s6-log, and run those under a (user level) s6-svscan.

This is a rough sketch, untested, of what the supplied s6/run file would have to contain:

#!/command/execlineb -PW
#Starynkevitch helpcovid
multisubstitute {
    define ADDRESS ::0
    define PORT 50002
    define WORKDIR /home/basile/dev/helpcovid/test
    define FLAGS ''
    define BACKLOG 2
}
fdmove -c 2 1
s6-tcpserver6-socketbind -b ${BACKLOG} -B ${ADDRESS} ${PORT} 
fdmove -c 3 0
export LISTEN_FDS 1
getpid LISTEN_PID
chdir ${WORKDIR}
/home/basile/dev/helpcovid/work/helpcovid ${FLAGS}

Enable the conventional LISTEN_FDS mechanism

Per https://unix.stackexchange.com/a/578832/5132 the program should be capable of taking the listening socket as an already open file descriptor set up by a service manager, e.g. a systemd socket unit with Accept=No, the nosh toolset, or even inetd in its wait mode. The former two examples support the LISTEN_FDS mechanism, which allow the program to know that this is happening and what file descriptor(s) are open listening socket file descriptors.

This unfortunately involves a change to the underlying http utility library, which (despite this being common practice because of inetd) does not apparently have a method for doing this.

The aforelinked StackExchange answer has my code for implementing the part of the LISTEN_FDS mechanism that the service program needs to have. There are other implementations available, not least the sd_listen_fds() function in libsystemd0, albeit that that is not portable.

Providing this functionality enables things addressed in further issues.

http://b-star-y.tech:8081 does not work (@ commit 1f550d67c4d662682c10358582e68c94cd2f0b6e)

When we attempt to run the HelpCovid server on http://b-star-y.tech:8081, either through make localtest0 or through ./helpcovid -D -T 2, the HelpCovid server starts and runs, but after some time aborts even when no GET or POST requests are made.

This is the output from the HelpCovid server:

abhishkt39@b-star-y:~/helpcovid$ make localtest0
./generate-timestamp.sh > __timestamp.c-tmp
'/tmp/helpcovid-11779.tar.gz' -> '/home/abhishkt39/tmp/helpcovid.tar.gz'
cp: cannot create regular file '/home/abhishkt39/tmp/helpcovid.tar.gz': No such file or directory
printf "const char hcv_cxx_compiler[]=\"%s\";\n" "$(ccache g++ --version | head -1)" >> __timestamp.c-tmp
mv --backup __timestamp.c-tmp __timestamp.c
ccache gcc    -c -o __timestamp.o __timestamp.c
ccache g++ -std=gnu++17 -O0 -g3  -Wall -Wextra  -pthread -I/usr/include/giomm-2.4 -I/usr/lib/x86_64-linux-gnu/giomm-2.4/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/jsoncpp -I/usr/include/postgresql -DHELPCOVID_GITID=\"ff185635fccb7451045406fbd17686cfdba4f245\" -rdynamic -pthread -L /usr/local/lib -L /usr/lib   hcv_web.o hcv_database.o  hcv_main.o  hcv_models.o  hcv_template.o hcv_background.o  hcv_views.o  __timestamp.o \
           -lgiomm-2.4 -lgio-2.0 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lsigc-2.0 -ljsoncpp -lpqxx -lssl -lcrypto -rdynamic -ldl -o helpcovid-tmp
mv --backup helpcovid-tmp helpcovid
mv --backup __timestamp.c __timestamp.c~
rm -f __timestamp.o
./helpcovid --debug --threads=3
./helpcovid[11841]: hcv_main.cc:474 -  !! parsed 3 program arguments
./helpcovid[11841]: hcv_main.cc:737 -  !! start of ./helpcovid
 version:github.com/bstarynk/helpcovid built Mon 30 Mar 2020 10:14:40 AM CEST
... gitcommit ff185635fccb Fix paths for chown and rm commands
... md5sum 528cdf29aba42bf68c47fb492bd57754 on b-star-y.tech
 at Mon Mar 30 10:14:42 2020 CEST on b-star-y.tech
./helpcovid[11841]: hcv_main.cc:527 -  !! loading configuration file /home/abhishkt39/.helpcovidrc
./helpcovid[11841]: hcv_main.cc:533 -  !! helpcovid loaded configuration file /home/abhishkt39/.helpcovidrc
./helpcovid[11841]: hcv_web.cc:73 -  !! hcv_initialize_web: weburl='http://b-stary-y.tech:8081/', webroot='/home/abhishkt39/helpcovid/webroot/', opensslcert='', opensslkey=''
./helpcovid[11841]: hcv_web.cc:108 -  !! starting plain HTTP server using weburl http://b-stary-y.tech:8081/ and webroot /home/abhishkt39/helpcovid/webroot/ hcv_webserver@0x563bfb58c380
./helpcovid[11841]: hcv_main.cc:811 -  !! helpcovid debugging enabled
./helpcovid[11841]: ΔBG!hcv_main.cc:812:00.00 s  helpcovid is debugging
./helpcovid[11841]: hcv_main.cc:858 -  !! helpcovid unable to write builtin pidfile /var/run/helpcovid.pid
-: Permission denied
./helpcovid[11841]: hcv_database.cc:113 -  !! using 'dbname=helpcovid_db user=helpcovid_usr password=_0sDpsn5BFCQ047pXr4 hostaddr=127.0.0.1 port=5432' as PostGreSQL connection string.
./helpcovid[11841]: hcv_database.cc:127 -  !! hcv_initialize_database connstr=dbname=helpcovid_db user=helpcovid_usr password=_0sDpsn5BFCQ047pXr4 hostaddr=127.0.0.1 port=5432
./helpcovid[11841]: hcv_database.cc:131 -  !! hcv_initialize_database for connstr=dbname=helpcovid_db user=helpcovid_usr password=_0sDpsn5BFCQ047pXr4 hostaddr=127.0.0.1 port=5432 hcv_dbconn is 0x563bfb58ca40
./helpcovid[11841]: hcv_database.cc:140 -  !! hcv_initialize_database got PostGreSQL version PostgreSQL 11.7 (Debian 11.7-0+deb10u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit(server version 11.7 (Debian 11.7-0+deb10u1))
./helpcovid[11841]: ΔBG!hcv_database.cc:216:00.01 s hcv_initialize_database before preparing statements in dbname=helpcovid_db user=helpcovid_usr password=_0sDpsn5BFCQ047pXr4 hostaddr=127.0.0.1 port=5432
./helpcovid[11841]: ΔBG!hcv_database.cc:244:00.01 s  preparing find_user_by_email_pstm
./helpcovid[11841]: ΔBG!hcv_database.cc:270:00.01 s  Registering prepared SQL statement user_create_pstm
./helpcovid[11841]: ΔBG!hcv_database.cc:270:00.01 s  Registering prepared SQL statement user_get_password_by_email_pstm
./helpcovid[11841]: hcv_database.cc:218 -  !! PostGreSQL database dbname=helpcovid_db user=helpcovid_usr password=_0sDpsn5BFCQ047pXr4 hostaddr=127.0.0.1 port=5432 successfully initialized
./helpcovid[11841]: ΔBG!hcv_background.cc:201:00.01 s hcv_start_background_thread did start hcv_bgthread of id 140200225543936
./helpcovid[11841]: hcv_web.cc:523 -  !! Starting HelpCovid web server hcv_webserver@0x563bfb58c380 with hcv_weburl=http://b-stary-y.tech:8081/ and 3 threads and 16777216 maximal payload
./helpcovid[11841]: hcv_web.cc:545 -  !! weburl=http://b-stary-y.tech:8081/ listening on webhost=b default webport=8080
./helpcovid[11841]: ΔBG!hcv_web.cc:557:00.01 s hcv_webserver_run webport=8080 weburl= http://b-stary-y.tech:8081/
./helpcovid[11841]: hcv_background.cc:65 -  !! hcv_background_thread_body starting thread hcovibg11841
./helpcovid[11841]: hcv_web.cc:680 -  !! end hcv_webserver_run webhost=b webport=8080
-: Resource temporarily unavailable
./helpcovid[11841]: hcv_main.cc:869 -  !! normal end of ./helpcovid
-: Resource temporarily unavailable
terminate called without an active exception
make: *** [Makefile:96: localtest0] Aborted 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.