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

feat: simplify deployment with nginx #36

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

veryCrunchy
Copy link
Contributor

@veryCrunchy veryCrunchy commented Sep 20, 2024

This PR fixes:

Resolves #2
Resolves #3
Resolves #6
Resolves #11
Resolves #15
Resolves #21
Resolves #27

Note

love with livekit will be implemented in a separate pr after this one has been merged

@veryCrunchy veryCrunchy marked this pull request as draft September 20, 2024 02:11
nginx/setup.sh Outdated Show resolved Hide resolved
nginx/setup.sh Outdated Show resolved Hide resolved
@veryCrunchy
Copy link
Contributor Author

@aonnikov you beat me to it, most of the fixes you just pushed I have laying unpushed on my machine 😅
It would have been nice to get a co-author on your commit, considering the issue was initially raised by me and has been fixed in this PR.

@aonnikov
Copy link
Member

@aonnikov you beat me to it, most of the fixes you just pushed I have laying unpushed on my machine 😅 It would have been nice to get a co-author on your commit, considering the issue was initially raised by me and has been fixed in this PR.

Fair enough, added you as a co-author (know, it is dirty but better than nothing). Much appreciate your contribution!

@veryCrunchy
Copy link
Contributor Author

@aonnikov there are a lot of duplicate env variables set in the compose.yml, LAST_NAME_FIRST under transactor for example.
Are they really all used?

@veryCrunchy
Copy link
Contributor Author

Finally achieved a working huly instance!!
image

@aonnikov
Copy link
Member

@aonnikov there are a lot of duplicate env variables set in the compose.yml, LAST_NAME_FIRST under transactor for example. Are they really all used?

Yeah, all of them are used, but some of them are not mandatory and can be omitted.

setup.sh Outdated Show resolved Hide resolved
setup.sh Outdated Show resolved Hide resolved
compose.yml Outdated Show resolved Hide resolved
huly.nginx Outdated Show resolved Hide resolved
setup.sh Outdated Show resolved Hide resolved
setup.sh Outdated Show resolved Hide resolved
sed -i "s|server_name .*;|server_name ${HOST_ADDRESS};|" ./nginx.conf
sed -i "s|proxy_pass .*;|proxy_pass http://${HTTP_BIND:-127.0.0.1}:${HTTP_PORT};|" ./nginx.conf

# Update listen directive to either port 80 or 443, while preserving IP address
Copy link
Member

Choose a reason for hiding this comment

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

Some of commands below fail with errors, here is errors log:

 Generating nginx.conf...
nginx.conf not found, creating from template.
sed: 1: "./nginx.conf": invalid command code .
sed: 1: "./nginx.conf": invalid command code .
sed: 1: "s|(listen )(.*:)?[0-9]+ ...": \1 not defined in the RE
sed: 1: "s|(listen )(.*:)?([0-9] ...": \1 not defined in the RE
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
Enabling SSL; removing HTTP to HTTPS redirect block...
Do you want to run 'nginx -s reload' now to load your updated Huly config? (Y/n): n
You can run 'nginx -s reload' later to load your updated Huly config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does my fix work?

Copy link
Member

Choose a reason for hiding this comment

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

sed errors are gone, but grep error is still there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Overlooked that one, grep should be fixed as well now.

Copy link
Member

@aonnikov aonnikov Sep 26, 2024

Choose a reason for hiding this comment

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

Still not working:

grep: repetition-operator operand invalid

setup.sh Outdated Show resolved Hide resolved
@aonnikov
Copy link
Member

I have an impression that this configuration becomes too complex. We have no goal to provide production ready solution, the original intention was to provide a sample configuration for local deployment. I propose to simplify nginx config and script, but provide guidance in README what to change in case of more advance requirements.

@veryCrunchy
Copy link
Contributor Author

@aonnikov This "complex" configuration simplifies self-hosting Huly for users and is not aimed to be production ready.

@Sharlyll
Copy link

Finally achieved a working huly instance!! image

Could you please give details of how you got it working? The ’unknown server’ error at the start page still persists. I am unable to create an account or sign in using the current self hosted repo.

Thanks.

@veryCrunchy
Copy link
Contributor Author

This is likely due to incompatible or corrupted data. Try deleting the persistent docker volumes or starting fresh by changing the DOCKER_NAME in your huly.conf.
If this doesn't change anything please share more details on your huly setup.

@veryCrunchy
Copy link
Contributor Author

@Sharlyll are you trying to self host Huly using the branch of this PR or with the current main branch?

@Sharlyll
Copy link

Sharlyll commented Sep 29, 2024

@Sharlyll are you trying to self host Huly using the branch of this PR or with the current main branch?

Yes, I am self hosting using the main branch and instructions from here: https://github.com/hcengineering/huly-selfhost.
This is a fresh install.
Ubuntu 24
2cpu, 4GB ram
hostname set to domain name
./setup.sh set to domain name
etc/hosts binded to domain name

Screenshot 2024-09-29 at 9 09 12

@veryCrunchy
Copy link
Contributor Author

@Sharlyll This PR is meant to fix all the issues with the main branch. Please try the nginx branch on
https://github.com/veryCrunchy/huly-selfhost and let me know if that fixes things for you!

git clone -b nginx https://github.com/veryCrunchy/huly-selfhost.git

@Sharlyll
Copy link

Sharlyll commented Sep 29, 2024

git clone -b nginx https://github.com/veryCrunchy/huly-selfhost.git

Hi
I still get the same error (unknown error. load failed) even after using git clone -b nginx https://github.com/veryCrunchy/huly-selfhost.git
Please can you give a step by step?
Perhaps I am missing something.
I have tried both arm64 and amd

Thanks in advance

@veryCrunchy
Copy link
Contributor Author

@Sharlyll follow these steps: https://github.com/veryCrunchy/huly-selfhost/tree/nginx
Instead of git clone https://github.com/hcengineering/huly-selfhost.git run the command in my previous comment

@aonnikov
Copy link
Member

aonnikov commented Oct 4, 2024

I still the same issue with account service not available. My configuration:

Configuration Summary:
Host Address: localhost:${HTTP_PORT}
HTTP Port: 8081
SSL Enabled: No
Do you want to run 'docker compose up -d' now to start Huly? (Y/n): n
You can run 'docker compose up -d' later to start Huly.
Setup is complete!

@Sharlyll
Copy link

Sharlyll commented Oct 4, 2024

@Sharlyll follow these steps: https://github.com/veryCrunchy/huly-selfhost/tree/nginx Instead of git clone https://github.com/hcengineering/huly-selfhost.git run the command in my previous comment

Thanks for your response.
These are the steps I followed to get a working Huly instance:

  1. Update and upgrade server.
  2. set hostname
  3. Install Nginx
  4. Install Docker (Followed the instructions here )
  5. cd to directory ( in my case /var/www)
  6. git clone -b nginx https://github.com/veryCrunchy/huly-selfhost.git
  7. cd huly-selfhost
  8. ./setup.sh (provide responses to the prompts. This is the important part. I noticed that the repo does not work when SSL is set to Yes. So choose No)
  9. sudo ln -s $(pwd)/nginx.conf /etc/nginx/sites-enabled/huly.conf
  10. Remove nginx default host file :
    sudo rm -r /etc/nginx/sites-enabled/default and
    sudo rm -r /etc/nginx/sites-available/default
    test nginx config: sudo nginx -t
  11. sudo nginx -s reload
  12. sudo docker-compose up -d

Huly should be up

@ronzyfonzy
Copy link

I tested this out on my ubuntu instance and it works. I had to stop my nginx service on the server and leave the work to the docker nginx container.

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