diff options
author | Camil Staps | 2017-02-07 14:08:22 +0100 |
---|---|---|
committer | Camil Staps | 2017-02-07 14:08:22 +0100 |
commit | 6c225f4d477bb55c367ffb48175fdb085e8128ef (patch) | |
tree | 01073c4b578cacb4c359b90d3516e60b0cd2b839 | |
parent | Initial commit (diff) |
Dockerise
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | db/install.sql | 48 | ||||
-rw-r--r-- | docker-compose.yml | 31 | ||||
-rw-r--r-- | frontend/.htaccess | 1 | ||||
-rw-r--r-- | frontend/Dockerfile | 3 | ||||
-rw-r--r-- | frontend/conf.php (renamed from conf.php) | 6 | ||||
-rw-r--r-- | frontend/list.php (renamed from list.php) | 0 |
7 files changed, 88 insertions, 4 deletions
@@ -1 +1,2 @@ -repo +db/storage +frontend/repo diff --git a/db/install.sql b/db/install.sql new file mode 100644 index 0000000..f58cf5b --- /dev/null +++ b/db/install.sql @@ -0,0 +1,48 @@ +CREATE TABLE `author` ( + `id` tinyint(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` varchar(64) NOT NULL, + `email` varchar(256) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `job` ( + `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `package_id` smallint(5) UNSIGNED NOT NULL, + `major` tinyint(3) UNSIGNED NOT NULL, + `minor` tinyint(3) UNSIGNED NOT NULL, + `revision` tinyint(3) UNSIGNED NOT NULL, + `time_scheduled` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `time_started` datetime DEFAULT NULL, + `time_finished` datetime DEFAULT NULL, + `result_code` tinyint(3) UNSIGNED DEFAULT NULL, + `log` text +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `package` ( + `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `author_id` tinyint(3) UNSIGNED NOT NULL, + `name` varchar(63) NOT NULL, + `url` varchar(2047) NOT NULL, + `desc` text NOT NULL, + `time_added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `version` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `package_id` smallint(5) UNSIGNED NOT NULL, + `major` tinyint(3) UNSIGNED NOT NULL, + `minor` tinyint(3) UNSIGNED NOT NULL, + `revision` tinyint(3) UNSIGNED NOT NULL, + `time_added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `depends` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE `author` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `name` (`name`); + +ALTER TABLE `package` + ADD UNIQUE KEY `name` (`name`), + ADD FULLTEXT KEY `description` (`desc`); + +ALTER TABLE `version` + ADD KEY `package` (`package_id`); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b9a2a86 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '2' +services: + db: + image: mysql:latest + volumes: + - "./db/:/docker-entrypoint-initdb.d/" + - "./db/storage/:/var/lib/mysql/" + environment: + MYSQL_ROOT_PASSWORD: clpm + MYSQL_DATABASE: clpmdb + MYSQL_USER: clpm + MYSQL_PASSWORD: clpm + restart: always + + frontend: + build: frontend + depends_on: + - db + ports: + - "80:80" + volumes: + - "./frontend/:/var/www/html/" + restart: always + +# buildslave: +# build: buildslave +# depends_on: +# - db +# volumes: +# - "./frontend/repo:/repo" +# restart: always diff --git a/frontend/.htaccess b/frontend/.htaccess new file mode 100644 index 0000000..e1d2560 --- /dev/null +++ b/frontend/.htaccess @@ -0,0 +1 @@ +Options +Indexes diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..e9e468b --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,3 @@ +FROM php:apache + +RUN docker-php-ext-install mysqli diff --git a/conf.php b/frontend/conf.php index 5765a11..f47a7cb 100644 --- a/conf.php +++ b/frontend/conf.php @@ -1,8 +1,8 @@ <?php -define('DB_HOST', 'localhost'); -define('DB_NAME', 'clpm'); +define('DB_HOST', 'db'); +define('DB_NAME', 'clpmdb'); define('DB_USER', 'clpm'); -define('DB_PASS', 'password'); +define('DB_PASS', 'clpm'); $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) diff --git a/list.php b/frontend/list.php index 24340a8..24340a8 100644 --- a/list.php +++ b/frontend/list.php |