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

Is it necessary to add configurations in haproxy.conf? #27

Open
matiasAS opened this issue Nov 28, 2023 · 14 comments
Open

Is it necessary to add configurations in haproxy.conf? #27

matiasAS opened this issue Nov 28, 2023 · 14 comments

Comments

@matiasAS
Copy link

matiasAS commented Nov 28, 2023

I do not understand this:

<yourdomain.com>: IP address / hostname of open-balena-haproxy
api.<yourdomain.com>: IP address / hostname of open-balena-haproxy
registry.<yourdomain.com>: IP address / hostname of open-balena-haproxy
vpn.<yourdomain.com>: IP address / hostname of open-balena-haproxy
s3.<yourdomain.com>: IP address / hostname of open-balena-haproxy
tunnel.<yourdomain.com>: IP address / hostname of open-balena-haproxy
admin.<yourdomain.com>: IP address / hostname of open-balena-ui, or open-balena-admin-haproxy if using K8S ingress
dashboard.<yourdomain.com>: IP address / hostname of open-balena-ui, or open-balena-admin-haproxy if using K8S ingress
postgrest.<yourdomain.com>: IP address / hostname of open-balena-postgrest, or open-balena-admin-haproxy if using K8S ingress
remote.<yourdomain.com>: IP address / hostname of open-balena-remote, or open-balena-admin-haproxy if using K8S ingress

Do I have to add configurations to open-balena's haproxy.conf? If so, can you give me the complete haproxy.conf file?

If I enter admin. it results in error 503

Regards
Matias

@matiasAS matiasAS changed the title haproxy.conf Is it necessary to add configurations in haproxy.conf? Nov 28, 2023
@dcaputo-harmoni
Copy link
Owner

No, you just need to set your dns settings on your hosting provider to point to those ip address / hostnames, which need to be publicly exposed.

@matiasAS
Copy link
Author

@dcaputo-harmoni as this:

image

results:
image
image

@matiasAS
Copy link
Author

@dcaputo-harmoni logs of openbalena-admin-postgrest-1 servuce;

28/Nov/2023:19:10:43 +0000: Attempting to reconnect to the database in 32 seconds...
28/Nov/2023:19:11:15 +0000: {"details":"invalid integer value "[email protected]:5432" for connection option "port"\n","code":"","message":"Database connection error. Retrying the connection."}

Regards

@dcaputo-harmoni
Copy link
Owner

Just to confirm - there should be two haproxy instances in your environment, one for open-balena and one for open-balena-admin. The admin related domain names (admin, dashboard, postgrest, remote) should all be pointing to the open-balena-admin haproxy instance's public IP address / fqdn.

@matiasAS
Copy link
Author

@dcaputo-harmoni I only have 1 instance of haproxy according to this:

image

@matiasAS
Copy link
Author

@dcaputo-harmoni
The service.yml file had the network defined twice and I had to modify it because I got an error:

version: "2.0"

services:
ui:
#docker exec -it y ejecutar npx update-browserslist-db@latest
extends:
file: ./common.yml
service: component
image: harmonidcaputo/open-balena-ui:${OPENBALENA_UI_VERSION_TAG}
depends_on:
- postgrest
- remote
environment:
PORT: 8080
OPEN_BALENA_JWT_SECRET: ${OPENBALENA_JWT_SECRET}
OPEN_BALENA_S3_URL: https://s3.${OPENBALENA_HOST_NAME}
OPEN_BALENA_S3_ACCESS_KEY: ${OPENBALENA_S3_ACCESS_KEY}
OPEN_BALENA_S3_SECRET_KEY: ${OPENBALENA_S3_SECRET_KEY}
REACT_APP_OPEN_BALENA_UI_URL: http://admin.${OPENBALENA_HOST_NAME}:8080
REACT_APP_OPEN_BALENA_POSTGREST_URL: http://postgrest.${OPENBALENA_HOST_NAME}:8000
REACT_APP_OPEN_BALENA_REMOTE_URL: http://remote.${OPENBALENA_HOST_NAME}:10000
REACT_APP_OPEN_BALENA_API_URL: https://api.${OPENBALENA_HOST_NAME}
REACT_APP_OPEN_BALENA_API_VERSION: ${OPENBALENA_API_VERSION_TAG}
ports:
- "8080:8080"
networks:
openbalena_default:
aliases:
- admin.${OPENBALENA_HOST_NAME}

remote:
extends:
file: ./common.yml
service: component
image: harmonidcaputo/open-balena-remote:${OPENBALENA_REMOTE_VERSION_TAG}
environment:
BALENARC_BALENA_URL: ${OPENBALENA_HOST_NAME}
HOST_MODE: ${OPENBALENA_ADMIN_HOST_MODE}
ports:
- "10000:10000"
- "10001:10001"
- "10002:10002"
- "10003:10003"
- "10004:10004"
- "10005:10005"
- "10006:10006"
- "10007:10007"
- "10008:10008"
- "10009:10009"
networks:
openbalena_default:
aliases:
- remote.${OPENBALENA_HOST_NAME}

postgrest:
extends:
file: ./common.yml
service: component
image: harmonidcaputo/open-balena-postgrest:${OPENBALENA_POSTGREST_VERSION_TAG}
environment:
PGRST_DB_URI: postgres://${OPENBALENA_DB_USERNAME}:${OPENBALENA_DB_PASSWORD}@db.${OPENBALENA_HOST_NAME}:${OPENBALENA_DB_PORT}/resin
PGRST_JWT_SECRET: ${OPENBALENA_JWT_SECRET}
ports:
- "8000:8000"
networks:
openbalena_default:
aliases:
- postgrest.${OPENBALENA_HOST_NAME}

networks:
openbalena_default:
external: true

Also in the compose file change "docker-compose" to "docker compose" (remove the -)

It is the only thing that changes after doing the git clone of the repository

Openbalena and openbalena admin are on the same server

@dcaputo-harmoni
Copy link
Owner

If you aren't using a second haproxy instance, you will need to either reconfigure your existing haproxy instance to route to those containers based on the hostnames (i.e. remote.xyc.com goes to the open-balena-remote container) or make sure the open-balena-admin services each have their own public IP, and point the hostnames at those IP addresses.

@matiasAS
Copy link
Author

@dcaputo-harmoni

That's what I said at the beginning, and why don't I have another instance of haproxy?

Can you give me the new updated haproxy.cfg file please?...or add it to the repository

@matiasAS
Copy link
Author

@dcaputo-harmoni

or the other thing is that you add the haproxy service to docker compose.....so that everything works well, and there are no errors with other users of the openbalena community

@dcaputo-harmoni
Copy link
Owner

Everyone's networking setup is different (i.e. some people have multiple public IPs whcih would allow for multiple haproxy instances, others have one which would need it integrated with the open-balena instance, etc.), so it's hard to create a one-size-fits-all approach to this. I'd be interested in any solution you have; feel free to send in a PR to the repo and I will review. Just note that it should be generic enough to cover a wide range of setups. Because open-balena-admin is meant to run alongside open-balena, but doesn't actually modify anything within open-balena, including the open-balena-haproxy instance. So if you want to integrate it into the open-balena-haproxy instance, you would need to manually modify that config. A cleaner way to deploy all of this is to k8s using the helm scripts, which are linked in the main README page of the repo. This has all of the required configurations baked in, but obviously is a higher level of complexity than a traditional docker compose.

@matiasAS
Copy link
Author

@dcaputo-harmoni

For me the unclear step to run openbalena-admin according to the readme is the definition of the domains:

<yourdomain.com>: IP address / hostname of open-balena-haproxy
api.<yourdomain.com>: IP address / hostname of open-balena-haproxy
registry.<yourdomain.com>: IP address / hostname of open-balena-haproxy
vpn.<yourdomain.com>: IP address / hostname of open-balena-haproxy
s3.<yourdomain.com>: IP address / hostname of open-balena-haproxy
tunnel.<yourdomain.com>: IP address / hostname of open-balena-haproxy
admin.<yourdomain.com>: IP address / hostname of open-balena-ui, or open-balena-admin-haproxy if using K8S ingress
dashboard.<yourdomain.com>: IP address / hostname of open-balena-ui, or open-balena-admin-haproxy if using K8S ingress
postgrest.<yourdomain.com>: IP address / hostname of open-balena-postgrest, or open-balena-admin-haproxy if using K8S ingress
remote.<yourdomain.com>: IP address / hostname of open-balena-remote, or open-balena-admin-haproxy if using K8S ingress

what I understand about that is to add the dns of each subdomain in my case in cloudflare and then run

open-balena-admin/scripts/quickstart -j [OPENBALENA_JWT_SECRET] -v [OPENBALENA_API_VERSION_TAG]

and

open-balena/scripts/compose up -d

If you have to modify haproxy.cfg of open-balena, a generic way that I would do would be to have the complete harpoxy.cfg in the repository (open-balena + open-balena-admin) to replace the haproxy.cfg and everything works.

With the changes indicated above that I made it still doesn't work, and I ask you because I honestly don't know what I need to add for everything to work well.

Do you speak Spanish?

@dcaputo-harmoni
Copy link
Owner

I'm sorry but I'm not able to support the docker-compose environment, we are using it in k8s and it works fine with the helm scripts. I know that others who have posted here have got it working with docker-compose so perhaps they can help you.

@matiasAS
Copy link
Author

@dcaputo-harmoni

Can you give me the detailed step by step to execute everything using helm?

@matiasAS
Copy link
Author

@dcaputo-harmoni

From what I see, is it changing everything or not? In that case, I prefer not to touch what already works.

Who has implemented it with docker compose?

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

No branches or pull requests

2 participants