caprover / one-click-apps

Community Maintained One Click Apps (https://github.com/caprover/caprover)
Apache License 2.0
557 stars 545 forks source link

App Suggestion: Coder #791

Open Ratatinator97 opened 1 year ago

Ratatinator97 commented 1 year ago

Please tell us what app you'd like to see on CapRover as a one-click app. Coder is a Github Codespaces OSS self-hosted alternative. It is software development on any infrastructure. Here is the docker setup tutorial: https://coder.com/docs/coder-oss/latest/quickstart/docker

Do you know if there is any official Docker image for the app? ghcr.io/coder/coder:latest

githubsaturn commented 1 year ago

There is already a one click app for Coder I think. https://github.com/caprover/one-click-apps/blob/master/public/v4/apps/vscode-coder.yml

Ratatinator97 commented 1 year ago

It's only a VS-Code server implementation. Not the Coder stack completely.

bgervan commented 1 year ago

Did you create that?

Ratatinator97 commented 1 year ago

I wrote that yml but it still has some issues:

captainVersion: 4
version: "3.9"
services:
  $$cap_appname:
    image: ghcr.io/coder/coder:$$cap_coder_version
    environment:
      CODER_PG_CONNECTION_URL: postgresql://$$cap_db_user:$$cap_db_password@srv-captain--$$cap_appname-postgres/$$cap_db_name?sslmode=disable
      CODER_ADDRESS: "0.0.0.0:7080"
      # You'll need to set CODER_ACCESS_URL to an IP or domain
      # that workspaces can reach. This cannot be localhost
      # or 127.0.0.1 for non-Docker templates!
      CODER_ACCESS_URL: $$cap_coder_url
    # If the coder user does not have write permissions on
    # the docker socket, you can uncomment the following
    # lines and set the group ID to one that has write
    # permissions on the docker socket.
    #group_add:
    #  - "998" # docker group on host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - $$cap_appname-postgres
    caproverExtra:
      containerHttpPort: '7080'
  $$cap_appname-postgres:
    image: postgres:$$cap_db_version
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: $$cap_db_user # The PostgreSQL user (useful to connect to the database)
      POSTGRES_PASSWORD: $$cap_db_password # The PostgreSQL password (useful to connect to the database)
      POSTGRES_DB: $$cap_db_name # The PostgreSQL default database (automatically created at first launch)
    volumes:
      - $$cap_appname-postgres-data:/var/lib/postgresql/data # Use "docker volume rm coder_coder_data" to reset Coder
    caproverExtra:
      notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_coder_version
          label: Coder Version
          defaultValue: 'v0.13.2'
          description: Check out their Github container page for the valid tags https://github.com/coder/coder/pkgs/container/coder
        - id: $$cap_coder_url
          label: Coder URL
          defaultValue: http://$$cap_appname.$$cap_root_domain
          description: 'URL for Coder'
        - id: $$cap_db_name
          label: Name for Postgres Database
          defaultValue: 'coder'
          description: 'Name for Postgres Database'
        - id: $$cap_db_user
          label: User for Postgres Database
          defaultValue: 'admin'
          description: 'User for Postgres Database'
        - id: $$cap_db_password
          label: Password for the user of Postgres Database
          defaultValue: 'admin'
          description: 'Password for the user of Postgres Database'
        - id: $$cap_db_version
          label: Postgres Version
          defaultValue: '14.2'
          description: Check out their docker page for the valid tags https://hub.docker.com/_/postgres
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: >-
            Coder is a self-hosted code platform.
        end: >-
            Warning
            Coder is now available is available at http://$$cap_appname.$$cap_root_domain but it is not yet fully functional ! You have to open a shell into the coder container.
docker exec -it $(docker ps --filter name=srv-captain--$$cap_appname -q) /bin/sh
chmod 666 /var/run/docker.sock
    displayName: 'Coder'
    isOfficial: false
    description: Self-hosted, self-hosted code platform.
    documentation: Taken from https://github.com/coder/coder/blob/main/docker-compose.yaml

Coder needs precise file permissions for some of their directories. I had, at each restart, to manually chmod some folder. I precised it in the Captain app description.

I didn't continue to work on this after that.