From 9bd70aadc8eeb4f7ad9d3d723f731bf215cd131c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Sat, 20 Aug 2016 12:28:45 +0100 Subject: [PATCH 1/6] Added aerospike cache service --- aerospike/Dockerfile | 3 +++ docker-compose.yml | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 aerospike/Dockerfile diff --git a/aerospike/Dockerfile b/aerospike/Dockerfile new file mode 100644 index 00000000..1a351d94 --- /dev/null +++ b/aerospike/Dockerfile @@ -0,0 +1,3 @@ +FROM aerospike:latest + +MAINTAINER Luciano Jr diff --git a/docker-compose.yml b/docker-compose.yml index 1c89a00a..4f37f092 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -163,6 +163,18 @@ services: ports: - "6379:6379" +### Aerospike Container ######################################### + + aerospike: + build: ./aerospike + volumes_from: + - volumes_data + ports: + - "3000:3000" + - "3001:3001" + - "3002:3002" + - "3003:3003" + ### Memcached Container ##################################### memcached: @@ -230,5 +242,6 @@ services: - ./data/redis:/data - ./data/neo4j:/var/lib/neo4j/data - ./data/mongo:/data/db + - ./data/aerospike:/opt/aerospike/data ### Add more Containers below ############################### From 1afad7f14cb9a5acb50344c88be5ab3bed81ba45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Sat, 20 Aug 2016 18:57:01 +0100 Subject: [PATCH 2/6] Add configuration to install aerospike php extension --- docker-compose.yml | 6 +++++- php-fpm/Dockerfile-70 | 24 +++++++++++++++++++++++- php-fpm/aerospike.ini | 3 +++ workspace/Dockerfile | 22 ++++++++++++++++++++++ workspace/aerospike.ini | 3 +++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 php-fpm/aerospike.ini create mode 100644 workspace/aerospike.ini diff --git a/docker-compose.yml b/docker-compose.yml index 4f37f092..c970d9a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: - INSTALL_MONGO=false - INSTALL_NODE=false - INSTALL_DRUSH=false + - INSTALL_AEROSPIKE_EXTENSION=false - COMPOSER_GLOBAL_INSTALL=false - PUID=1000 - PGID=1000 @@ -33,6 +34,7 @@ services: - INSTALL_ZIP_ARCHIVE=false - INSTALL_MEMCACHED=false - INSTALL_OPCACHE=false + - INSTALL_AEROSPIKE_EXTENSION=false dockerfile: Dockerfile-70 volumes_from: - volumes_source @@ -163,7 +165,7 @@ services: ports: - "6379:6379" -### Aerospike Container ######################################### +### Aerospike c Container ######################################### aerospike: build: ./aerospike @@ -174,6 +176,8 @@ services: - "3001:3001" - "3002:3002" - "3003:3003" + volumes_from: + - workspace ### Memcached Container ##################################### diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index fe412775..7b278161 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -98,6 +98,28 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ && docker-php-ext-enable memcached \ ;fi +##################################### +# PHP Aerospike: +##################################### + +ARG INSTALL_AEROSPIKE_EXTENSION=true +ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION} +# Copy aerospike configration for remote debugging +COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini +RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \ + # Install the php aerospike extension + curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \ + && mkdir -p aerospike-client-php \ + && tar -C aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \ + && ( \ + cd aerospike-client-php/src/aerospike \ + && phpize \ + && ./build.sh \ + && make install \ + ) \ + && rm /tmp/aerospike-client-php.tar.gz \ +;fi + ##################################### # Opcache: ##################################### @@ -127,4 +149,4 @@ WORKDIR /var/www/laravel CMD ["php-fpm"] -EXPOSE 9000 +EXPOSE 9000 \ No newline at end of file diff --git a/php-fpm/aerospike.ini b/php-fpm/aerospike.ini new file mode 100644 index 00000000..f9c8f614 --- /dev/null +++ b/php-fpm/aerospike.ini @@ -0,0 +1,3 @@ +extension=aerospike.so +aerospike.udf.lua_system_path=/usr/local/aerospike/lua +aerospike.udf.lua_user_path=/usr/local/aerospike/usr-lua \ No newline at end of file diff --git a/workspace/Dockerfile b/workspace/Dockerfile index e869bfab..cd73a4c6 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -140,6 +140,28 @@ RUN if [ ${INSTALL_NODE} = true ]; then \ echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ ;fi +##################################### +# PHP Aerospike: +##################################### +USER root +ARG INSTALL_AEROSPIKE_EXTENSION=true +ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION} +# Copy aerospike configration for remote debugging +COPY ./aerospike.ini /etc/php/7.0/cli/conf.d/aerospike.ini +RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \ + # Install the php aerospike extension + curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \ + && mkdir -p aerospike-client-php \ + && tar -C aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \ + && ( \ + cd aerospike-client-php/src/aerospike \ + && phpize \ + && ./build.sh \ + && make install \ + ) \ + && rm /tmp/aerospike-client-php.tar.gz \ +;fi + # #-------------------------------------------------------------------------- # Final Touch diff --git a/workspace/aerospike.ini b/workspace/aerospike.ini new file mode 100644 index 00000000..f9c8f614 --- /dev/null +++ b/workspace/aerospike.ini @@ -0,0 +1,3 @@ +extension=aerospike.so +aerospike.udf.lua_system_path=/usr/local/aerospike/lua +aerospike.udf.lua_user_path=/usr/local/aerospike/usr-lua \ No newline at end of file From 9aa8813a3d099733a14c364d2c942ce0aabb5b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Wed, 24 Aug 2016 16:29:29 +0100 Subject: [PATCH 3/6] Add aerospike.conf --- aerospike/Dockerfile | 4 ++ aerospike/aerospike.conf | 93 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 aerospike/aerospike.conf diff --git a/aerospike/Dockerfile b/aerospike/Dockerfile index 1a351d94..665a279c 100644 --- a/aerospike/Dockerfile +++ b/aerospike/Dockerfile @@ -1,3 +1,7 @@ FROM aerospike:latest MAINTAINER Luciano Jr + +RUN rm /etc/aerospike/aerospike.conf + +ADD aerospike.conf /etc/aerospike/aerospike.conf \ No newline at end of file diff --git a/aerospike/aerospike.conf b/aerospike/aerospike.conf new file mode 100644 index 00000000..819f916f --- /dev/null +++ b/aerospike/aerospike.conf @@ -0,0 +1,93 @@ +# Aerospike database configuration file. + +# This stanza must come first. +service { + user root + group root + paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1. + pidfile /var/run/aerospike/asd.pid + service-threads 4 + transaction-queues 4 + transaction-threads-per-queue 4 + proto-fd-max 15000 +} + +logging { + + # Log file must be an absolute path. + file /var/log/aerospike/aerospike.log { + context any info + } + + # Send log messages to stdout + console { + context any critical + } +} + +network { + service { + address any + port 3000 + + # Uncomment the following to set the `access-address` parameter to the + # IP address of the Docker host. This will the allow the server to correctly + # publish the address which applications and other nodes in the cluster to + # use when addressing this node. + # access-address + } + + heartbeat { + + # mesh is used for environments that do not support multicast + mode mesh + port 3002 + + # use asinfo -v 'tip:host=;port=3002' to inform cluster of + # other mesh nodes + mesh-port 3002 + + interval 150 + timeout 10 + } + + fabric { + port 3001 + } + + info { + port 3003 + } +} + +namespace test { + replication-factor 2 + memory-size 1G + default-ttl 5d # 5 days, use 0 to never expire/evict. + + # storage-engine memory + + # To use file storage backing, comment out the line above and use the + # following lines instead. + storage-engine device { + file /opt/aerospike/data/test.dat + filesize 4G + data-in-memory true # Store data in memory in addition to file. + } +} + +namespace facestore { + replication-factor 2 + memory-size 1G + default-ttl 5d # 5 days, use 0 to never expire/evict. + + # storage-engine memory + + # To use file storage backing, comment out the line above and use the + # following lines instead. + storage-engine device { + file /opt/aerospike/data/facestore.dat + filesize 4G + data-in-memory true # Store data in memory in addition to file. + } +} From 650f6a89c60554a60725906990f36837bb48cb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Thu, 1 Sep 2016 12:57:56 +0100 Subject: [PATCH 4/6] Remove own namespace from conf file --- aerospike/aerospike.conf | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/aerospike/aerospike.conf b/aerospike/aerospike.conf index 819f916f..5e577759 100644 --- a/aerospike/aerospike.conf +++ b/aerospike/aerospike.conf @@ -75,19 +75,3 @@ namespace test { data-in-memory true # Store data in memory in addition to file. } } - -namespace facestore { - replication-factor 2 - memory-size 1G - default-ttl 5d # 5 days, use 0 to never expire/evict. - - # storage-engine memory - - # To use file storage backing, comment out the line above and use the - # following lines instead. - storage-engine device { - file /opt/aerospike/data/facestore.dat - filesize 4G - data-in-memory true # Store data in memory in addition to file. - } -} From 92dc3be3b191f1fdcf328fbc28c3ea8c07588cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Thu, 1 Sep 2016 13:05:53 +0100 Subject: [PATCH 5/6] Remove duplicate argument on aerospike section --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c970d9a4..21d59696 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -171,13 +171,13 @@ services: build: ./aerospike volumes_from: - volumes_data + - workspace ports: - "3000:3000" - "3001:3001" - "3002:3002" - "3003:3003" - volumes_from: - - workspace + ### Memcached Container ##################################### From b01bae59fc1f43084fa329fe2adbedda944fbb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciano=20Gon=C3=A7alves?= Date: Thu, 1 Sep 2016 13:21:21 +0100 Subject: [PATCH 6/6] Fix volumes aerospike section --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 21d59696..9c4e646a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -170,8 +170,8 @@ services: aerospike: build: ./aerospike volumes_from: - - volumes_data - workspace + - volumes_data ports: - "3000:3000" - "3001:3001"