### Install GitPython from Source
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/README.md
Installs GitPython by executing the setup script directly from the downloaded source code. This method ensures all necessary components are compiled and installed locally.
```bash
python setup.py install
```
--------------------------------
### JSON Configuration for Environment Cloning
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
This JSON configuration defines the steps for cloning an environment, including node setup, application deployment, file uploads, database creation, configuration replacements, and domain binding. It specifies actions to be performed after cloning (`onAfterClone`) and during installation (`onInstall`).
```json
{
"type": "install",
"name": "cloneEnv",
"nodes": [
{
"cloudlets": 16,
"nodeType": "tomcat7"
},
{
"cloudlets": 16,
"nodeType": "mysql5"
}
],
"onAfterClone": {
"script": "https://download.jelastic.com/public.php?service=files&t=a6a659b4fcb85f4289559747b5568e4e&download"
},
"onInstall": {
"call": [
"deployApp",
"uploadFiles",
"createDb",
"replaceInFiles",
"bindDomain"
]
},
"actions": [
{
"deployApp": {
"deploy": [
{
"archive": "https://download.jelastic.com/public.php?service=files&t=c3afe9748a679a132d47c0148978e3b2&download",
"name": "share-5.0.war",
"context": "share"
},
{
"archive": "https://download.jelastic.com/public.php?service=files&t=91924607b72d9211c38cfe111d424263&download",
"name": "alfresco-5.0.war",
"context": "alfresco"
}
]
}
},
{
"uploadFiles": {
"upload [nodeGroup:cp]": [
{
"sourcePath": "http://app.jelastic.com/xssu/cross/download/RTYYHA81VwNaVlRAYAw4TUMVCRBUShURWBZsHH8iIlYQQktYDwIBQmNTTEBI",
"destPath": "${WEBAPPS}/alfresco/WEB-INF/classes/alfresco-global.properties"
},
{
"sourcePath": "http://app.jelastic.com/xssu/cross/download/QjYYHA81VwNaVlRAYAw4TUMVCRBUShURWBZsHH8iIlYQQktYDwIBQmNTTEBI",
"destPath": "${JAVA_LIB}/mysql-connector-java-5.0.8-bin.jar"
}
]
}
},
{
"createDb": {
"execCmd [nodeGroup:sqldb]": [
"curl \"https://download.jelastic.com/public.php?service=files&t=0f65b115eb5b9cdb889d135579414321&download\" -o /tmp/script.sh 2>&1",
"bash /tmp/script.sh \"${nodes.sqldb.password}\" 2>&1"
]
}
},
{
"replaceInFiles": {
"replaceInFile [nodeGroup:cp]": [
{
"path": "${WEBAPPS}/alfresco/WEB-INF/classes/alfresco-global.properties",
"replacements": [
{
"pattern": "{DB_HOST}",
"replacement": "${nodes.mysql5.address}"
},
{
"pattern": "{DB_USER}",
"replacement": "root"
},
{
"pattern": "{DB_PASSWORD}",
"replacement": "${nodes.mysql5.password}"
},
{
"pattern": "{DB_NAME}",
"replacement": "alfresco"
}
]
},
{
"path": "/opt/tomcat/webapps/alfresco/index.jsp",
"replacements": [
{
"pattern": "{HOSTNAME}",
"replacement": "${env.url}"
}
]
}
]
}
},
{
"bindDomain": {
"script": "https://download.jelastic.com/public.php?service=files&t=6f5ccac2b011cbc1d6239464ea0a4c97&download"
}
}
],
"success": "Below you will find your admin panel link, username and password.
To bind a custom domain name with your Alfresco please refer to the steps described in Jelastic documentation"
}
```
--------------------------------
### Install Lsyncd
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
Installs the lsyncd (Live Syncing Daemon) by removing existing installations, creating a directory, uploading the archive, and unpacking it. This facilitates real-time file synchronization.
```bash
rm -rf ${SERVER_WEBROOT}/lsyncd
createDirectory [${this.nodeId}] ${SERVER_WEBROOT}/lsyncd
unpack [${this.nodeId}]
```
--------------------------------
### StartPage Configuration for Install Type (with environment)
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/basic-configs.md
Example of setting a 'startPage' parameter for an 'install' type JPS with an environment, allowing relative or absolute links. The 'Open in browser' button is always displayed.
```yaml
type: install
baseUrl: https://docs.cloudscripting.com/
nodes:
nodeType: apache
cloudlets: 8
startPage: ${baseUrl}creating-manifest/basic-configs/
```
```json
{
"type": "install",
"baseUrl": "https://docs.cloudscripting.com/",
"nodes": {
"nodeType": "apache",
"cloudlets": 8
},
"startPage": "${baseUrl}creating-manifest/basic-configs/"
}
```
--------------------------------
### StartPage Configuration for Install Type (without environment)
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/basic-configs.md
Example for an 'install' type JPS without an environment. The 'Open in browser' button appears only if 'startPage' is specified, which must be an absolute link.
```yaml
type: install
nodes:
nodeType: apache
cloudlets: 8
startPage: ${env.url}customDirectory/
```
```json
{
"type": "install",
"nodes": {
"nodeType": "apache",
"cloudlets": 8
},
"startPage": "${env.url}customDirectory/"
}
```
--------------------------------
### WordPress Session Start Configuration
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
This snippet demonstrates a modification to the `wp-config.php` file to ensure PHP sessions are started automatically when WordPress loads, which is crucial for certain functionalities.
```Shell/Configuration
Please wait while we pull, build and deploy your project. The process may take several minutes before you get the application up and running."
}
```
--------------------------------
### Live Preview Documentation with Yarn
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/development.md
Command to start a live preview server for the documentation using Yarn. This command watches for changes and automatically updates the browser, facilitating rapid iteration.
```Shell
yarn serve
```
--------------------------------
### Hello World Manifest Example
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/quick-start.md
This manifest defines a new environment for the Cloud Scripting solution. It specifies an Apache 2 application server running on PHP 5.4. The configuration includes deploying a Hello World application archive from a provided URL to the ROOT context.
```yaml
type: install
name: Hello World!
engine: php5.4
nodes:
nodeType: apache2
cloudlets: 16
onInstall:
deploy:
archive: http://app.demo.jelastic.com/HelloWorld.zip
name: Hello World
context: ROOT
```
```json
{
"type": "install",
"name": "Hello World!",
"engine": "php5.4",
"nodes": {
"nodeType": "apache2",
"cloudlets": 16
},
"onInstall": {
"deploy": {
"archive": "http://app.demo.jelastic.com/HelloWorld.zip",
"name": "Hello World",
"context": "ROOT"
}
}
}
```
--------------------------------
### Install Python-Markdown via Pip
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/markdown/docs/install.md
Installs the Python-Markdown package using pip. This is the simplest and recommended method for most users to get the latest stable release.
```bash
pip install markdown
```
--------------------------------
### Configure Minecraft Server Environment
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/complex-ready-to-go-solutions.md
Sets up a Minecraft server environment by downloading necessary files, configuring properties, and ensuring correct permissions. Includes steps for starting the server and a web interface.
```shell
echo "eula=true" > /data/eula.txt
sed -i "/usermod\|groupmod/d" /start
wget https://github.com/jelastic-jps/minecraft-server/raw/master/properties/server.properties -O /data/server.properties
wget https://github.com/jelastic-jps/minecraft-server/raw/master/lib/jelastic-gc-agent.jar -O /data/jelastic-gc-agent.jar
wget https://github.com/jelastic-jps/minecraft-server/raw/master/scripts/memoryConfig.sh -O /data/memoryConfig.sh
wget https://github.com/jelastic-jps/minecraft-server/raw/master/scripts/start-server.sh -O /start-server.sh
chmod +x /start-server.sh
mkdir -p /data/web/
chown -R minecraft:minecraft /data
wget https://github.com/jelastic-jps/minecraft-server/raw/master/web/index.html -O /data/web/index.html
wget https://github.com/jelastic-jps/minecraft-server/raw/master/scripts/start-web.sh -O /data/start-web.sh
bash /data/start-web.sh
```
--------------------------------
### Install Requests Library
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/development.md
Installs the Python Requests library, which is a prerequisite for the emoji index generation script.
```shell
pip install requests
```
--------------------------------
### Install Tox
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/development.md
Installs the Tox tool, which is used for automating testing in isolated virtual environments. This is a prerequisite for running validation checks with Tox.
```bash
pip install tox
```
--------------------------------
### Upload Docs to PyPI using MkDocs and Python
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/mkdocs/docs/user-guide/deploying-your-docs.md
This process uploads your MkDocs generated documentation to `pythonhosted.org` for projects hosted on PyPI. It requires building the documentation first and then using Python's `setup.py` script. Ensure your project is registered with PyPI and uses Setuptools.
```sh
mkdocs build
python setup.py upload_docs --upload-dir=site
```
--------------------------------
### Install Node.js Dependencies
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/development.md
Command to install all necessary Node.js modules required for theme development and documentation building. This is performed using the Yarn package manager.
```Shell
yarn install
```
--------------------------------
### Clone and Initialize Repos
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/doc/source/tutorial.rst
Shows how to clone from existing repositories or initialize new empty ones using GitPython. This is fundamental for setting up new projects or fetching existing ones.
```python
from git import Repo
# Clone a repository from a URL
cloned_repo = Repo.clone_from("https://github.com/gitpython-developers/GitPython.git", "./GitPython")
# Initialize a new empty repository
# This creates a .git directory in the specified path
new_repo = Repo.init("./my_new_repo")
```
--------------------------------
### Jelastic JPS Manifest: Install Add-on
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
A JSON manifest for Jelastic Platform Services (JPS) to install an add-on, specifically 'setExtIp', within an Apache PHP environment. It configures the add-on's behavior on installation and uninstallation, enabling/disabling external IP attachment.
```json
{
"type": "install",
"name": "example",
"nodes": [
{
"nodeType": "apache2",
"cloudlets": "16",
"addons": [
"setExtIp"
]
}
],
"engine": "php7.0",
"addons": {
"id": "setExtIp",
"onInstall": "attacheIp",
"onUnInstall": "deAttacheIp",
"actions": {
"attacheIp": {
"setExtIpEnabled": {
"nodeType": "apache2",
"enabled": true
}
},
"deAttacheIp": {
"setExtIpEnabled": {
"nodeType": "apache2",
"enabled": false
}
}
}
},
"success": "Environment with add-on installed successfully!"
}
```
--------------------------------
### Install GitPython using setup.py
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/doc/source/intro.rst
This command installs GitPython directly from its source distribution using the setup.py script. Manual installation of GitDB is required when using this method.
```shell
# python setup.py install
```
--------------------------------
### Configure Logger Name for JPS Installations
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/troubleshooting.md
Demonstrates how to set a custom logger name for Cloud Scripting JPS installations to distinguish logs from multiple identical JPS deployments. Examples show configuration within the 'install' action and via API requests.
```yaml
install:
- jps: https://example.com/manifest.jps
loggerName: Test 1
- jps: https://example.com/manifest.jps
loggerName: Test 2
```
```yaml
install:
- loggerName: Test 1
jps:
type: install
name: test
onInstall:
log: Test
- loggerName: Test 2
jps:
type: install
name: test
onInstall:
log: Test
```
```APIDOC
api.marketplace.jps.Install({
jps: "https://example.com/manifest.jps",
loggerName: "Test 1"
});
```
--------------------------------
### Virtuozzo: Example Configuration for onBeforeInit
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/events.md
Demonstrates a YAML configuration snippet for the onBeforeInit event, showing how to dynamically add fields to the settings, including account and quota placeholders.
```yaml
type: install
name: Account And Quota Placeholders
settings:
fields:
- type: owner
caption: Owner
name: ownerUid
onBeforeInit: |
settings.fields.push({
type: "string",
caption: "Account",
name: "email",
value: "${account.email}"
}, {
type: "string",
caption: "Cloudlets",
name: "cloudlets",
value: "${quota.environment.maxcloudletsperrec}"
});
return settings;
```
--------------------------------
### Serve Documentation Locally
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/development.md
Command to build and serve the project documentation locally using MkDocs. This allows developers to preview changes in real-time at `localhost:8000`.
```Shell
mkdocs serve
```
--------------------------------
### Install Add-on Targeting Node Group
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/actions.md
This example demonstrates how to use the `installAddon` action with the `nodeGroup` parameter to specifically target an add-on for installation on a particular node group, such as the balancer ('bl') nodes.
```yaml
installAddon:
id: firstAddon
nodeGroup: bl
```
```json
{
"installAddon": {
"id": "firstAddon",
"nodeGroup": "bl"
}
}
```
--------------------------------
### Create and Navigate MkDocs Project
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/mkdocs/docs/index.md
Initial commands to create a new MkDocs project directory and navigate into it. This sets up the basic file structure for your documentation.
```bash
mkdocs new my-project
cd my-project
```
--------------------------------
### Example Configuration with Placeholders
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/placeholders.md
Demonstrates how to use account and quota placeholders within a cloudscripting configuration file. The example shows setting fields for an installation script using `${account.email}` and `${quota.environment.maxcloudletsperrec}`.
```yaml
type: install
name: Account And Quota Placeholders
settings:
fields: []
onBeforeInit: |
settings.fields.push({
type: "string",
caption: "Account",
name: "email",
value: "${account.email}"
}, {
type: "string",
caption: "Cloudlets",
name: "cloudlets",
value: "${quota.environment.maxcloudletsperrec}"
});
return settings;
```
```json
{
"type": "install",
"name": "Account And Quota Placeholders",
"settings": {
"fields": [
],
"onBeforeInit": [
"settings.fields.push({",
" type: 'string',",
" caption: 'Account',",
" name: 'email',",
" value: '${account.email}'",
"},",
"{",
" type: 'string',",
" caption: 'Cloudlets',",
" name: 'cloudlets',",
" value: '${quota.environment.maxcloudletsperrec}'",
"});",
"return settings;"
]
}
}
```
--------------------------------
### Initializing a Repository, Adding File, and Committing
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/doc/source/tutorial.rst
Illustrates the process of initializing a new Git repository, adding an empty file to the index, and then committing this change.
```python
import git
import os
# Create a temporary directory for the new repository
repo_dir = "./temp_repo"
os.makedirs(repo_dir, exist_ok=True)
# Initialize a new repository
repo = git.Repo.init(repo_dir)
# Create an empty file
file_path = os.path.join(repo_dir, "new_file.txt")
with open(file_path, "w") as f:
f.write("Initial content")
# Add the file to the index
repo.index.add([file_path])
# Commit the change
commit_message = "Initial commit: Add new_file.txt"
repo.index.commit(commit_message)
print(f"Repository initialized and committed in: {repo_dir}")
```
--------------------------------
### Start Docs Web Server with Devbox (Local)
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/README.md
Two methods to start the documentation web server using Devbox locally. The first uses `devbox run`, and the second enters a Devbox shell first before running the serve task.
```bash
devbox run serve
```
```bash
devbox shell
task serve
```
--------------------------------
### Environment Configuration for Swap Domain
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/swap-domain.md
This JSON configuration defines the setup for an environment, specifying application details, topology, and installation procedures. It includes the application name, engine type, node configurations, and a script to be executed on installation.
```json
{
"type": "install",
"application": {
"name": "swapDomain",
"env": {
"topology": {
"engine": "php5.3",
"nodes": [{
"cloudlets": 6,
"nodeType": "nginxphp"
}]
}
},
"onInstall": {
"call": ["secondEnvInstallation"]
},
"procedures": [{
"id": "secondEnvInstallation",
"onCall": [{
"executeScript": {
"type": "javascript",
"script": "https://download.jelastic.com/public.php?service=files&t=6922fed7efb17261e038bfc6d8947924&download"
}
}]
}]
}
}
```
--------------------------------
### Install Add-on via Manifest
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/actions.md
This snippet shows how to use the `installAddon` action within a manifest to install a custom add-on. It includes the add-on's identifier and configuration details, demonstrating a common use case for deploying add-ons during environment setup.
```yaml
type: update
name: Install Add-on example
onInstall:
installAddon:
id: firstAddon
addons:
- id: firstAddon
name: firstAddon
onInstall:
createFile [cp]: /tmp/exampleFile.txt
```
```json
{
"type": "update",
"name": "Install Add-on example",
"onInstall": {
"installAddon": {
"id": "firstAddon"
}
},
"addons": [{
"id": "firstAddon",
"name": "firstAddon",
"onInstall": {
"createFile [cp]": "/tmp/exampleFile.txt"
}
}]
}
```
--------------------------------
### Install MkDocs for Development (Bash)
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/mkdocs/docs/about/contributing.md
Installs MkDocs in development mode from a local repository clone. This command binds the 'mkdocs' command-line interface to your local repository, allowing you to work on MkDocs directly. A virtual environment is highly recommended for this setup.
```bash
pip install --editable .
```
--------------------------------
### MariaDB Replication Install Manifest
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/complex-ready-to-go-solutions.md
JSON manifest file for installing MariaDB with master-slave replication. It defines installation parameters, node configurations, and a sequence of actions to set up replication.
```json
{
"type": "install",
"categories": [
"apps/clustered-dbs",
"apps/clusters"
],
"logo": "https://raw.githubusercontent.com/jelastic-jps/mariadb-replication/master/images/maria.png",
"description": "Master-slave replication is used to solve performance problems, to support the db backups, and to alleviate system failures. It enables data from one database server (master) to be replicated to another (slave)",
"name": "MariaDB Database Replication",
"nodes": {
"cloudlets": 16,
"count": 2,
"nodeType": "mariadb"
},
"onInstall": "configureReplication",
"actions": {
"configureReplication": [
{
"replaceInFile [nodeMission:sqldb]": {
"path": "${SYSTEM_ETC}/my.cnf",
"replacements": [
{
"pattern": ".*log-bin.*",
"replacement": "log-bin=mysql-bin"
},
{
"pattern": ".*autoconfiguration mark.*",
"replacement": "\n"
}
]
}
},
{
"replaceInFile [nodeId:${nodes.sqldb[0].id}]": {
"path": "${SYSTEM_ETC}/my.cnf",
"replacements": [
{
"pattern": "server-id\s*= 1",
"replacement": "server-id = 2"
}
]
}
},
{
"restartNodes": {
"nodeMission": "sqldb"
}
},
{
"execCmd [nodeId:${nodes.sqldb[0].id}]": [
"mysql -uroot -p${nodes.sqldb.password} -e \"GRANT REPLICATION SLAVE ON *.* TO rpl@${nodes.sqldb[1].address} IDENTIFIED BY 'rpl';\" 2>&1",
"mysqlreplicate --master=root:${nodes.sqldb.password}@${nodes.sqldb[0].address}:${nodes.sqldb.port} --slave=root:${nodes.sqldb.password}@${nodes.sqldb[1].address}:${nodes.sqldb.port} --rpl-user=rpl:rpl 2>&1"
]
},
{
"restartNodes": {
"nodeMission": "sqldb"
}
}
]
},
"homepage": "http://docs.jelastic.com/mariadb-master-slave-replication",
"appVersion": "0.1",
"success": "The environment with multiple databases has been successfully created. The login and password of your database servers are sent to your email.\nPlease wait a minute for the replication settings to be completed. The process can be monitored in the cron > mysql file of your database servers. This file becomes empty when the configurations are finished.
To add custom domain name for your MariaDB installation follow the steps described in our documentation"
}
```
--------------------------------
### Manual Installation of PyMdown Extensions
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/pymdown-extensions/docs/src/markdown/installation.md
Manually builds and installs PyMdown Extensions using the setup.py script. This method is useful for custom builds or when pip is not available.
```bash
python setup.py build
python setup.py install
```
--------------------------------
### Bash: Start Lsyncd Daemon and Configure Cron Job
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
This snippet demonstrates Bash commands for starting the `lsyncd` daemon and configuring a cron job to periodically execute an initialization script. This ensures continuous file synchronization and proper daemon management.
```Bash
${SERVER_WEBROOT}/lsyncd/usr/bin/lsyncd ${SERVER_WEBROOT}/lsyncd/etc/lsyncd.conf &>> ${SERVER_WEBROOT}/lsyncd/var/log/lsyncd_start.log
*/5 * * * * /bin/bash ${SERVER_WEBROOT}/lsyncd/init.sh
```
--------------------------------
### Execute Commands During Installation
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/creating-manifest/actions.md
Defines commands to be executed during the 'onInstall' phase for a specific node group. This allows pre-configuration or setup tasks for new deployments.
```yaml
type: update
name: Cmd commands
onInstall:
cmd:
- echo 'Hello ' >> /tmp/CmdResponse.txt
- echo 'World ' >> /tmp/CmdResponse.txt
nodeGroup: cp
```
```json
{
"type": "update",
"name": "Cmd commands",
"onInstall": {
"cmd": [
"echo 'Hello ' >> /tmp/CmdResponse.txt",
"echo 'World!!!' >> /tmp/CmdResponse.txt"
],
"nodeGroup": "cp"
}
}
```
--------------------------------
### Initialize Repo Object
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/doc/source/tutorial.rst
Demonstrates creating a `git.Repo` object to represent a repository, typically a working directory. This is the first step to interact with a Git repository using GitPython.
```python
from git import Repo
# Initialize a repository object from a path
# The path should point to the .git directory or the working tree root
repo = Repo("/Users/mtrier/Development/git-python")
# Verify it's a valid repository
assert not repo.bare
```
--------------------------------
### Environment Manifest with External IP Add-on
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/addon-inside-manifest.md
This JSON manifest defines the configuration for an environment setup. It specifies the use of an Apache PHP server with PHP 7.0, and includes an 'setExtIp' add-on to manage the attachment and detachment of an external IP address. The manifest details the actions to be performed on installation and uninstallation.
```json
{
"type": "install",
"name": "example",
"nodes": [
{
"nodeType": "apache2",
"cloudlets": "16",
"addons": [
"setExtIp"
]
}
],
"engine": "php7.0",
"addons": {
"id": "setExtIp",
"onInstall": "attacheIp",
"onUnInstall": "deAttacheIp",
"actions": {
"attacheIp": {
"setExtIpEnabled": {
"nodeType": "apache2",
"enabled": true
}
},
"deAttacheIp": {
"setExtIpEnabled": {
"nodeType": "apache2",
"enabled": false
}
}
}
},
"success": "Environment with add-on installed successfully!"
}
```
--------------------------------
### MySQL Replication Setup
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/wordpress-cluster.md
Configures MySQL for replication by enabling binary logging, setting unique server IDs, and granting replication privileges to a dedicated user.
```bash
mysql -uroot -p${nodes.sqldb.password} -e "GRANT REPLICATION SLAVE ON *.* TO rpl@${nodes.sqldb[1].address} IDENTIFIED BY 'rpl';" 2>&1
mysqlreplicate --master=root:${nodes.sqldb.password}@${nodes.sqldb[0].address}:${nodes.sqldb.port} --slave=root:${nodes.sqldb.password}@${nodes.sqldb[1].address}:${nodes.sqldb.port} 2>&1
```
--------------------------------
### Configure MySQL Replication Settings
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/operation-examples.md
Sets up MySQL replication by modifying the my.cnf configuration file to enable binary logging and assign unique server IDs. It also configures replication users and initiates the replication process between nodes.
```mysql
GRANT REPLICATION SLAVE ON *.* TO rpl@${nodes.sqldb[1].address} IDENTIFIED BY 'rpl';
```
```bash
mysqlreplicate --master=root:${nodes.sqldb.password}@${nodes.sqldb[0].address}:${nodes.sqldb.port} --slave=root:${nodes.sqldb.password}@${nodes.sqldb[1].address}:${nodes.sqldb.port} 2>&1
```
```mysql
GRANT REPLICATION SLAVE ON *.* TO rpl@${nodes.sqldb[0].address} IDENTIFIED BY 'rpl';
```
```bash
mysqlreplicate --master=root:${nodes.sqldb.password}@${nodes.sqldb[1].address}:${nodes.sqldb.port} --slave=root:${nodes.sqldb.password}@${nodes.sqldb[0].address}:${nodes.sqldb.port} 2>&1
```
--------------------------------
### Start Lsync Daemon and Cron Job
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/docs/examples/wordpress-cluster.md
Reloads Nginx, copies the lsyncd executable to the correct location, and appends a cron job to run the lsyncd initialization script periodically.
```bash
sudo /etc/init.d/nginx reload
```
```bash
${SERVER_WEBROOT}/lsyncd/usr/bin/lsyncd ${SERVER_WEBROOT}/lsyncd/etc/lsyncd.conf &>> ${SERVER_WEBROOT}/lsyncd/var/log/lsyncd_start.log
```
```bash
*/5 * * * * /bin/bash ${SERVER_WEBROOT}/lsyncd/init.sh
```
--------------------------------
### Initialize Bare Repo Object
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/GitPython/doc/source/tutorial.rst
Shows how to initialize GitPython with a bare repository, which lacks a working tree. Bare repositories are often used on servers for pushing and pulling.
```python
from git import Repo
# Initialize a bare repository object
# This assumes the path points to a bare repository
bare_repo = Repo("/Users/mtrier/Development/git-python.git", bare=True)
# Verify it's a bare repository
assert bare_repo.bare
```
--------------------------------
### Ordered List Markdown Examples
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/markdown/tests/extensions/extra/markdown-syntax.txt
Shows how to create ordered lists in Markdown. The actual numbers used in the source do not affect the HTML output, but starting with '1.' is recommended for consistency.
```Markdown
1. Bird
2. McHale
3. Parish
```
```Markdown
1. Bird
1. McHale
1. Parish
```
```Markdown
3. Bird
1. McHale
8. Parish
```
--------------------------------
### Start Cloud Scripting Docs Server (Bash)
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/README.md
This command starts the local web server for previewing the Cloud Scripting documentation. It relies on the 'task' command-line tool, often provided by Devbox, to manage build and serve tasks. Successful execution allows viewing changes in a web browser.
```bash
task serve
```
--------------------------------
### Ordered List Markdown Examples
Source: https://github.com/virtuozzo/cloudscripting-docs/blob/master/3rdparty/markdown/tests/basic/markdown-syntax.txt
Shows how to create ordered lists in Markdown. The actual numbers used in the source do not affect the HTML output, but starting with '1.' is recommended for consistency.
```Markdown
1. Bird
2. McHale
3. Parish
```
```Markdown
1. Bird
1. McHale
1. Parish
```
```Markdown
3. Bird
1. McHale
8. Parish
```