Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isso: module & init at 0.9.10 WIP #13587

Closed
wants to merge 5 commits into from
Closed

Conversation

Profpatsch
Copy link
Member

isso commenting server

not sure if the way I handle misaka 1&2 is the way to go @garbas

cc @aszlig (spacing. :) )

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @edolstra, @joachifm and @offlinehacker to be potential reviewers

@aszlig
Copy link
Member

aszlig commented Mar 1, 2016

Feel free to add Cc: @aszlig - nitpick in future PRs if you want even more nitpicking (I could nitpick at even more here as well, for example on the missing commit message :goberserk:, but I'll stop now), the whitespace thing was just because it immediately sprang into my eyes :-D

@aszlig
Copy link
Member

aszlig commented Mar 2, 2016

Cc: @edolstra because of the addition of a new function in lib/attrsets.nix.

lib/attrsets.nix Outdated
@@ -43,6 +44,16 @@ rec {
[ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ];


/* Map function f over the value of the attribute described by attrPath.
For instance, mapAttrByPath [ "x" "y" ] (a: a+1) { x.y = 1; } returns
{ x.y = 2; }. If the path doesn’t exist the default value is used. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to be from this description what is being mapped. That suggests that multiple values are updated, but the example suggests only the specified attribute (x.y) is updated. And what is the recursiveUpdate for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the implementation in the newest version, according to aszlig’s input.

Do you think we should rename that function? I can’t think of another word but map. But I will change the docstring to start with “Apply function …”.

and implement updateAttrByPath with it. The previous version with
recursiveUpdate went over the whole attrset, even though only one
element needs to be touched.
Thanks @aszlig for the input and the initial setAttrInSetByPath
implementation, which was refined later.

Adds tests for both functions.
@Profpatsch
Copy link
Member Author

I renamed the functions to setAttrInSetByPath and updateAttrByPath @edolstra.

I also added tests and fixed errors with certain inputs for the set function (gah, dynamically typed languages ;) ).

@Profpatsch Profpatsch changed the title isso: module & init at 0.9.10 isso: module & init at 0.9.10 WIP Mar 3, 2016
@davidak
Copy link
Member

davidak commented Jul 17, 2016

i would like to use isso on nixos, so i tested this PR:

https://github.com/davidak/nixos-config/blob/d1fcef16470c567245fcb480c55f980b59bfc208/binary/configuration.nix#L129

it got installed, configuration got created and the service started, but with errors.

Traceback (most recent call last):
  File "/nix/store/iihfxv3fi5i2z8arsr8b1kgp2q399x6f-python2.7-isso-0.9.10/bin/.isso-wrapped", line 12, in <module>
    sys.exit(main())
  File "/nix/store/iihfxv3fi5i2z8arsr8b1kgp2q399x6f-python2.7-isso-0.9.10/lib/python2.7/site-packages/isso/__init__.py", line 271, in main
    wsgi.SocketHTTPServer(sock, make_app(conf)).serve_forever()
  File "/nix/store/iihfxv3fi5i2z8arsr8b1kgp2q399x6f-python2.7-isso-0.9.10/lib/python2.7/site-packages/isso/wsgi.py", line 203, in __init__
    HTTPServer.__init__(self, sock, SocketWSGIRequestHandler)
  File "/nix/store/awbf3jh262m1k16hxgbgngdmxv66gd79-python-2.7.11/lib/python2.7/SocketServer.py", line 420, in __init__
    self.server_bind()
  File "/nix/store/awbf3jh262m1k16hxgbgngdmxv66gd79-python-2.7.11/lib/python2.7/BaseHTTPServer.py", line 110, in server_bind
    self.server_name = socket.getfqdn(host)
  File "/nix/store/awbf3jh262m1k16hxgbgngdmxv66gd79-python-2.7.11/lib/python2.7/socket.py", line 141, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
TypeError: must be string without null bytes, not str

that might be related to #1248 but it also don't work with a workaround.

@Profpatsch
Copy link
Member Author

@davidak Does this work when you put it into a container, like so:

containers.isso.config = ./isso-test.nix;

and then start it like

sudo systemctl restart container@isso
sudo journalctl -M isso

@davidak
Copy link
Member

davidak commented Jul 17, 2016

@Profpatsch yes.

bildschirmfoto 2016-07-17 um 16 42 59

(only some Umlauts are broken in issos interface)

After a restart are the comments gone, also every second restart fails.

[root@binary:~]# systemctl status container@isso.service
● container@isso.service - Container 'isso'
   Loaded: loaded (/nix/store/wssay3nkwsbqw7vr5w4dhgh9bldhzy23-unit-container-.service/container@.service; bad; vendor preset: enabled)
   Active: inactive (dead)

Jul 17 16:55:42 binary systemd[1]: container@isso.service: Main process exited, code=exited, status=1/FAILURE
Jul 17 16:55:42 binary container isso[16360]: cat: /run/containers/isso.pid: No such file or directory
Jul 17 16:55:42 binary systemd[1]: container@isso.service: Control process exited, code=exited status=1
Jul 17 16:55:42 binary systemd[1]: Failed to start Container 'isso'.
Jul 17 16:55:42 binary systemd[1]: container@isso.service: Unit entered failed state.
Jul 17 16:55:42 binary systemd[1]: container@isso.service: Failed with result 'exit-code'.
Jul 17 16:55:42 binary systemd[1]: container@isso.service: Service hold-off time over, scheduling restart.
Jul 17 16:55:42 binary systemd[1]: Stopped Container 'isso'.
Jul 17 16:55:42 binary systemd[1]: container@isso.service: Start request repeated too quickly.
Jul 17 16:55:42 binary systemd[1]: Failed to start Container 'isso'.

@davidak
Copy link
Member

davidak commented Jul 17, 2016

The Umlauts are fine when i use it in Nikola, maybe an encoding problem in your simple example website.

Your config works also without the container and then the comments are persistent and every restart works!

The difference of our configs is:

your working config:

      otherConfig = {
        server.listen = "http://localhost:9001";
      };

my try:

otherConfig = { server = { listen = "localhost:9090"; }; };

the error was the missing http://!

please change that in the example of the module:
Example: { general = { log-file = "/var/lib/isso/isso.log"; } ; server = { listen = "localhost:8080"; } ; }

my whole config: davidak/nixos-config@c8b6443

@Profpatsch
Copy link
Member Author

After a restart are the comments gone, also every second restart fails.

The example page doesn’t specify an encoding, as you can see in the code

please change that in the example of the module:
Example: { general = { log-file = "/var/lib/isso/isso.log"; } ; server = { listen = "localhost:8080"; } ; }

Hm, interesting. I used http:// in the test as well. But it shouldn’t be necessary imo.

@davidak
Copy link
Member

davidak commented Jul 18, 2016

But it shouldn’t be necessary imo.

have you tested it?

then resolve the merge conflicts and get it merged.

next step would be to use a WSGI Server like gunicorn for production use. the developer's choice is uWSGI but the debian package uses gunicorn. it is simpler to configure and has also a good performance. should be good most users.

https://posativ.org/isso/docs/extras/deployment/
https://github.com/jgraichen/debian-isso/blob/master/debian/isso.service
https://sicherheitskritisch.de/2015/04/sichere-installation-und-konfiguration-des-kommentarsystems-isso-auf-debian/

@Profpatsch
Copy link
Member Author

then resolve the merge conflicts and get it merged.

All in due time. It’s a work in progress, after all. Except if you’d like to help me. There’s a few tests to be written. :)

@davidak
Copy link
Member

davidak commented Aug 1, 2016

@Profpatsch How could i help? I haven't written module tests by now and don't know what you have in mind. So it might be more effective when you do that. Do you think you find some time in the near future?

@Profpatsch
Copy link
Member Author

Profpatsch commented Aug 1, 2016

I haven't written module tests by now and don't know what you have in mind.

I haven’t either. :)
What I want are some automatic VM tests that check if the service works from a very high level. As in checking the actual output of a test website, by posting a comment and then grepping the site output for the content of that comment. That way the maintainer is immediately notified if the service breaks.

Do you think you find some time in the near future?

This Saturday/Sunday at the earliest.

The merge conflicts are only because the gid/pid needs to be adjusted btw.

@davidak
Copy link
Member

davidak commented Aug 27, 2016

  • general.dbpath don't get added into the config, the database don't get created, all comments are lost after restarting the service
  • import created /tmp/isso.db but the service don't loads it
  • general.notify also don't land in the config
  • the current version of Isso is 0.10.4, this is 0.9.10
  • there is a newline after each config line:
[general]
host = davidak.binary.lan.davidak.de
 davidak.de


[guard]
direct-reply = 3

enabled = true

ratelimit = 2

reply-to-self = false


@matthiasbeyer
Copy link
Contributor

I guess this has stalled.

@Profpatsch
Copy link
Member Author

Yeah, it’s pretty low on my priority list right now.

@davidak
Copy link
Member

davidak commented Jan 31, 2017

@Profpatsch sadly i had also no time to look into this. i have planned to deploy my new website without comments first next month (what is tomorrow :)). so i can make progress and fix small things like that later.

@Profpatsch
Copy link
Member Author

I actually planned on using isso as commenting server for audio files (soundcloud-like), but that’s a very far-off project right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants