From 6e09ae89e38351de1f3600c0725e7d99f855674b Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Tue, 21 Mar 2017 18:46:10 +0800 Subject: [PATCH] Use notary images based on photon, migrate db in notary's images --- Makefile | 8 +- .../notary/mysql-initdb.d/notary.sql | 210 ------------------ make/docker-compose.notary.yml | 10 +- 3 files changed, 8 insertions(+), 220 deletions(-) delete mode 100644 make/common/templates/notary/mysql-initdb.d/notary.sql diff --git a/Makefile b/Makefile index 24438977a..797cca15e 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ NOTARYFLAG=false REGISTRYVERSION=2.6.0 NGINXVERSION=1.11.5 PHOTONVERSION=1.0 -NOTARYVERSION=server-0.5.0-fix +NOTARYVERSION=server-0.5.0 NOTARYSIGNERVERSION=signer-0.5.0 MARIADBVERSION=10.1.10 HTTPPROXY= @@ -305,8 +305,8 @@ package_offline: compile build modify_composefile @$(DOCKERPULL) nginx:$(NGINXVERSION) @if [ "$(NOTARYFLAG)" = "true" ] ; then \ echo "pulling notary and mariadb..."; \ - $(DOCKERPULL) jiangd/notary:$(NOTARYVERSION); \ - $(DOCKERPULL) notary:$(NOTARYSIGNERVERSION); \ + $(DOCKERPULL) vmware/notary-photon:$(NOTARYVERSION); \ + $(DOCKERPULL) vmware/notary-photon:$(NOTARYSIGNERVERSION); \ $(DOCKERPULL) mariadb:$(MARIADBVERSION); \ fi @@ -319,7 +319,7 @@ package_offline: compile build modify_composefile $(DOCKERIMAGENAME_DB):$(VERSIONTAG) \ $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \ nginx:$(NGINXVERSION) registry:$(REGISTRYVERSION) photon:$(PHOTONVERSION) \ - jiangd/notary:$(NOTARYVERSION) notary:$(NOTARYSIGNERVERSION) mariadb:$(MARIADBVERSION); \ + vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) mariadb:$(MARIADBVERSION); \ else \ $(DOCKERSAVE) -o $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tgz \ $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \ diff --git a/make/common/templates/notary/mysql-initdb.d/notary.sql b/make/common/templates/notary/mysql-initdb.d/notary.sql deleted file mode 100644 index c9dcf9051..000000000 --- a/make/common/templates/notary/mysql-initdb.d/notary.sql +++ /dev/null @@ -1,210 +0,0 @@ --- MySQL dump 10.16 Distrib 10.1.10-MariaDB, for debian-linux-gnu (x86_64) --- --- Host: localhost Database: --- ------------------------------------------------------ --- Server version 10.1.10-MariaDB-1~jessie - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; --- --- Current Database: `notaryserver` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `notaryserver` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `notaryserver`; - --- --- Table structure for table `change_category` --- - -DROP TABLE IF EXISTS `change_category`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `change_category` ( - `category` varchar(20) NOT NULL, - PRIMARY KEY (`category`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `change_category` --- - -LOCK TABLES `change_category` WRITE; -/*!40000 ALTER TABLE `change_category` DISABLE KEYS */; -INSERT INTO `change_category` VALUES ('deletion'),('update'); -/*!40000 ALTER TABLE `change_category` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `changefeed` --- - -DROP TABLE IF EXISTS `changefeed`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `changefeed` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `gun` varchar(255) NOT NULL, - `version` int(11) NOT NULL, - `sha256` char(64) DEFAULT NULL, - `category` varchar(20) NOT NULL DEFAULT 'update', - PRIMARY KEY (`id`), - KEY `category` (`category`), - KEY `idx_changefeed_gun` (`gun`), - CONSTRAINT `changefeed_ibfk_1` FOREIGN KEY (`category`) REFERENCES `change_category` (`category`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `changefeed` --- - -LOCK TABLES `changefeed` WRITE; -/*!40000 ALTER TABLE `changefeed` DISABLE KEYS */; -/*!40000 ALTER TABLE `changefeed` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `schema_migrations` --- - -DROP TABLE IF EXISTS `schema_migrations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `schema_migrations` ( - `version` int(11) NOT NULL, - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `schema_migrations` --- - -LOCK TABLES `schema_migrations` WRITE; -/*!40000 ALTER TABLE `schema_migrations` DISABLE KEYS */; -INSERT INTO `schema_migrations` VALUES (1),(2),(3),(4),(5); -/*!40000 ALTER TABLE `schema_migrations` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `tuf_files` --- - -DROP TABLE IF EXISTS `tuf_files`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tuf_files` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `gun` varchar(255) NOT NULL, - `role` varchar(255) NOT NULL, - `version` int(11) NOT NULL, - `data` longblob NOT NULL, - `sha256` char(64) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `gun` (`gun`,`role`,`version`), - KEY `sha256` (`sha256`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `tuf_files` --- - -LOCK TABLES `tuf_files` WRITE; -/*!40000 ALTER TABLE `tuf_files` DISABLE KEYS */; -/*!40000 ALTER TABLE `tuf_files` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Current Database: `notarysigner` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `notarysigner` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `notarysigner`; - --- --- Table structure for table `private_keys` --- - -DROP TABLE IF EXISTS `private_keys`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `private_keys` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `key_id` varchar(255) NOT NULL, - `encryption_alg` varchar(255) NOT NULL, - `keywrap_alg` varchar(255) NOT NULL, - `algorithm` varchar(50) NOT NULL, - `passphrase_alias` varchar(50) NOT NULL, - `public` blob NOT NULL, - `private` blob NOT NULL, - `gun` varchar(255) NOT NULL, - `role` varchar(255) NOT NULL, - `last_used` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `key_id` (`key_id`), - UNIQUE KEY `key_id_2` (`key_id`,`algorithm`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `private_keys` --- - -LOCK TABLES `private_keys` WRITE; -/*!40000 ALTER TABLE `private_keys` DISABLE KEYS */; -/*!40000 ALTER TABLE `private_keys` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `schema_migrations` --- - -DROP TABLE IF EXISTS `schema_migrations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `schema_migrations` ( - `version` int(11) NOT NULL, - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `schema_migrations` --- - -LOCK TABLES `schema_migrations` WRITE; -/*!40000 ALTER TABLE `schema_migrations` DISABLE KEYS */; -INSERT INTO `schema_migrations` VALUES (1),(2); -/*!40000 ALTER TABLE `schema_migrations` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2017-02-14 6:32:48 diff --git a/make/docker-compose.notary.yml b/make/docker-compose.notary.yml index 7738c221f..a5ccfc0ae 100644 --- a/make/docker-compose.notary.yml +++ b/make/docker-compose.notary.yml @@ -7,7 +7,7 @@ services: networks: - harbor-notary notary-server: - image: jiangd/notary:server-0.5.0-fix + image: vmware/notary-photon:server-0.5.0 container_name: notary-server networks: - notary-mdb @@ -16,7 +16,7 @@ services: volumes: - ./common/config/notary:/config entrypoint: /usr/bin/env sh - command: -c "notary-server -config=/config/server-config.json -logf=logfmt" + command: -c "/migrations/migrate.sh && notary-server -config=/config/server-config.json -logf=logfmt" depends_on: - notary-db - notary-signer @@ -26,7 +26,7 @@ services: syslog-address: "tcp://127.0.0.1:1514" tag: "notary-server" notary-signer: - image: notary:signer-0.5.0 + image: vmware/notary-photon:signer-0.5.0 container_name: notary-signer networks: notary-mdb: @@ -38,7 +38,7 @@ services: env_file: - ./common/config/notary/signer_env entrypoint: /usr/bin/env sh - command: -c "notary-signer -config=/config/signer-config.json -logf=logfmt" + command: -c "/migrations/migrate.sh && notary-signer -config=/config/signer-config.json -logf=logfmt" depends_on: - notary-db logging: @@ -56,8 +56,6 @@ services: volumes: - ./common/config/notary/mysql-initdb.d:/docker-entrypoint-initdb.d - /data/notary-db:/var/lib/mysql - ports: - - "3306:3306" environment: - TERM=dumb - MYSQL_ALLOW_EMPTY_PASSWORD="true"