WIP: Working individual containers and docker compose demo
This commit is contained in:
committed by
=Michael Hohn
parent
259bac55fb
commit
34958e4cf4
@@ -118,6 +118,12 @@ docker-compose.
|
||||
cd ~/work-gh/mrva/mrvacommander
|
||||
docker-compose up --build
|
||||
|
||||
1. Start the server containers and the desktop/demo containers
|
||||
|
||||
cd ~/work-gh/mrva/mrvacommander/
|
||||
docker-compose down --remove-orphans
|
||||
docker-compose -f docker-compose-demo.yml up -d
|
||||
|
||||
1. Test server via remote client by following the steps in [gh-mrva](https://github.com/hohn/gh-mrva/blob/connection-redirect/README.org#compacted-edit-run-debug-cycle)
|
||||
|
||||
### Some general docker-compose commands
|
||||
|
||||
@@ -14,9 +14,6 @@ RUN go mod download
|
||||
# Build the Go binary
|
||||
RUN go build .
|
||||
|
||||
# # Set the entrypoint
|
||||
# CMD ["/bin/bash"]
|
||||
|
||||
# Use a minimal base image for the final container
|
||||
FROM debian:bookworm
|
||||
|
||||
@@ -26,5 +23,5 @@ WORKDIR /app
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /work-gh/mrva/gh-mrva/gh-mrva /usr/local/bin/gh-mrva
|
||||
|
||||
# Set the entrypoint to the binary
|
||||
ENTRYPOINT ["gh-mrva"]
|
||||
# Run forever
|
||||
CMD ["tail", "-f", "/dev/null"]
|
||||
|
||||
@@ -25,5 +25,6 @@ RUN pip install -r requirements.txt
|
||||
# Install qldbtools
|
||||
RUN pip install .
|
||||
|
||||
# Set the default entrypoint
|
||||
CMD ["/bin/bash"]
|
||||
# Run forever
|
||||
CMD ["tail", "-f", "/dev/null"]
|
||||
|
||||
|
||||
24
client/containers/qldbtools/Makefile
Normal file
24
client/containers/qldbtools/Makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
DBT_TARGET := client-qldbtools-container:0.1.24
|
||||
|
||||
# Build the qldbtools container image
|
||||
dbt: client-qldbtools-container
|
||||
client-qldbtools-container:
|
||||
docker build -t ${DBT_TARGET} .
|
||||
touch $@
|
||||
|
||||
# Run a shell in the container with the qldbtools
|
||||
dbt-run: dbt
|
||||
docker run --rm -it ${DBT_TARGET} /bin/bash
|
||||
|
||||
# Run one of the scripts in the container as check. Should exit with error.
|
||||
dbt-check: dbt
|
||||
docker run --rm -it ${DBT_TARGET} mc-db-initial-info
|
||||
|
||||
dbt-push: dbt
|
||||
docker tag ${DBT_TARGET} ghcr.io/hohn/${DBT_TARGET}
|
||||
docker push ghcr.io/hohn/${DBT_TARGET}
|
||||
touch $@
|
||||
|
||||
dbt-test:
|
||||
docker pull ghcr.io/hohn/${DBT_TARGET}
|
||||
docker run --rm -it --name test-dbt-server ghcr.io/hohn/${DBT_TARGET} sh
|
||||
@@ -1,18 +1,13 @@
|
||||
* MRVA python tools container
|
||||
Set upDocker image with python 3.11 and pip and the qldbtools
|
||||
Set up Docker image with python 3.11 and pip and the qldbtools. The targets are
|
||||
in the =Makefile=; most important are
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
# Build
|
||||
cd ~/work-gh/mrva/mrvacommander
|
||||
make dbt
|
||||
|
||||
# Check
|
||||
cd ~/work-gh/mrva/mrvacommander
|
||||
make dbt-check
|
||||
|
||||
# Use
|
||||
cd ~/work-gh/mrva/mrvacommander
|
||||
make dbt-run
|
||||
|
||||
#+END_SRC
|
||||
|
||||
|
||||
@@ -56,7 +56,9 @@ ENV CODEQL_JAVA_HOME=/usr
|
||||
# to user settings.
|
||||
# This is in addition to the environment variable CODEQL_JAVA_HOME which has no
|
||||
# effect on the plugin
|
||||
USER root
|
||||
COPY ./settings.json /home/coder/.local/share/code-server/User/
|
||||
RUN chown -R coder:coder /home/coder/.local/share/code-server/
|
||||
|
||||
# Start Code Server
|
||||
ENTRYPOINT ["dumb-init", "code-server", "--bind-addr", "0.0.0.0:9080", "."]
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
- Setup inside the container
|
||||
#+BEGIN_SRC shell
|
||||
cd
|
||||
export PATH=/opt/codeql:$PATH
|
||||
codeql pack init qldemo
|
||||
cd qldemo
|
||||
@@ -26,9 +27,12 @@
|
||||
- Open a new file =qldemo/simple.ql= and add this this query to it. The plugin
|
||||
will download the CodeQL binaries (but never use them -- the configuration
|
||||
redirects)
|
||||
#+BEGIN_SRC java
|
||||
#+BEGIN_SRC sh
|
||||
cd
|
||||
cat > qldemo/simple.ql <<eof
|
||||
import python
|
||||
select 42
|
||||
select 42
|
||||
eof
|
||||
#+END_SRC
|
||||
|
||||
- Create database.
|
||||
@@ -42,7 +46,7 @@
|
||||
codeql database create --language=python -s . -v short-db
|
||||
#+END_SRC
|
||||
|
||||
- Set the database as default and run the query.
|
||||
- Set the database as default and run the query on =simple.ql=
|
||||
|
||||
- Capture the state of this container and create a new image from it
|
||||
#+BEGIN_SRC sh
|
||||
@@ -53,8 +57,6 @@
|
||||
#+END_SRC
|
||||
|
||||
- Push this container
|
||||
[[file:~/work-gh/mrva/mrvacommander/client/containers/vscode/Makefile::image-push: image]]
|
||||
#+BEGIN_SRC sh
|
||||
docker images |head
|
||||
make csi-push
|
||||
#+END_SRC
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"codeQL.runningQueries.numberOfThreads": 2,
|
||||
"codeQl.cli.executablePath": "/opt/codeql"
|
||||
"codeQL.cli.executablePath": "/opt/codeql/codeql"
|
||||
}
|
||||
|
||||
@@ -1,111 +1,133 @@
|
||||
services:
|
||||
code-server:
|
||||
image: codercom/code-server
|
||||
ports:
|
||||
- "9080:8080"
|
||||
volumes:
|
||||
- ./project:/home/coder/project
|
||||
- ~/.config/code-server:/home/coder/.config/code-server
|
||||
- ~/.local/share/code-server:/home/coder/.local/share/code-server
|
||||
environment:
|
||||
- PASSWORD=mrva
|
||||
mrvadata:
|
||||
image: ghcr.io/hohn/mrvadata:0.1.24
|
||||
container_name: mrvadata
|
||||
volumes:
|
||||
- mrvadata:/data/mrvacommander
|
||||
networks:
|
||||
- backend
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq:3-management
|
||||
hostname: rabbitmq
|
||||
container_name: rabbitmq
|
||||
volumes:
|
||||
- ./init/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
|
||||
- ./init/rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro
|
||||
ports:
|
||||
- "5672:5672"
|
||||
- "15672:15672"
|
||||
networks:
|
||||
- backend
|
||||
healthcheck:
|
||||
test: rabbitmq-diagnostics check_port_connectivity
|
||||
interval: 30s
|
||||
timeout: 30s
|
||||
retries: 10
|
||||
client-qldbtools:
|
||||
image: ghcr.io/hohn/client-qldbtools-container:0.1.24
|
||||
volumes:
|
||||
# data at /data/mrvacommander/qldbtools/scratch
|
||||
- mrvadata:/data/mrvacommander
|
||||
depends_on:
|
||||
- mrvadata
|
||||
networks:
|
||||
- backend
|
||||
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./cmd/server/Dockerfile
|
||||
command: [ '--mode=container', '--loglevel=debug' ]
|
||||
container_name: server
|
||||
stop_grace_period: 1s
|
||||
ports:
|
||||
# - "8081:8080" # host:container for proxy
|
||||
- "8080:8080" # host:container
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- dbstore
|
||||
- artifactstore
|
||||
networks:
|
||||
- backend
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
|
||||
dbstore:
|
||||
image: minio/minio:RELEASE.2024-06-11T03-13-30Z
|
||||
container_name: dbstore
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
env_file:
|
||||
- path: .env.container
|
||||
required: true
|
||||
client-ghmrva:
|
||||
# XX: redirect by changing code or using nginx proxy
|
||||
# client.Get(fmt.Sprintf("http://localhost:8080/repos/%s/code-scanning/codeql/variant-analyses/%d", controller, runId), &response)
|
||||
image: ghcr.io/hohn/client-ghmrva-container:0.1.24
|
||||
volumes:
|
||||
- mrvadata:/data/mrvacommander
|
||||
depends_on:
|
||||
- mrvadata
|
||||
networks:
|
||||
- backend
|
||||
|
||||
command: server /data --console-address ":9001"
|
||||
# Demo: Mount preloaded minio backing store
|
||||
volumes:
|
||||
- type: volume
|
||||
source: dbstore-volume
|
||||
target: /data/dbs
|
||||
volume:
|
||||
nocopy: true
|
||||
networks:
|
||||
- backend
|
||||
code-server:
|
||||
image: ghcr.io/hohn/code-server-initialized:0.1.24
|
||||
ports:
|
||||
- "9080:9080"
|
||||
volumes:
|
||||
- mrvadata:/data/mrvacommander
|
||||
environment:
|
||||
- PASSWORD=mrva
|
||||
depends_on:
|
||||
- mrvadata
|
||||
|
||||
artifactstore:
|
||||
image: minio/minio:RELEASE.2024-06-11T03-13-30Z
|
||||
container_name: artifactstore
|
||||
ports:
|
||||
- "19000:9000" # host:container
|
||||
- "19001:9001"
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
command: server /data --console-address ":9001"
|
||||
volumes:
|
||||
- ./qpstore-data:/data
|
||||
networks:
|
||||
- backend
|
||||
rabbitmq:
|
||||
image: rabbitmq:3-management
|
||||
hostname: rabbitmq
|
||||
container_name: rabbitmq
|
||||
volumes:
|
||||
- ./init/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
|
||||
- ./init/rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro
|
||||
ports:
|
||||
- "5672:5672"
|
||||
- "15672:15672"
|
||||
healthcheck:
|
||||
test: rabbitmq-diagnostics check_port_connectivity
|
||||
interval: 30s
|
||||
timeout: 30s
|
||||
retries: 10
|
||||
networks:
|
||||
- backend
|
||||
|
||||
agent:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./cmd/agent/Dockerfile
|
||||
command: [ '--loglevel=debug' ]
|
||||
container_name: agent
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- dbstore
|
||||
- artifactstore
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
networks:
|
||||
- backend
|
||||
server:
|
||||
image: ghcr.io/hohn/mrva-server:0.1.24
|
||||
command: [ '--mode=container', '--loglevel=debug' ]
|
||||
container_name: server
|
||||
stop_grace_period: 1s
|
||||
ports:
|
||||
- "8080:8080" # host:container
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- dbstore
|
||||
- artifactstore
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
networks:
|
||||
- backend
|
||||
|
||||
dbstore:
|
||||
image: minio/minio:RELEASE.2024-06-11T03-13-30Z
|
||||
container_name: dbstore
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
env_file:
|
||||
- path: .env.container
|
||||
required: true
|
||||
command: server /data/mrvacommander/dbstore-data --console-address ":9001"
|
||||
depends_on:
|
||||
- mrvadata
|
||||
volumes:
|
||||
# data at /data/mrvacommander/dbstore-data
|
||||
- mrvadata:/data/mrvacommander
|
||||
networks:
|
||||
- backend
|
||||
|
||||
artifactstore:
|
||||
image: minio/minio:RELEASE.2024-06-11T03-13-30Z
|
||||
container_name: artifactstore
|
||||
ports:
|
||||
- "19000:9000" # host:container
|
||||
- "19001:9001"
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
command: server /data --console-address ":9001"
|
||||
volumes:
|
||||
# data at /data/mrvacommander/qpstore-data
|
||||
- mrvadata:/data/mrvacommander
|
||||
# XX: use multiple storage containers?
|
||||
# - ./qpstore-data:/data
|
||||
networks:
|
||||
- backend
|
||||
|
||||
agent:
|
||||
image: ghcr.io/hohn/mrva-agent:0.1.24
|
||||
command: [ '--loglevel=debug' ]
|
||||
container_name: agent
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- dbstore
|
||||
- artifactstore
|
||||
env_file:
|
||||
- path: ./.env.container
|
||||
required: true
|
||||
networks:
|
||||
- backend
|
||||
|
||||
networks:
|
||||
backend:
|
||||
driver: bridge
|
||||
backend:
|
||||
driver: bridge
|
||||
|
||||
# Demo: Provide preloaded minio backing store
|
||||
volumes:
|
||||
dbstore-volume:
|
||||
external: true
|
||||
name: dbstore-container:/data
|
||||
mrvadata:
|
||||
|
||||
Reference in New Issue
Block a user