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

Add Matrix Chat as Service With Element WebUI #4444

Closed
wants to merge 13 commits into from

Conversation

elmatadoor
Copy link

@elmatadoor elmatadoor commented Nov 30, 2024

Changes

Add Matrix Chat as Service With Element WebUI
The matrix.org server is working, but the homeserver needs proper setup in the homeserver.yaml file.
Here is The Install Docs [Install_With_Docker_Compose]

@peaklabs-dev peaklabs-dev added the ⚙️ Service Issues requesting or PRs adding/fixing service templates. label Nov 30, 2024
@peaklabs-dev
Copy link
Member

This template is not yet completed I think because there is no port and no way to access the service over a domain is this intended? Please use the Coolify Magic to make this work: https://coolify.io/docs/knowledge-base/docker/compose#coolifys-magic-environment-variables

@peaklabs-dev peaklabs-dev added the 💤 Waiting for changes PRs awaiting changes from the author. label Dec 2, 2024
@elmatadoor
Copy link
Author

elmatadoor commented Dec 2, 2024

This template is not yet completed I think because there is no port and no way to access the service over a domain is this intended? Please use the Coolify Magic to make this work: https://coolify.io/docs/knowledge-base/docker/compose#coolifys-magic-environment-variables

it is working on my side ; the code part respensible to generate a domain is :

element:
- SERVICE_FQDN_ELEMENT <====

i dont know if i miss somme thing but for sur the PR need Manual Check and Fix ; it require to add Health check and fix the homeserver.yaml to be able to run our own homeserver here is the log :

config file '/data/homeserver.yaml' does not exist. You should either create a new config file by running with the generate argument ....................

this cane be genberated with this command :

docker run --rm -e SYNAPSE_SERVER_NAME=element-pww48cockwcwwg4k4sw08w4c.yourdomain -e SYNAPSE_REPORT_STATS=no -v /var/lib/docker/volumes/pww48cockwcwwg4k4sw08w4c_synapse-data/_data:/data matrixdotorg/synapse:v1.84.1 generate

and it can be edited using :

nano /var/lib/docker/volumes/pww48cockwcwwg4k4sw08w4c_synapse-data/_data/homeserver.yaml

if any one can test and help me with this fix
HERE is The Install Guide That Work with docker-compose that i have edit and delete traefik and nginx and add somme magic constants to be compatible with coolify

@peaklabs-dev
Copy link
Member

Thanks it looks better now as you said the healthchecks are missing and not sure what you mean by homeserver.yaml but these steps should be automated if possible inside the compose file or if not possible via docs.

@elmatadoor
Copy link
Author

Thanks it looks better now as you said the healthchecks are missing and not sure what you mean by homeserver.yaml but these steps should be automated if possible inside the compose file or if not possible via docs.

matrix.org is a decentralised communication platforme ; you can create an account on the main network called [matrix.org] or you can be the owner of the data by editing the homeserver.yaml to save all app data in your local server
take a look here
https://prnt.sc/vK-rEHf6ko3M
https://prnt.sc/Vqt-PULMTH9B

Copy link
Member

@peaklabs-dev peaklabs-dev left a comment

Choose a reason for hiding this comment

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

Please make the changes in my comments and also add healthchecks to each container.

templates/compose/matrix-element.yml Outdated Show resolved Hide resolved
templates/compose/matrix-element.yml Outdated Show resolved Hide resolved
templates/compose/matrix-element.yml Outdated Show resolved Hide resolved
templates/compose/matrix-element.yml Outdated Show resolved Hide resolved
@peaklabs-dev peaklabs-dev self-assigned this Dec 3, 2024
@elmatadoor
Copy link
Author

elmatadoor commented Dec 3, 2024

@peaklabs-dev , i have make somme changes , not sure if they follow the coolify standard , please take a look and let me know if any thing to fix ,
you can test the template it is working but need a mechanisme to run this command to be able to use the home server else you can just create acount on the [matrix.org] network and the container is unhealthy but the webUI is working :
[docker run --rm -e SYNAPSE_SERVER_NAME=element-xxx.yourdomain -e SYNAPSE_REPORT_STATS=no -v /var/lib/docker/volumes/xxx_synapse-data/_data:/data matrixdotorg/synapse:v1.84.1 generate]

@peaklabs-dev
Copy link
Member

You can take a look at this example https://github.com/coollabsio/coolify/blob/main/templates/compose/nextcloud-with-postgres.yaml where you can see healthchecks and so on, also you should use an entrypoint script or command to execute the command so it is automated as much as possible.

@luckydonald
Copy link
Contributor

How would one supply a entrypoint script?
Entry in volumes: with content set to something?

@elmatadoor
Copy link
Author

How would one supply a entrypoint script? Entry in volumes: with content set to something?

what do ypu mean bro ?

@luckydonald
Copy link
Contributor

@librelol
Copy link
Contributor

librelol commented Dec 9, 2024

Would be lovely to see this in production. I've taken a crack at it but haven't seen anything production worthy.

@elmatadoor
Copy link
Author

elmatadoor commented Dec 10, 2024

we have add somme editing and the entrypoint as well to generate the config file ; the service in general is working on coolify but for somme reason generating config file for the homeserver.yaml on the fly is not working ; i generate it manualy by running the command i just montion in top comment here is the oficiel docker image with guides : DOCKER HUB

@elmatadoor
Copy link
Author

elmatadoor commented Dec 21, 2024

Step 1: Generate the homeserver.yaml file

Run the following command to generate the homeserver.yaml file in your Docker container's data directory:

docker run --rm -e SYNAPSE_SERVER_NAME=matrix-b48owg0cwsg0cssoksosw88c.yourdomain \
  -e SYNAPSE_REPORT_STATS=no \
  -v /var/lib/docker/volumes/b48owg0cwsg0cssoksosw88c_synapse-data/_data:/data \
  matrixdotorg/synapse:v1.84.1 generate

This command will create the necessary configuration file for your Synapse server.


Step 2: Edit the homeserver.yaml file to enable registration

After generating the homeserver.yaml file, you need to enable registration on your server. To do this:

  1. Open the homeserver.yaml file using a text editor:
nano /var/lib/docker/volumes/b48owg0cwsg0cssoksosw88c_synapse-data/_data/homeserver.yaml
  1. Scroll to the bottom of the file and add the following two lines:
enable_registration: true
enable_registration_without_verification: true

Then Navigate To [https://element-b48owg0cwsg0cssoksosw88c.yourdomain] Click On Create account Then Click Edit To Change The Server From [Matrix.Org] To [https://matrix-b48owg0cwsg0cssoksosw88c.yourdomain]


Important Update
Manual Generation of homeserver.yaml
Please note : Generating the homeserver.yaml file automatically through the Docker Compose file is no longer supported. Instead, you will need to manually generate the configuration file.
How to Manually Generate homeserver.yaml
To generate the homeserver.yaml file for your Synapse server, follow these steps:

  1. Run the following command to manually generate the configuration file:
docker run --rm -e SYNAPSE_SERVER_NAME=matrix-b48owg0cwsg0cssoksosw88c.yourdomain \
  -e SYNAPSE_REPORT_STATS=no \
  -v /var/lib/docker/volumes/b48owg0cwsg0cssoksosw88c_synapse-data/_data:/data \
  matrixdotorg/synapse:v1.84.1 generate

This will generate the homeserver.yaml file in your Docker container's data directory.

  1. After generation , you can proceed with configuring your server manually, including enabling registration.

Alternative Option: Use the Matrix.org Server

If you don’t wish to manually generate the homeserver.yaml file, you can still use the Matrix.org public server for your communications, as it provides ready-to-use configuration without the need for local setup.


@peaklabs-dev peaklabs-dev removed the 💤 Waiting for changes PRs awaiting changes from the author. label Dec 23, 2024
Copy link
Member

@peaklabs-dev peaklabs-dev left a comment

Choose a reason for hiding this comment

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

Please also add healthchecks to element, coturn and postgres (the db)

templates/compose/matrix.yaml Outdated Show resolved Hide resolved
templates/compose/matrix.yaml Outdated Show resolved Hide resolved
volumes:
- synapse_data:/data
depends_on:
- synapse_db
Copy link
Member

Choose a reason for hiding this comment

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

Add healthy check here:

depends_on:
      synapse_db:
        condition: service_healthy

Copy link
Author

Choose a reason for hiding this comment

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

Editing done
what else should i fix

Copy link
Member

Choose a reason for hiding this comment

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

Now each container just needs a depends_on: and a healthcheck: section with working healthcheks so it all starts up properly.

Copy link
Author

Choose a reason for hiding this comment

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

Please send me a pastbin file on how it should look like and i will do it

Copy link
Member

Choose a reason for hiding this comment

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

You can check this for an example healthcheck:

healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10

@peaklabs-dev peaklabs-dev added the 💤 Waiting for changes PRs awaiting changes from the author. label Jan 6, 2025
@peaklabs-dev
Copy link
Member

Thank you for your contribution. Due to inactivity, we're closing this PR. If you'd like to revisit this change, feel free to reopen this PR or open a new pull request.

@github-actions github-actions bot removed ⚙️ Service Issues requesting or PRs adding/fixing service templates. 💤 Waiting for changes PRs awaiting changes from the author. labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants