Gallery is an open source demo project, anyone can copy and distribute it. If you want to use it in commercial product or for any other purposes, it's okay, but without any guarantees. The initiative of making this demo is to separate things from my current work, but avail all of the skills I have obtained from 3 years of development.
It's built on plenty of open source tools, such as AngularJS, Bootstrap, jQuery, Spring Framework, RabbitMQ, Redis, MySQL, MongoDB, Nginx and Tomcat etc.
The reason why I don't officially give it a particular name is just because I have not come up with one yet, LOL.
Well, I'll attempt to integrate more tools to provide powerful functionalities in the future.
Please wait, :P!!!
Below are some architectural perspectives:
Architecture:
Physical Topology:
More information please see the gallery-docs project, it includes design, API and help docs etc.
Frontend project please see gallery-ui.
It's pretty easy to run all the services on windows OS.
Requirements
- Windows XP, Vista, 7, 8, 8.1 and 10, both are okay, I'm using windows 7
- Java JDK 1.6+, 1.7+ is recommended, because I will explore some features that only come up with 1.7.
- MongoDB , latest version is recommended, because it has a lot of optimizations, but be aware there are two storage engines, MMAPv1 and WiredTiger, they're not compatible with each other. The former is available in previous versions, and the later only in 3.0. I am currently using 2.6.x and will later switch to 3.0 and try WiredTiger. Well, 3.0 has a finer granularity of locks. See Release Notes for MongoDB.
- Erlang runtime enviroment, OTP 16B02+
- RabbitMQ server, just use the latest version
- Redis key-value server, well, redis windows version is not recommended for running in production environments, but for development purpose, it would not cause too much harm. I am using 2.18.19.1, see Redis 2.18.19.1
- Tomcat 7.x+
- MySQL 5.x, the latest version is recommended
- Development tools, I am using maven to manage the project, so any IDE supports maven will work fine.(Eclipse, Spring Tool Suite, IntelliJ IDEA etc.)
The requirements are the same as on windows platforms.
Add key for the apt program:
$ wget http://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
Add repositories to the /etc/apt/sources.list file:
$ sudo vim /etc/apt/sources.list
deb http://nginx.org/packages/ubuntu/ precise nginx
deb-src http://nginx.org/packages/ubuntu/ precise nginx
Execute the following commands will install the latest version:
$ sudo apt-get update
$ sudo apt-get install nginx
BTW, the command below is to check nginx version:
$ sudo apt-cache showpkg nginx
Well, when the installation process is done, you could use the following command to run nginx server:
$ sudo service nginx start
If no error shows up, then hooray, you have successfully installed nginx server. Type localost
in the browser address field, you should see a welcome page!
Now, configure nginx for your good. Edit default.conf
:
$ sudo vim /etc/nginx/conf.d/default.conf
Modify location bloc as follows:
location / {
root /path/to/gallery-ui;
index index.html index.htm;
}
Then restart nginx:
$ sudo service nginx restart
Try accessing localhost
with your browser, you should see the following page.
Installing MySQL is pretty easy, just install through apt repository:
$ sudo apt-get install -y mysql-server
The following command is to check whether MySQL server is running on port 3306(by default):
$ sudo lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 15580 mysql 10u IPv4 63778 0t0 TCP localhost:mysql (LISTEN)
Before we start compiling redis source, we need to install gcc compiler if we haven't had one. The latest version is recommended. Here I am gonna install directly from the apt repository.
$ sudo apt-get -y install gcc
Now, we begin to compile and install redis:
$ wget http://download.redis.io/releases/redis-3.0.1.tar.gz
$ tar -zxvf redis-3.0.1.tar.gz
$ cd redis-3.0.1/
$ cd deps && make hiredis lua jemalloc linenoise
$ cd ..
$ make
If there's no error during compilation, then we could install and configure redis now:
$ sudo mkdir /etc/redis
$ sudo cp redis.conf /etc/redis/
$ sudo mkdir -p /usr/local/redis/bin
$ sudo cp src/redis-* /usr/local/redis/bin/
$ sudo sysctl vm.overcommit_memory=1
$ sudo groupadd redis
$ sudo useradd -r -g redis redis
$ sudo chown -R redis:redis /usr/local/redis/
$ sudo mkdir /var/log/redis/
$ sudo chown -R redis:redis /var/log/redis/
Configure redis environment:
$ sudo vim /etc/profile
# Add the following lines:
# Redis Environment
REDIS_HOME=/usr/local/redis
export PATH=$REDIS_HOME/bin:$PATH
# makes it being effective immediately
$ su -
# source /etc/profile #You may need root to run redis server
Comment out save
directives in redis.conf
to disable persistence mechanism, because we just use redis as a cache server, it's okay if you don't do this:
$ sudo vim /etc/redis/redis.conf
# turn off save directives
#save 900 1
#save 300 10
#save 60 10000
# change log file location
logfile /var/log/redis/redis.log
Run server:
$ su -
# redis-server /etc/redis/redis.conf
Connect to the server:
$ redis-cli -p 6379
127.0.0.1:6379>
$ sudo echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list
$ wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
$ sudo apt-key add rabbitmq-signing-key-public.asc
$ sudo apt-get update
$ sudo apt-get install rabbitmq-server
Just follow along with this tutorial: Install MongoDB on Ubuntu
Note:
It may have a warning message saying: WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always' You can eliminate this message by following these commands:
$ su -
Just download the binary archive from Apache Tomcat, and extract it to your desired directory.