openvsx icon indicating copy to clipboard operation
openvsx copied to clipboard

Offline setup for open vsx

Open p1r4t3-s4il0r opened this issue 11 months ago • 2 comments

Hello,

I know there are a few issues on this subject. I looked at #444, #802, #903.

But after looking at all this issues, I can' t have a working setup.

OpenVSX version : 0.16.4.

VSCode version : 1.95.2.

I currently have the server exposed on http 8080 and https 8443.

I have the following in my product.json

	"extensionsGallery": {
		"serviceUrl": "https://127.0.0.1:8443/vscode/gallery",
		"itemUrl": "https://127.0.0.1:8443/vscode/item"
	},

I also have the following in my settings.json:

    "http.proxyStrictSSL": false,
    "http.systemCertificates": true

But I keep getting the error "ERR_CERT_INVALID". (However, it's working with curl)

I can bypass it by starting code --ignore-certificate-errors. Now, the extensions on the server are listed in vscode. But I'm still having error when trying to install one.

And in the log I have :

[error] [network] #8: https://127.0.0.1:80/vscode/asset/ms-python/python/2024.19.2024110601/Microsoft.VisualStudio.Code.Manifest?targetPlatform=linux-x64 - error GET Failed to fetch

Why is it requesting 127.0.0.1:80 and not 8443 ?

Here's my nginx config and docker compose, in case :

Nginx
# nginx.conf
worker_processes 1;

events {
    worker_connections 1024;
}

http {

    server {
        listen 443 ssl;
        server_name openvsx-server;

        # Path to SSL certificates
        ssl_certificate /etc/nginx/certs/openvsx-server.crt;
        ssl_certificate_key /etc/nginx/certs/openvsx-server.key;

        location / {
            proxy_pass http://openvsx-server:8080;
            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_set_header X-Forwarded-Proto $scheme;
        }
    }

    server {
        listen 80;
        server_name openvsx-server;

        # Redirect all HTTP requests to HTTPS
        return 301 https://$host$request_uri;
    }

}
docker-compose.yml
services:

  postgres:
    image: postgres:15
    hostname: postgres
    environment:
      - POSTGRES_USER=openvsx
      - POSTGRES_PASSWORD=openvsx
    volumes:
      - pg_data:/var/lib/postgresql/data
    logging:
      options:
        max-size: 10m
        max-file: "3"
    ports:
      - '5432:5432'

  elasticsearch:
    image: elasticsearch:8.7.1
    hostname: elasticsearch
    environment:
      - xpack.security.enabled=false
      - xpack.ml.enabled=false
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - cluster.routing.allocation.disk.threshold_enabled=false
    ports:
      - 9200:9200
      - 9300:9300
    healthcheck:
      test: curl -s http://elasticsearch01:9200 >/dev/null || exit 1
      interval: 10s
      timeout: 5s
      retries: 50
      start_period: 5s

  kibana:
    image: kibana:8.7.1
    ports:
      - "5601:5601"
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
    depends_on:
      - elasticsearch
    profiles:
      - kibana

  openvsx-server:
    image: ghcr.io/eclipse/openvsx-server:v0.16.4
    volumes:
      - ./application.yml:/home/openvsx/server/config/application.yml:ro
    ports:
      - 8080:8080
    depends_on:
      - postgres
      - elasticsearch
    healthcheck:
      test: "curl --fail --silent localhost:8081/actuator/health | grep UP || exit 1"
      interval: 10s
      timeout: 5s
      retries: 50
      start_period: 5s

  ngnix:
    image: nginx
    ports: 
      - 8443:443
    depends_on:
      - openvsx-server  # Ensure this service starts first
    volumes:
      - ./certs/:/etc/nginx/certs:ro
      - ./nginx.conf:/etc/nginx/nginx.conf:ro

volumes:
  pg_data:
    driver: local

Thanks.

p1r4t3-s4il0r avatar Nov 12 '24 15:11 p1r4t3-s4il0r