Git Product home page Git Product logo

mysql's Introduction

Build and deploy a mysql stack service initialized using build secrets and backup dump file(s)

Folder structure:

  • .secrets
    • .gitignore
  • mysql
    • src
      • .gitignore
    • Dockerfile
  • docker-compose.yml
  • README.md

The .gitignore files ensure folder contents are never published to github. The .gitignore file is the only file in folder published to github

Build and deploy mysql stack service using docker build secrets

  1. Login to ssh terminal (swarm server)
  2. Change directory
cd /opt/docker
  1. Clone mysql repo
git clone https://github.com/keramsey/mysql.git mysql
  1. Change to project directory
cd /opt/docker/mysql
  1. Copy database dump files (sql, sql.gz) to mysql/src folder (/opt/docker/mysql/mysql/src). Multiple dump files will be restored to mysql image in alphanumeric order, by file name
  2. Create 4 secrets files (MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD)
nano .secrets/mysql_root
nano .secrets/mysql_db
nano .secrets/mysql_usr
nano .secrets/mysql_pw
Note: Add desired secret value to each file before saving - Do not surround values with quotes
  mysql_root: MYSQL_ROOT_PASSWORD
  mysql_root: MYSQL_DATABASE
  mysql_usr:  MYSQL_USER
  mysql_pw:   MYSQL_PASSWORD
  1. Create network
docker create network --type=overlay mysql-net
  1. Build docker image using 4 build secrets created in step 5 - update image name and tag as needed
DOCKER_BUILDKIT=1 docker build --no-cache -t "mysql:1.0.0" --secret id=mysql_root,src=/opt/docker/mysql/.secrets/.mysql_root --secret id=mysql_db,src=/opt/docker/mysql/.secrets/.mysql_db --secret id=mysql_usr,src=/opt/docker/mysql/.secrets/.mysql_usr --secret id=mysql_pw,src=/opt/docker/mysql/.secrets/.mysql_pw ./mysql
  1. Deploy stack service (mysql_mysql)
docker stack deploy -c docker-compose.yml mysql

mysql's People

Contributors

keramsey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.