Skip to content

Commit

Permalink
[#240] move api server to its own repo
Browse files Browse the repository at this point in the history
This commit removes the code from the api-server. The new repository
where the code lives now is
https://github.com/artemiscloud/activemq-artemis-jolokia-api-server.

The Dockerfile got synchronized back to the one from the
console-plugin-template at commit 2b4dbe4b4313e258be1754815614cf7d47f45c11

The deploy/ folder content has been synchronized back to its state
before introducing the api-server in the project. At commit
fc70c0e.

The only difference left is that the plugin relies on the
activemq-artemis-jolokia-api-server proxy service to be there:

```
  proxy:
    - type: Service
      alias: api-server-service
      endpoint:
        type: Service
        service:
          name: activemq-artemis-jolokia-api-server
          namespace: activemq-artemis-jolokia-api-server
          port: 9443
```

Follow the updates in the Readme for more information about how to
develop and deploy now.

This work is linked to the PR that adds the jolokia-api-server code to
its own repo there
artemiscloud/activemq-artemis-jolokia-api-server#4
  • Loading branch information
lavocatt committed Jul 15, 2024
1 parent d7d7b63 commit c3d1ad5
Show file tree
Hide file tree
Showing 30 changed files with 299 additions and 4,544 deletions.
64 changes: 7 additions & 57 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,17 @@
FROM registry.access.redhat.com/ubi8/nodejs-20:latest AS BUILD_IMAGE

### BEGIN REMOTE SOURCE
# Use the COPY instruction only inside the REMOTE SOURCE block
# Use the COPY instruction only to copy files to the container path $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app
ARG REMOTE_SOURCES_DIR=/tmp/remote_source
RUN mkdir -p $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app
WORKDIR $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app
# Copy package.json and yarn.lock to the container
COPY package.json package.json
COPY yarn.lock yarn.lock
ADD . $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app
RUN command -v yarn || npm i -g yarn
### END REMOTE SOURCE

FROM registry.access.redhat.com/ubi8/nodejs-16:latest AS build
USER root
RUN command -v yarn || npm i -g yarn

## Set directory
RUN mkdir -p /usr/src/
RUN cp -r $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app /usr/src/
ADD . /usr/src/app
WORKDIR /usr/src/app
RUN yarn install && yarn build

## Install dependencies
RUN yarn install --network-timeout 1000000

## Build application
RUN yarn build
RUN yarn build-server

FROM registry.access.redhat.com/ubi8/nodejs-20-minimal:latest

USER root

WORKDIR /app

COPY --from=BUILD_IMAGE /usr/src/app/dist /usr/share/amq-spp/dist
COPY --from=BUILD_IMAGE /usr/src/app/.env /usr/share/amq-spp/.env
COPY --from=BUILD_IMAGE /usr/src/app/server /usr/share/amq-spp/server

WORKDIR /usr/share/amq-spp

RUN npm install connect \
cors \
express \
express-openapi-validator \
swagger-routes-express \
typescript \
validator \
yaml \
base-64 \
jsonwebtoken \
dotenv \
express-rate-limit \
node-fetch@2 \
@peculiar/x509

RUN echo "node /usr/share/amq-spp/server/app.js /usr/share/amq-spp/dist" > run.sh
RUN chmod +x run.sh
FROM registry.access.redhat.com/ubi8/nginx-120:latest

COPY --from=build /usr/src/app/dist /usr/share/nginx/html
USER 1001

ENV NODE_ENV=production

CMD ["node", "server/app.js", "dist"]
ENTRYPOINT ["nginx", "-g", "daemon off;"]

## Labels
LABEL name="artemiscloud/activemq-artemis-self-provisioning-plugin"
Expand Down
65 changes: 45 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ This project is a ActiveMQ Artemis Self Provisioning Plugin to the Administrator
## Local development

To be able to run the local development environment you need to:
* have access to a local or remote OpenShift cluster
* have the operator installed on the cluster
* have the cert-manager operator installed on the cluster
* have the plugin running
* have the console running

- have access to a local or remote OpenShift cluster
- have the operator installed on the cluster
- have the cert-manager operator installed on the cluster
- have the jolokia-api-server running
- have the plugin running
- have the console running

### Setting up an OpenShift cluster

Expand All @@ -24,8 +26,8 @@ https://access.redhat.com/documentation/en-us/red_hat_openshift_local/2.34/html-

> [!WARNING]
> If you're encountering an issue where `crc` gets stuck in the step `Waiting
> for kube-apiserver availability` or `Waiting until the user's pull secret is
> written to the instance disk...` [you might
for kube-apiserver availability` or `Waiting until the user's pull secret is
written to the instance disk...` [you might
> need](https://github.com/crc-org/crc/issues/4110) to
> configure the network as local: `crc config set network-mode user`
Expand All @@ -35,10 +37,10 @@ Once your environment is set up you simply need to `crc start` your cluster.

Depending on the remote or local env:

* `oc login -u kubeadmin
- `oc login -u kubeadmin
https://api.ci-ln-x671mxk-76ef8.origin-ci-int-aws.dev.rhcloud.com:6443` (to
adapt depending on your cluster address)
* `oc login -u kubeadmin https://api.crc.testing:6443`
adapt depending on your cluster address)
- `oc login -u kubeadmin https://api.crc.testing:6443`

### Installing the operator

Expand All @@ -48,8 +50,9 @@ get the operator from the operatorHub or from the upstream repo.
#### From the operatorHub

Navigate to the operatorHub on the console and search for: `Red Hat Integration

- AMQ Broker for RHEL 8 (Multiarch)` After installation the wait for the
operator container to be up and running.
operator container to be up and running.

> [!WARNING]
> If you're running into an issue where the operatorHub is not accessible, try
Expand Down Expand Up @@ -87,14 +90,25 @@ Navigate to the operatorHub on the console and search for `Cert-manager`.

### Running the plugin

#### start the jolokia api-server

In one terminal start the jolokia-api-server, [follow the
readme](https://github.com/lavocatt/activemq-artemis-jolokia-api-server/blob/main/README.md)
on the project to know what to do.

#### start the webpack server

In one terminal window, run:

1. `yarn install`
2. `yarn build-server`
3. `yarn build-dev`
4. `yarn run start`
2. `yarn start`

Note: `yarn run start` starts the plugin in http mode.
if you want the plugin to run in https mode, run

Note: `yarn run start` starts the plugin in https mode by default.
`yarn run start-tls`

#### start the console

In another terminal window, run:

Expand All @@ -112,6 +126,8 @@ If you want the console to run in `https` mode, run:
This command will run the console in `https` mode on port 9442.
The console url is <https://localhost:9442>

Note: Running console in `https` mode requires the plugin running in `https` mode too.

The console in https mode requires a private key and a server certificate that are generated
with openssl command. They are located under `console-cert` directory. The domain.key is the
private key and domain.crt is the server certificate. Please read the `console-cert/readme`
Expand Down Expand Up @@ -139,8 +155,16 @@ for details.

## Deployment on cluster

### deploy the jolokia api-server

[Follow the
readme](https://github.com/lavocatt/activemq-artemis-jolokia-api-server/blob/main/README.md)
on the project to know what to do.

You can deploy the plugin to a cluster by running this following command:

### deploy the plugin

```sh
./deploy-plugin.sh [-i <image> -n]
```
Expand Down Expand Up @@ -170,9 +194,10 @@ To undeploy the plugin, run
./undeploy-plugin.sh
```

## About the api-server

The plugin uses a api server as a backend service to get access broker's jolokia
endpoint. The source code is in `api-server` directory.
## Keep in sync the jolokia api-server markdown file

Please read [api.md](api.md) for details.
The codegen relies on the jolokia api-server's openapi definition to work. The
project keeps a copy of the version of the api server it is compatible with
under `api-server/openapi.yml`.
This files needs to be kept in sync when upgrades on the api-server are
performed.
Loading

0 comments on commit c3d1ad5

Please sign in to comment.