Created
February 22, 2022 23:17
-
-
Save jdoss/25f9dac0a616e524f8794a89b7989e9f to your computer and use it in GitHub Desktop.
Quickly launch Elasticsearch, Redis, and PostgreSQL inside a Podman pod.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ELASTICSEARCH_VERSION=7.5.2 | |
ELASTICSEARCH_PORT=9200 | |
REDIS_VERSION=6.0.1 | |
REDIS_PORT=6379 | |
POSTGRESQL_VERSION=9.6.17 | |
POSTGRESQL_PORT=5432 | |
POSTGRES_USER=mycooluser | |
POSTGRESQL_PASSWORD=supersecurepassword | |
## Create Pod | |
podman pod create --replace --name devel-services-pod \ | |
-p ${ELASTICSEARCH_PORT}:${ELASTICSEARCH_PORT} \ | |
-p ${REDIS_PORT}:${REDIS_PORT} \ | |
-p ${POSTGRESQL_PORT}:${POSTGRESQL_PORT} | |
echo "Start Elasticsearch" | |
podman volume create devel-elasticsearch 2> /dev/null ||: | |
podman create --replace --pod devel-services-pod \ | |
--volume devel-elasticsearch:/usr/share/elasticsearch/data:Z \ | |
--name devel-elasticsearch \ | |
-e "discovery.type=single-node" \ | |
-e cluster.name=devel-elasticsearch \ | |
-e bootstrap.memory_lock=true \ | |
-e discovery.type=single-node \ | |
-e xpack.security.enabled=false \ | |
-e xpack.monitoring.enabled=false \ | |
-e xpack.graph.enabled=false \ | |
-e xpack.watcher.enabled=false \ | |
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \ | |
docker.io/library/elasticsearch:${ELASTICSEARCH_VERSION} | |
podman start devel-elasticsearch | |
echo "Start Redis" | |
podman volume create devel-redis 2> /dev/null ||: | |
podman create --replace --pod devel-services-pod \ | |
--name devel-redis \ | |
--volume devel-redis:/data:Z \ | |
docker.io/library/redis:${REDIS_VERSION} | |
podman start devel-redis | |
echo "Start PostgreSQL" | |
podman volume create devel-postgresql 2> /dev/null ||: | |
podman create --replace --pod devel-services-pod \ | |
--name devel-postgresql \ | |
--expose ${POSTGRESQL_PORT} \ | |
-e POSTGRES_PASSWORD=${POSTGRESQL_PASSWORD} \ | |
-e POSTGRES_USER=${POSTGRES_PASSWORD} \ | |
--volume devel-postgresql:/var/lib/postgresql/data:Z \ | |
docker.io/library/postgres:${POSTGRESQL_VERSION} | |
podman start devel-postgresql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment