C
Coder.com2mo ago
e1k

Code market place setup

Hello, I would like to setup code market place, does some how have a poc for the tls reverse proxy ? I'm not really sure how to start.. Thanks
21 Replies
Codercord
Codercord2mo ago
<#1306277796372414544>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys2mo ago
Hey @e1k, I'm not sure what you mean by "code market place", could you elaborate a bit?
e1k
e1kOP2mo ago
Hello @Phorcys, i'm talking about this project : https://github.com/coder/code-marketplace Am I on the right discord ? I need to help for setup.
GitHub
GitHub - coder/code-marketplace: Open source extension marketplace ...
Open source extension marketplace for VS Code. Contribute to coder/code-marketplace development by creating an account on GitHub.
Phorcys
Phorcys2mo ago
oh yeah definitely, I just wanted to make sure you weren't talking about Coder or code-server I'll get back to you later today will you be at the ECW next week? I see you're in some CTF Discord servers
e1k
e1kOP2mo ago
I manage to get a working nginx config, but I need to use an other port, I can't use 3001, there 's already a container that I can't move. I belive there's something to do with nginx but I'm not expert enough to find an answer. Sadly, this year I can't make it, I'm too busy. But I have great memories from the past years !
Phorcys
Phorcys2mo ago
that's too bad! could you send your config over?
e1k
e1kOP2mo ago
I created a container containing nginx and code marketplace, nothing really fancy but I can share it if needed. This is my docker-compose :
services:
nginx_marketplace:
build:
context: .
dockerfile: Dockerfile
container_name: nginx-marketplace
ports:
- "80:80"
- "443:443"
- "9015:3001"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs/:/etc/nginx/certs/:ro
- ./exts:/exts
services:
nginx_marketplace:
build:
context: .
dockerfile: Dockerfile
container_name: nginx-marketplace
ports:
- "80:80"
- "443:443"
- "9015:3001"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs/:/etc/nginx/certs/:ro
- ./exts:/exts
And this my nginx config :
# /nginx.conf
events { }

http {
server {
listen 443 ssl;
server_name marketplace.lab.fr;

# Specify the paths to the mounted certificates
ssl_certificate /etc/nginx/certs/marketplace.crt;
ssl_certificate_key /etc/nginx/certs/marketplace.key;

location /marketplace/ {
proxy_pass http://192.168.111.62:9015/;

# Set headers required by the marketplace
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header Forwarded "host=$host;proto=$scheme";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

}

# Redirect HTTP to HTTPS
server {
listen 80;
server_name marketplace.lab.fr;

return 301 https://$host$request_uri;
}
}
# /nginx.conf
events { }

http {
server {
listen 443 ssl;
server_name marketplace.lab.fr;

# Specify the paths to the mounted certificates
ssl_certificate /etc/nginx/certs/marketplace.crt;
ssl_certificate_key /etc/nginx/certs/marketplace.key;

location /marketplace/ {
proxy_pass http://192.168.111.62:9015/;

# Set headers required by the marketplace
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header Forwarded "host=$host;proto=$scheme";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

}

# Redirect HTTP to HTTPS
server {
listen 80;
server_name marketplace.lab.fr;

return 301 https://$host$request_uri;
}
}
Phorcys
Phorcys2mo ago
do you already have a working nginx/reverse-proxy instance that isn't this one?
e1k
e1kOP2mo ago
Yes, wait a few sec It was pretty similar, using port 3001:3001 and proxy_pass http://127.0.0.1:3001/
Phorcys
Phorcys2mo ago
I mean, what I usually do is have a single reverse-proxy for all containers, then have all the configs in the same place saves some time that said, i do not see any issue with this config, are you running into any particular issue?
e1k
e1kOP2mo ago
yeah, this is just for poc, it was easier, on prod it will be two different one I m running into 502
nginx-marketplace | 2024/11/14 12:59:10 [error] 16#16: *9 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.18.0.1, server: marketplace.lab.fr, request: "GET /marketplace/ HTTP/1.1", upstream: "http://192.168.111.62:9015/", host: "127.0.0.1"
nginx-marketplace | 172.18.0.1 - - [14/Nov/2024:12:59:10 +0000] "GET /marketplace/ HTTP/1.1" 502 157 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
nginx-marketplace | 2024/11/14 12:59:10 [error] 16#16: *9 open() "/etc/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.18.0.1, server: marketplace.lab.fr, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1", referrer: "https://127.0.0.1/marketplace/"
nginx-marketplace | 172.18.0.1 - - [14/Nov/2024:12:59:10 +0000] "GET /favicon.ico HTTP/1.1" 404 153 "https://127.0.0.1/marketplace/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
nginx-marketplace | 2024/11/14 12:59:10 [error] 16#16: *9 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.18.0.1, server: marketplace.lab.fr, request: "GET /marketplace/ HTTP/1.1", upstream: "http://192.168.111.62:9015/", host: "127.0.0.1"
nginx-marketplace | 172.18.0.1 - - [14/Nov/2024:12:59:10 +0000] "GET /marketplace/ HTTP/1.1" 502 157 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
nginx-marketplace | 2024/11/14 12:59:10 [error] 16#16: *9 open() "/etc/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.18.0.1, server: marketplace.lab.fr, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1", referrer: "https://127.0.0.1/marketplace/"
nginx-marketplace | 172.18.0.1 - - [14/Nov/2024:12:59:10 +0000] "GET /favicon.ico HTTP/1.1" 404 153 "https://127.0.0.1/marketplace/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
Hello @Phorcys can you help me to setup my nginx ?
Phorcys
Phorcys2mo ago
@e1k what's the output of curl http://192.168.111.62:9015?
e1k
e1kOP2mo ago
I finally found a way around, there is the setting --address it wasn't in the doc but I found it in the source code
Phorcys
Phorcys2mo ago
what did you achieve with the address flag? change the port?
e1k
e1kOP2mo ago
Yes change both the port and the adress
--address=0.0.0.0:9056
--address=0.0.0.0:9056
Hello @Phorcys I'm still facing some issues, Now that I have a working instance, I'm having trouble connecting it to my code-server I know that I have to generate certs to access it but I'm not sure about what settings I need to use in my certificate, could you help me ? Thank you very much !
Spiked_Grape
Spiked_Grape2mo ago
@Phorcys recently after updating code-server all my extensions in the ide side panel show a yellow triangle saying this extension is not signed by the extension marketplace with the install button grayed out. Do you know if this is known issue or is fixed in a newer version of code marketplace? I think I am still on v2.1.0
Phorcys
Phorcys2mo ago
Hi, could you open an issue over at https://github.com/coder/code-marketplace/issues please? hey @e1k, any luck?
e1k
e1kOP5w ago
Hello, yes I got everything working nice and smooth : )
Phorcys
Phorcys5w ago
great!
Codercord
Codercord5w ago
@Phorcys closed the thread.

Did you find this page helpful?