Merge pull request #275 from luciano-jr/feature/aerospike-cache

Feature/aerospike cache
This commit is contained in:
Mahmoud Zalt 2016-09-01 23:53:36 +03:00 committed by GitHub
commit 3473b788cf
8 changed files with 187 additions and 2 deletions

View File

@ -120,6 +120,7 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red
- **Cache Engines:** - **Cache Engines:**
- Redis - Redis
- Memcached - Memcached
- Aerospike
- **PHP Servers:** - **PHP Servers:**
- NGINX - NGINX
- Apache2 - Apache2
@ -250,7 +251,7 @@ docker-compose up -d nginx mysql
You can select your own combination of Containers form the list below: You can select your own combination of Containers form the list below:
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`. `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`, `aerospike`.
**Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. **Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command.
@ -995,7 +996,40 @@ It should be like this:
3 - Re-build the container `docker-compose build workspace` 3 - Re-build the container `docker-compose build workspace`
<br>
<a name="Install-Aerospike-Extension"></a>
### Install Aerospike extension
1 - First install `aerospike` in the Workspace and the PHP-FPM Containers:
<br>
a) open the `docker-compose.yml` file
<br>
b) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the Workspace Container
<br>
c) set it to `true`
<br>
d) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the PHP-FPM Container
<br>
e) set it to `true`
It should be like this:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_AEROSPIKE_EXTENSION=true
...
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_AEROSPIKE_EXTENSION=true
...
```
2 - Re-build the containers `docker-compose build workspace php-fpm`
<br> <br>
<a name="debugging"></a> <a name="debugging"></a>

7
aerospike/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM aerospike:latest
MAINTAINER Luciano Jr <luciano@lucianojr.com.br>
RUN rm /etc/aerospike/aerospike.conf
ADD aerospike.conf /etc/aerospike/aerospike.conf

77
aerospike/aerospike.conf Normal file
View File

@ -0,0 +1,77 @@
# 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 <IPADDR>
}
heartbeat {
# mesh is used for environments that do not support multicast
mode mesh
port 3002
# use asinfo -v 'tip:host=<ADDR>;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.
}
}

View File

@ -12,6 +12,7 @@ services:
- INSTALL_MONGO=false - INSTALL_MONGO=false
- INSTALL_NODE=false - INSTALL_NODE=false
- INSTALL_DRUSH=false - INSTALL_DRUSH=false
- INSTALL_AEROSPIKE_EXTENSION=false
- COMPOSER_GLOBAL_INSTALL=false - COMPOSER_GLOBAL_INSTALL=false
- INSTALL_WORKSPACE_SSH=false - INSTALL_WORKSPACE_SSH=false
- PUID=1000 - PUID=1000
@ -37,6 +38,7 @@ services:
- INSTALL_ZIP_ARCHIVE=false - INSTALL_ZIP_ARCHIVE=false
- INSTALL_MEMCACHED=false - INSTALL_MEMCACHED=false
- INSTALL_OPCACHE=false - INSTALL_OPCACHE=false
- INSTALL_AEROSPIKE_EXTENSION=false
dockerfile: Dockerfile-70 dockerfile: Dockerfile-70
volumes_from: volumes_from:
- volumes_source - volumes_source
@ -169,6 +171,20 @@ services:
ports: ports:
- "6379:6379" - "6379:6379"
### Aerospike c Container #########################################
aerospike:
build: ./aerospike
volumes_from:
- workspace
- volumes_data
ports:
- "3000:3000"
- "3001:3001"
- "3002:3002"
- "3003:3003"
### Memcached Container ##################################### ### Memcached Container #####################################
memcached: memcached:
@ -270,6 +286,7 @@ services:
- ./data/redis:/data - ./data/redis:/data
- ./data/neo4j:/var/lib/neo4j/data - ./data/neo4j:/var/lib/neo4j/data
- ./data/mongo:/data/db - ./data/mongo:/data/db
- ./data/aerospike:/opt/aerospike/data
- ./data/sessions:/sessions - ./data/sessions:/sessions
### Add more Containers below ############################### ### Add more Containers below ###############################

View File

@ -94,6 +94,28 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
&& docker-php-ext-enable memcached \ && docker-php-ext-enable memcached \
;fi ;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: # Opcache:
##################################### #####################################

3
php-fpm/aerospike.ini Normal file
View File

@ -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

View File

@ -165,6 +165,28 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
;fi ;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 # Final Touch

3
workspace/aerospike.ini Normal file
View File

@ -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