# Copyright 2019 Changkun Ou. All rights reserved. # Use of this source code is governed by a MIT # license that can be found in the LICENSE file. # Demo stack: occamyd plus demo servers built from docker/demo/. Services # reach each other by name on the default network; only occamy-v1 is # published. occamy-v1 starts once the servers accept connections, # because a connection to a server that is not up yet would fail. It is # not restarted automatically, so that a crash fails the end-to-end tests # instead of going unnoticed. # # The demo's v1 file lists the desktop and the SSH server. # docker-compose.e2e.yaml, which make run E2E=1 adds, gives occamy-v1 the # end-to-end tests' file, which lists the other servers too. # # The project is named occamy, not after the file's directory, docker, # which any other checkout or compose file in a directory of that name # shares; make clean removes the project's containers, volume and # images. OCCAMY_IMAGE, which make build tags too, and OCCAMY_V1_PORT # run a second stack next to the first, under another project name # (COMPOSE_PROJECT_NAME or -p), on a shared host. # # occamy-v1 is published on the host's loopback interface unless # OCCAMY_BIND names another address, such as 0.0.0.0 for every # interface. Its demo user has a password that anyone can read here, so # publish it beyond the loopback interface only on a network you trust. # # The debug listener has no authentication, and stays off unless make # run OCCAMY_DEBUG=1 sets OCCAMY_V1_DEBUG_ADDRESS, which opens it. make # run without it sets it to off, whatever the shell or .env holds; # compose up by hand takes it from there. Its port is published on the # host's loopback interface only, whatever OCCAMY_BIND says. The stack's # other services can reach it while it is on (TestDemoDebugGating, # TestDemoBind). name: occamy services: occamy-v1: # occamyd serving its v1 file (occamy-v1.yaml) on port 5637: the web # client, the real desktop over VNC and RDP, and the demo SSH server, # for API v1 and protocol v1 clients. Under docker-compose.e2e.yaml # it serves occamy-v1-e2e.yaml instead, which adds the demo VNC # servers, x11vnc and TigerVNC, and the RDP server, for the # end-to-end tests. image: ${OCCAMY_IMAGE:-occamy:latest} command: ["/occamy/occamyd", "-conf", "/occamy/v1.yaml"] ports: - "${OCCAMY_BIND:-127.0.0.1}:${OCCAMY_V1_PORT:-5637}:5637" # The debug listener (occamy-v1.yaml), for make soak, on the # loopback interface only: it has no authentication. Nothing # listens there unless OCCAMY_V1_DEBUG_ADDRESS is set. - "127.0.0.1:${OCCAMY_V1_DEBUG_PORT:-5638}:5638" volumes: - ./occamy-v1.yaml:/occamy/v1.yaml:ro # The CA of TigerVNC's VeNCrypt certificate, for the tls of the # end-to-end tests' connection that checks it (occamy-v1-e2e.yaml). - tigervnc-ca:/run/occamy-vnc-ca:ro # The signing key, on a volume, as a real install keeps it: occamyd # creates it at start, and tokens survive a restart. The image's # /var/lib/occamy gives the volume to the nonroot user. make stop # keeps it, and make clean removes it. - occamy-v1-data:/var/lib/occamy environment: OCCAMY_DEMO_SSH_PASSWORD: occamy OCCAMY_DEMO_VNC_PASSWORD: vncpassword OCCAMY_DEMO_PLAIN_PASSWORD: plainpassword OCCAMY_DEMO_RDP_PASSWORD: occamy OCCAMY_V1_DEBUG_ADDRESS: ${OCCAMY_V1_DEBUG_ADDRESS:-} depends_on: vnc: condition: service_healthy tigervnc: condition: service_healthy rdp: condition: service_healthy ssh: condition: service_healthy vnc: # x11vnc: host vnc:5900, password vncpassword; vnc:5901, the same # screen without a password; vnc:5902 and vnc:5903, password # vncpassword, with the de and fr keyboard layouts. build: ./demo/vnc environment: VNC_PASSWORD: vncpassword healthcheck: # Look for the listening sockets (5900 to 5903 are 170C to 170F) # rather than connect, since x11vnc logs every connection that does # not speak RFB. test: ["CMD", "sh", "-c", "for p in 170C 170D 170E 170F; do grep -q \":$$p [0-9A-F]*:0000 0A\" /proc/net/tcp /proc/net/tcp6 || exit 1; done"] interval: 1s retries: 30 tigervnc: # TigerVNC's Xvnc, five screens: host tigervnc:5900, password # vncpassword; tigervnc:5901, VeNCrypt only, user occamy, password # plainpassword, with a certificate for the name tigervnc from a CA # that it writes to the volume tigervnc-ca; tigervnc:5902 without a # password; tigervnc:5903 and tigervnc:5904, password vncpassword, # with the de and fr keyboard layouts. build: context: .. dockerfile: docker/demo/tigervnc/Dockerfile environment: VNC_PASSWORD: vncpassword PLAIN_PASSWORD: plainpassword CA_DIR: /run/occamy-vnc-ca volumes: - tigervnc-ca:/run/occamy-vnc-ca healthcheck: # Look for the listening sockets (5900 to 5904 are 170C to 1710) # rather than connect, since Xvnc logs every connection that does # not speak RFB; and for the CA, which occamy-v1 reads at start. test: ["CMD", "sh", "-c", "test -s /run/occamy-vnc-ca/ca.pem && for p in 170C 170D 170E 170F 1710; do grep -q \":$$p [0-9A-F]*:0000 0A\" /proc/net/tcp /proc/net/tcp6 || exit 1; done"] interval: 1s retries: 30 ssh: # host ssh:22, user occamy, password occamy build: ./demo/ssh environment: SSH_PASSWORD: occamy healthcheck: test: ["CMD", "bash", "-c", "