Replies: 1 comment
-
Update: In latest Coolify image, www-data homedir is now /home/www-data rather than /var/www/html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good morning,
@andrasbacsai I'm posting this here so other people can know how to proceed if they need to. ;)
In our infrastructure, some servers are not accessible through the WAN, and our Coolify instance is hosted outside their LAN. To access servers that are not directly reachable, we need to pass through an intermediate server, referred to as the gateway.
It is possible to configure Coolify to access these servers as follows:
1. Configure SSH on the Server Hosting Coolify
On the server hosting Coolify, create the
.ssh
directory and a.ssh/config
file for the Coolifywebuser
user:2. Edit the SSH Configuration File
In the
.ssh/config
file, add the following content:Note: Replace
<hostname_gateway_server>
,<hostname_target_server>
,<TheUser>
, and<the_private_key_generated_by_coolify>
with your actual values.3. Mount the
.ssh
Directory in Coolify's ContainerCreate a custom Docker Compose file to mount the
.ssh
directory into thewebuser
home directory within Coolify:# Example of the custom docker-compose file cat /data/coolify/source/docker-compose.custom.yml services: coolify: volumes: - /data/coolify/.ssh:/var/www/html/.ssh
4. Apply the Configuration
After configuring the SSH and Docker Compose setup, apply the changes by running the
upgrade.sh
script:Now, Coolify should be able to connect to the target server through the gateway.
5. Additional Configuration for Non-Root Users
If you are using an unprivileged (non-root) user to access the target server, ensure the user has passwordless sudo privileges by adding the following in
/etc/sudoers.d/<username>
on the target server:Conclusion
This setup should allow Coolify to access servers behind a gateway via SSH tunneling, while also handling non-root user access on the target server. Follow these steps, replacing placeholder values with your actual configuration details, and you should be set.
Hope this helps!
Beta Was this translation helpful? Give feedback.
All reactions