advancing blog configuration
This commit is contained in:
@@ -1 +1,20 @@
|
||||
A000004
|
||||
---
|
||||
- hosts: WHAT_HOST_IN_USE
|
||||
|
||||
tasks:
|
||||
- name: Creates directory DESTINATION_FOLDER
|
||||
ansible.builtin.file:
|
||||
path: DESTINATION_FOLDER
|
||||
state: directory
|
||||
mode: 0775
|
||||
recurse: yes
|
||||
|
||||
- name: Set up docker-compose file
|
||||
template:
|
||||
src: "WHAT_PART_LOCAL/docker-compose.yml"
|
||||
dest: "DESTINATION_FOLDER"
|
||||
|
||||
- name: docker compose up
|
||||
shell:
|
||||
chdir: "DESTINATION_FOLDER/"
|
||||
cmd: docker-compose up -d
|
||||
@@ -5,14 +5,14 @@ services:
|
||||
container_name: WHAT_CONTAINER_NAME
|
||||
image: wordpress:latest
|
||||
ports:
|
||||
- '8010:80'
|
||||
- 'ALLOCATED_PORT:80'
|
||||
restart: always
|
||||
volumes: ['DESTINATION_FOLDER:/var/www/html']
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: db:3306
|
||||
WORDPRESS_DB_USER: bloguser
|
||||
WORDPRESS_DB_PASSWORD: bloguserF22!
|
||||
WORDPRESS_DB_NAME: wrenchboard
|
||||
WORDPRESS_DB_PASSWORD: CNT_DB_PASS
|
||||
WORDPRESS_DB_NAME: CNT_DB_NAME
|
||||
networks:
|
||||
- wpsite
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
wordpress-WHAT_CONTAINER_NAME:
|
||||
container_name: WHAT_CONTAINER_NAME
|
||||
image: wordpress:latest
|
||||
ports:
|
||||
- 'ALLOCATED_PORT:80'
|
||||
restart: always
|
||||
volumes: ['DESTINATION_FOLDER:/var/www/html']
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: db:3306
|
||||
WORDPRESS_DB_USER: bloguser
|
||||
WORDPRESS_DB_PASSWORD: CNT_DB_PASS
|
||||
WORDPRESS_DB_NAME: CNT_DB_NAME
|
||||
networks:
|
||||
- wpsite
|
||||
|
||||
networks:
|
||||
wpsite:
|
||||
|
||||
@@ -18,19 +18,19 @@ class Home extends BaseController
|
||||
mkdir($ansible_folder."/parts", 0700);
|
||||
}
|
||||
|
||||
$mysql = "SELECT id, uid, internal_url,product_id,status FROM members_products";
|
||||
$mysql = "SELECT id, uid, internal_url,product_id,status,provision_port FROM members_products WHERE provision_port = 0 ";
|
||||
$query = $this->db->query($mysql);
|
||||
// $num = $query->num_rows();
|
||||
$provision_list= $query->getResult();
|
||||
//$provision_list =[];
|
||||
foreach ($provision_list as $pr){
|
||||
|
||||
$provisionPort = $pr->provision_port;
|
||||
$productId = $pr->product_id;
|
||||
$provisionUID = $pr->uid;
|
||||
$ContainerName= $productId.str_pad( $pr->id, 10, "0", STR_PAD_LEFT);
|
||||
$partFolder = $ansible_folder."/parts/".$provisionUID;
|
||||
|
||||
|
||||
$allocatedPort = 8011;
|
||||
|
||||
if (!is_dir($partFolder) ){
|
||||
mkdir($partFolder, 0700);
|
||||
@@ -49,6 +49,9 @@ class Home extends BaseController
|
||||
$composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents);
|
||||
$destinationHomeFolder = "/home/chiefsoft/SITES/".$ContainerName;
|
||||
$composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents);
|
||||
$composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents);
|
||||
$composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents);
|
||||
$composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents);
|
||||
|
||||
//Save to the specific path
|
||||
$destination_composer_path = $ansible_folder."/parts/".$provisionUID."/docker-compose.yml";
|
||||
|
||||
Reference in New Issue
Block a user