Skip to content

Latest commit

 

History

History
163 lines (104 loc) · 6.04 KB

CommonTasks.md

File metadata and controls

163 lines (104 loc) · 6.04 KB

Frequently Used Information

This page contains information on basic tasks that are used throughout the Steeltoe Samples. Use this page to quickly get your local development environment up and running.

Containers images produced by the Steeltoe team (all images hosted at steeltoe.azurecr.io) are For local development purposes only. Images are generally very basic and formal support should not be expected. To see how the images are built and/or participate in improving them, visit this repository.

Feel free to modify these commands as needed, knowing that commands provided in this document will result in:

  • The latest available (tag-matching) image being used: --pull=always
  • Servers that are automatically removed when the container is stopped: --rm
  • An attached pseudo-TTY with STDIN kept open: -it read more
  • Published ports: -p <hostPort>:<containerPort>
  • Named containers: --name <name>. If the command has Steeltoe-specific configuration and/or the image was built by the Steeltoe team, the name starts with 'steeltoe-'

Spring Cloud Config Server

Run SCCS with Docker

To start a config server backed by the Spring Cloud Samples repo:

docker run --rm -it --pull=always -p 8888:8888 --name steeltoe-config steeltoe.azurecr.io/config-server

To start a config server backed by a folder on your local disk, start the docker image like this:

# Note: Ensure Docker is configured to share host drive/volume so the mount below will work correctly!
docker run --rm -it --pull=always -p 8888:8888 -v $PWD/steeltoe/config-repo:/config --name steeltoe-config steeltoe.azurecr.io/configserver --spring.profiles.active=native

To start a config server that registers itself with Eureka at startup (discovery-first):

docker run --rm -it --pull=always -p 8888:8888 --name steeltoe-config -e eureka.client.enabled=true steeltoe.azurecr.io/config-server

Run SCCS with Java

To run a Spring Cloud Config Server without Docker:

  1. Clone the Spring Cloud Config Server repository: git clone https://github.com/spring-cloud/spring-cloud-config
  2. Change to the directory the server is located in: cd spring-cloud-config/spring-cloud-config-server
  3. Review the readme and ensure you have the required JDK installed
  4. Build the source: .\mvnw install -DskipTests
  5. Start the server: .\mvnw spring-boot:run

The default configuration of the Config Server uses this github repo for its source of configuration data.

Provision SCCS on Cloud Foundry

Use the cf cli to create a Spring Cloud Config Server in a org/space, backed by a given git repo. Many of the Steeltoe samples use the spring-cloud-samples repo, but you may need to alter the parameter used.

  1. cf target -o myorg -s myspace
  2. Use the correct escaping for your shell:
    1. bash or PowerShell: cf create-service p-config-server standard myConfigServerInstanceName -c '{"git":{"uri": "https://github.com/spring-cloud-samples/config-repo"}}'
    2. CMD: cf create-service p.config-server standard myConfigServerInstanceName -c "{\"git\":{\"uri\":\"https://github.com/spring-cloud-samples/config-repo\"}}"
  3. Wait for service to be ready. (use cf services to check the status)

Spring Cloud Eureka Server

Run Eureka with Docker

docker run --rm -it --pull=always -p 8761:8761 --name steeltoe-eureka steeltoe.azurecr.io/eureka-server

Provision Eureka on Cloud Foundry

Use the cf cli to create a Service Registry service in a org/space.

  1. cf target -o myorg -s myspace
  2. cf create-service p.service-registry standard myDiscoveryServiceInstanceName
  3. Wait for service to be ready. (use cf services to check the status)

Spring Boot Admin

Run Spring Boot Admin Server with Docker

docker run --rm -it --pull=always -p 9099:9099 --name steeltoe-SpringBootAdmin steeltoe.azurecr.io/spring-boot-admin

HashiCorp Consul

Run HashiCorp Consul Server with Docker

docker run --rm -it --pull=always -p 8500:8500 --name consul hashicorp/consul

MongoDB

Run MongoDB Server with Docker

docker run --rm -it --pull=always -p 27017:27017 --name mongo mongo

MySQL

Run MySQL Server with Docker

docker run --rm -it --pull=always -p 3306:3306 --name steeltoe-mysql -e MYSQL_ROOT_PASSWORD=steeltoe -e MYSQL_DATABASE=steeltoe -e MYSQL_USER=steeltoe -e MYSQL_PASSWORD=steeltoe mysql

PostgreSQL

Run PostgreSQL Server with Docker

docker run --rm -it --pull=always -p 5432:5432 --name steeltoe-postgres -e POSTGRES_DB=steeltoe -e POSTGRES_USER=steeltoe -e POSTGRES_PASSWORD=steeltoe postgres:alpine

RabbitMQ

Run RabbitMQ Server with Docker

Note

This image has the management plugin enabled and no credentials set.

docker run --rm -it --pull=always -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3-management

Redis

Run Redis server with Docker

docker run --rm -it --pull=always -p 6379:6379 --name redis redis

SQL Server

Run SQL Server with Docker

docker run --rm -it --pull=always -p 1433:1433 --name mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=St33ltoeR0cks!' mcr.microsoft.com/mssql/server

UAA Server for Steeltoe Samples

The Steeltoe team has created a UAA configuration to use with the sample applications in this repository.

Run UAA Server with Docker

docker run --rm -it --pull=always -p 8080:8080 --name steeltoe-uaa steeltoe.azurecr.io/uaa-server:77.10

Run Steeltoe UAA on Cloud Foundry

Refer to the README in the Dockerfiles repository for instructions.

Zipkin

Run Zipkin Server with Docker

docker run --rm -it --pull=always -p 9411:9411 --name zipkin openzipkin/zipkin