Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#240] move api server to its own repo #241

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 5 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi8/nodejs-20:latest AS BUILD_IMAGE
FROM registry.access.redhat.com/ubi8/nodejs-16:latest AS build

### BEGIN REMOTE SOURCE
# Use the COPY instruction only inside the REMOTE SOURCE block
Expand All @@ -20,48 +20,14 @@ RUN mkdir -p /usr/src/
RUN cp -r $REMOTE_SOURCES_DIR/activemq-artemis-self-provisioning-plugin/app /usr/src/
WORKDIR /usr/src/app

lavocatt marked this conversation as resolved.
Show resolved Hide resolved
## Install dependencies
RUN yarn install --network-timeout 1000000
RUN yarn install && yarn build

lavocatt marked this conversation as resolved.
Show resolved Hide resolved
## 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
Loading