↓ Skip to main content

Comment System Now Works With Email Logins

··1115 words·6 mins

Introduction
#

So I decided to work on the remark42 comments system. First you could login without any email or signing up required and i wanted to change that. Not only so i could knew who would comment but also to prevent any bot or troll accounts from littering the comments. The blog is not that popular but who knows what the future may bring.

Mailbox.org
#

So also to depend less on Gmail and bigtech mail providers, i signed up for Mailbox.org. They are an independent privacy and consumer focussed mail provider. I signed up for the premium plan which is 9 Euro a month, not as cheapas i thought but 9 euro is a worthy investment as with free services, you, the user are often the product. And also the premium plan comes with SMTP (Simple Mail transfer protocol) which i need to implement the comment system where you first verify your email by getting a token and then are allowed to comment. Also i can then as an Admin know when someone has left a comment or if someone reacted to a comment by another user. It also allows creating aliases so i can for example have noreply@309electronics.net or notify@309electronics.net. I will also use this mail service to later setup a newsletter mechanism that users can signup for (opt-in so no forcing) so they can get notified if i post a new blogpost and i can send community notices or inform when major downtime is to be expected. So they can be up to date about everything.

Configuring everything
#

So first i ofcourse signed for the mailbox.org. Then i had to set some dns related stuff for my mailbox.org in my domain and dns provider so it could talk to the outside world and properly resolve. The mailbox.org documentation has great instructions on that.

After that i could modify the existing docker compose file and take down the old container and start the new container.

Docker
#

So like the website, likes-api and cdn, the comments-api is also hosted in a proxmox LXC. It makes use of the docker image of remark42 and the docker-compose.yml is used to define the settings. Previously my old docker-compose.yml looked a bit like below.

services:
  remark42:
    image: ghcr.io/umputun/remark42:latest
    container_name: "remark42"
    hostname: "remark42"
    restart: always

    ports:
      - "8080:8080"

    environment:
      - REMARK_URL=https://comments-api.309electronics.net
      - SITE=blog.309electronics.net
      #- ALLOWED_HOSTS=localhost:1313 blog.309electronics.net
      - DEBUG=true
      - SECRET=yourverysecuresecret
      - STORE_BOLT_PATH=/srv/var/db
      - BACKUP_PATH=/srv/var/backup
      - EMOJI=true
      - AUTH_ANON=true
      - AUTH_EMAIL_ENABLE=true
     # - AUTH_EMAIL_FROM=noreply@309electronics.net
      - NOTIFY_USERS=none
     # - AUTH_GITHUB_CID=your-github-cid
     # - AUTH_GITHUB_CSEC=your-github-secret
     # - AUTH_GOOGLE_CID=your-google-cid
     # - AUTH_GOOGLE_CSEC=your-google-secret
     # - SMTP_HOST=smtp.foobarmail.org
     # - SMTP_PORT=465
     # - SMTP_TLS=true
     # - SMTP_USERNAME=yoursmtpemail
     # - SMTP_PASSWORD=yourepicpassword_foobar
     # - AUTH_EMAIL_FROM=your-auth-user@example.com
     # - NOTIFY_USERS=email
     # - NOTIFY_ADMINS=email
     # - AUTH_EMAIL_ENABLE=true
     # - NOTIFY_EMAIL_FROM=your-notify-user@example.com
     # - ADMIN_SHARED_EMAIL=your-admin-user@example.net
     # - ADMIN_SHARED_ID=your-admin-shared-id (See notes below)

    volumes:
      - ./data:/srv/var
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "5"

I still have it on the server backed up as docker-compose.yml.bak.old.

I modified it to be like down below (ofcourse with secret stuff redacted to protect my privacy and to avoid my data leaking any more).

services:
  remark42:
    image: ghcr.io/umputun/remark42:latest
    container_name: "remark42"
    hostname: "remark42"
    restart: always

    ports:
      - "8080:8080"

    environment:
      - REMARK_URL=https://comments-api.309electronics.net
      - SITE=blog.309electronics.net
     # - ALLOWED_HOSTS=localhost:1313 blog.309electronics.net
      - DEBUG=true
      - SECRET=yourepicsecret
      - STORE_BOLT_PATH=/srv/var/db
      - BACKUP_PATH=/srv/var/backup
      - EMOJI=true
      - AUTH_ANON=false
      - AUTH_EMAIL_ENABLE=true
      - AUTH_EMAIL_FROM=noreply@309electronics.net
      - AUTH_EMAIL_SUBJ=Verify your login, to post your comment on blog.309electronics.net
      - SMTP_HOST=smtp.mailbox.org
      - SMTP_PORT=465
      - SMTP_TLS=true
      - SMTP_USERNAME=yourmailboxusername
      - SMTP_PASSWORD=yourmailboxpassword
      - NOTIFY_USERS=email
      - NOTIFY_ADMINS=email     
      - NOTIFY_EMAIL_FROM=notify@309electronics.net
      - ADMIN_SHARED_EMAIL=webmaster@foobar.com
      - ADMIN_SHARED_ID=your-admin-shared-id 

    volumes:
      - ./data:/srv/var
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "5"

And thats it. I took down the container and started it up again and it works! My test comments are on the Its always DNS article. I get notified as an admin when a new comment is added and i also see the content of the comment.

Also i added my webmaster@309electronics.net account as an Admin by specifying it under admin_shared_id. This means i can now log into my admin account and moderate the chat. I can pin comments of interest/importance and i can ban or hide comments that break the rules. I moderate in a ethical way and I’ll always give you a second chance to edit/remove and rewrite your comment if you break any rules, but i wont give you a third/fourth chance so please take it as a gift. I dont like banning people or removing/hiding comments but plain hate speech and or spam will be hidden and you wil receive an email from me about your comment and what rule(s) you broke with the message that you got a 2nd chance to fix your mistake as we ar all human and some space to make mistakes (could just be that you accidentally vented your bad day energy into my blog’s comments). Alternatively look at the rules page down below in the footer of the page to see what i set up as rules. They are not meant to lock down, but more are meant to keep things at peace.

Please note, if you want to be a moderator/co-admin, i almost never add people their ids to the admin’s list on the comments system. This is not because i dont want you to moderate my chat but its also because then i have full control over the website as i host it myself and its my own product, that i decide to share to the public and i sadly have met a couple cases where people would ask me to make them moderator, only for them to misuse their moderator status or use it for bad things. Unless you are someone i know in person (friends or family or related) i wont make exceptions. Sorry!

Signing off.
#

SO yeah it was a quick and easy setup and i completed it yeseterday night. I am now writing this post from school/university as i did not write the post yesterday as i was tired and i had to get up early to go to school. I will slowly ditch google wherever i can and feel comfortable. Because i dont like apple, i dont have a choice for my phone at the moment but maybe i switch to graphene OS in the future or hope True Linux phones are going to be succesfull. Would be cool if framework made a consumer focussed phone with privacy but at the moment they are too small in the market. But framework and steam are some of the lesser evil companies todays that dont try to rob consumers from either their money, data or consumer rights. I belive mailbox.org is german based so also more european tech but i am not that biased towards american made tech.

Author
309Electronics