Easy environment construction of MySQL and Redis with Docker and Alfred

Introduction

This is the article on the 15th day of the 2020 XTech Group Advent Calendar. I'm Nishimaki, a new graduate of Excite Japan Co., Ltd.

This time, I would like to introduce how to easily build an environment for MySQL and Redis with Docker and Alfred. What you need You can start it with Docker and call it from anywhere with Alfred. The code is here.

environment

macOS: 10.15.1 docker-compose: 1.27.4 Alfred: 4.0.9

Launch everything with docker-compose

Launch the following with docker-compose.

Use adminer for the MySQL GUI client and redis-insight for the Redis GUI client. The reason is that the web app was better than the desktop app (I personally want to complete it on the web as much as possible) and it is lightweight. By the way, I used to use Sequel Pro and Medis, but neither is very easy to use, and I personally prefer adminer and redisinsight.

$ docker-compose up -d
version: '3'

services:
  redis:
    image: redis:latest
    restart: always
    ports:
      - 6378:6379
    command: redis-server /usr/local/etc/redis/redis.conf
    volumes:
      - ./redis/data:/data
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf

  redisinsight:
    image: redislabs/redisinsight
    restart: always
    ports:
      - 8011:8001
    volumes:
      - ./redisinsight:/db
    depends_on: 
      - redis

  mysql:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_USER: docker
      MYSQL_PASSWORD: docker
      MYSQL_ROOT_PASSWORD: local_root_password
      MYSQL_DATABASE: db
    ports:
      - 3307:3306
    volumes:
      - ./mysql/data:/var/lib/mysql
      - ./mysql/conf.d:/etc/mysql/conf.d

  adminer:
    image: adminer:latest
    restart: always
    environment:
      # choose your favorite design from https://www.adminer.org/
      ADMINER_DESIGN: lucas-sandery
    ports:
      - 8090:8080
    depends_on:
      - mysql

Operation check

Once launched, open a GUI client and try connecting to MySQL and Redis.

When you open adminer, it looks like this. The design can be changed with environment variables. For the connection information server, enter the service name mysql written in docker-compose.yml. image.png

image.png

redisinsight looks like this. The connection information is as follows.

image.png

image.png

Allow GUI clients to be called from anywhere

Use Alfred. What is Alfred? For those who say, To you who are not good at using Alfred![Complete version of how to use Alfred] It's kind of like an upward compatibility for spotlight search. If you register http: // localhost: 8090/in Alfred's Web Search, you don't need to remember the port number and you can call it from anywhere, which is convenient. Web Search means that if you register a URL with a keyword, you can open the registered URL in your browser by executing the keyword in Alfred. Try to register http: // localhost: 8090/as shown in the image.

image.png

After registration, when you execute it, the registered URL will open automatically. image.png

in conclusion

Recently, the number of tools that can be installed with Docker is increasing, so I thought that if you use it well, it seems that the onboarding cost will be reduced. Please try it out ~

Recommended Posts

Easy environment construction of MySQL and Redis with Docker and Alfred
[Environment construction with Docker] Rails 6 & MySQL 8
Laravel + MySQL + phpMyadmin environment construction with Docker
Rails6 [API mode] + MySQL5.7 environment construction with Docker
A reminder of Docker and development environment construction
React + Django + Nginx + MySQL environment construction with Docker
MySQL 5.7 (Docker) environment construction memo
[Docker] Rails 5.2 environment construction with docker
React environment construction with Docker
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
Node.js environment construction with Docker Compose
Environment construction with Docker for beginners
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
SQL statement learning ~ Environment construction ~ Docker + MySQL
Easy installation of Docker with snap (1 command)
GPU environment construction with Docker [October 2020 version]
Rails environment construction with Docker (personal apocalypse)
Building Rails 6 and PostgreSQL environment with Docker
Laravel development environment construction with Docker (Mac)
Create Rails 6 + MySQL environment with Docker compose
Environment construction with Docker (Ubuntu20.04) + Laravel + nginx
Edit Mysql with commands in Docker environment
Create a MySQL environment with Docker from 0-> 1
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Environment construction summary with rvm and postgresql
Docker environment construction
I built a rails environment with docker and mysql, but I got stuck
[Rails API x Docker] Easy environment construction with shell & operation check with Flutter
Spring Boot environment construction with Docker (January 2021 version)
Docker + DynamoDB local + C ++ environment construction and practice
Self-hosting with Docker of AuteMuteUs in Windows environment
Environment construction command memo with Docker on AWS
Kaggle environment construction using official Docker and vscode
Build a web application development environment that uses Java, MySQL, and Redis with Docker CE for Windows
Prepare a scraping environment with Docker and Java
Wordpress local environment construction & development procedure with Docker
Building an environment for WordPress, MySQL and phpMyAdmin with Docker Compose on EC2
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
Rails Docker environment construction
[Docker] Connection with MySQL
virtulbox + vagrant + Docker + nginx + puma + MySQL Rails environment construction
Build an environment of Ruby2.7.x + Rails6.0.x + MySQL8.0.x with Docker
Build Rails (API) x MySQL x Nuxt.js environment with Docker
Build WordPress environment with Docker (Local) and AWS (Production)
Comfortable Docker environment created with WSL2 CentOS7 and Docker Desktop
Database environment construction with Docker in Spring boot (IntellJ)
Construction of data analysis environment using Docker (personal memorandum)
Environment construction method and troubleshooter at the time of joint development (rails, docker and github)
Environment construction of keras and tensorflow, jupyter lab by docker and connection to jupyter by port forwarding
Pytorch execution environment with Docker
Overview of Docker and containers
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
[Portfolio] Manage site with laravel APP implementation (Docker environment construction)
Redmine (Docker) environment construction memo
Case that gave up environment construction of react with ubuntu
Build docker environment with WSL
Build a Node-RED environment with Docker to move and understand
Docker × Spring Boot environment construction
[Super easy] Ruby environment construction