Skip to content

Commit

Permalink
add docs for openshift
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshCasper committed Nov 4, 2023
1 parent 005004e commit df36721
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions content/en/user-guide/integrations/openshift/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: "OpenShift"
weight: 14
description: >
Use the OpenShift managed Kubernetes cluster to deploy LocalStack
---

## Introduction

OpenShift is a container orchestration platform as a service designed to simplify the deployment, scaling, and management of containerized applications. Built on Kubernetes, OpenShift provides a comprehensive set of tools and features that facilitate the orchestration, automation, and monitoring of containerized workloads.

With OpenShift, you can deploy LocalStack on a managed Kubernetes cluster, as a cloud sandbox that emulates various AWS services & APIs. This guide demonstrates how you can deploy LocalStack on OpenShift using Devfile. You can use the deployed LocalStack container to create AWS resources that you can use for local development and testing purposes.

## Getting started

This guide is designed for users new to LocalStack and assumes basic knowledge of the AWS CLI and our [`awslocal`](https://github.com/localstack/awscli-local) wrapper script. As a general prerequisite, you should have access to the [OpenShift Web Console](https://docs.openshift.com/container-platform/4.14/web_console/web-console-overview.html).

We will demonstrate how you can create local AWS resources using LocalStack using the AWS CLI. Instead of running LocalStack locally, you will deploy it on OpenShift and use the exposed endpoint to interact with the LocalStack container.

### Setting up LocalStack on OpenShift

You can deploy LocalStack via the **Developer** perspective in the OpenShift Web Console. Navigate to the **+Add** view to deploy LocalStack using a Devfile.

<img src="openshift-developer-view.png" alt="OpenShift Developer perspective" title="OpenShift Developer perspective" width="900" />
<br><br>

To deploy LocalStack on OpenShift, click on **Import from Git** in the **Git Repository** tile. In the Git section, enter the following Git repository URL to import the Devfile and Helm charts which contains the configuration for LocalStack: [**https://github.com/localstack/localstack-dev-spaces**](https://github.com/localstack/localstack-dev-spaces).

OpenShift Web Console will automatically detect the Devfile and display the import strategy. A unique application name will be generated to the application grouping to label your resources. A unique name will also be provided to the component that will be used to name associated resources. You can edit these values if you want.

Click on **Create** to deploy LocalStack on OpenShift.

### Viewing the LocalStack deployment

You can see the build status of the LocalStack deployment in the **Topology** view.

<img src="openshift-topology-view.png" alt="OpenShift Topology view" title="OpenShift Topology view" width="900" />
<br><br>

After successful deployment, you can see the **localstack-dev-spaces** pod in the **Topology** view. Click on the pod to view the details. You will be able to see the following details:

- Running pods along with the status and logs.
- Builds for your existing pods and an option to create new builds.
- Exposed services along with the service port and the pod port.
- Exposed routes for your deployed pods on the cluster.

<img src="localstack-dev-spaces.png" alt="LocalStack Dev Spaces" title="LocalStack Dev Spaces" width="900" />
<br><br>

### Creating AWS resources on OpenShift

Click on the **localstack-dev-spaces** pod to view the details. You will be able to see the exposed route for the LocalStack container. Copy the route URL and use it to interact with the LocalStack container.

To create an S3 bucket and an SQS queue, run the following commands:

{{< command >}}
$ export AWS_ENDPOINT_URL=<localstack-route-url>
$ awslocal s3 mb s3://my-bucket
$ awslocal sqs create-queue --queue-name my-queue
{{< /command >}}

In the above commands, replace `<localstack-route-url>` with the route URL of the LocalStack container. The `AWS_ENDPOINT_URL` environment variable is used to specify the endpoint URL of the LocalStack container.

{{< alert title="Note" >}}
By default, the endpoint URL for `awslocal` is `http://localhost:4566`. Since we are running LocalStack on OpenShift, we need to specify the route URL of the LocalStack container. You can swap `awslocal` with the AWS CLI, by specifying the additional `--endpoint-url` parameter.
{{< /alert >}}

You can further use integrations, such as [CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/), [SAM CLI](https://docs.localstack.cloud/user-guide/integrations/aws-sam/), and [Terraform](https://docs.localstack.cloud/user-guide/integrations/terraform/), to interact with the Ephemeral Instance. In these integrations, you can change the `LOCALSTACK_HOSTNAME` environment variable to the endpoint URL of the Ephemeral Instance.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit df36721

Please sign in to comment.