"Ddd/cqrs/microservices Architecture case" runs the service side of the Wetext project in Ubuntu 14.04.4 LTS

Source: Internet
Author: User
Tags documentation mysql query git clone rabbitmq

In the Wetext Project: A demo case of the DDD, CQRS, and microservices architecture based on. NET implementation, I introduced the ddd/cqrs/I developed with Visual Studio (C # 6.0 with. NET Framework 4.6.1) Case Project for MicroServices Architecture: Wetext. After the article issued a very good response, but also thank you for your attention. In this article I'll show you how to run the service side of the Wetext project in Ubuntu 14.04.4 Lts.

For cross-platform

From the beginning of the design, I put Wetext's service-side cross-platform into the practice goal, so the choice of the framework and technology are all can be run across platforms. In the process I did not try the latest. NET Core RC, but continue to use the latest version of Mono. Mono's current Microsoft Official. NET Framework compatibility has been very good, in a nutshell: In addition to WPF, WWF does not support, and some of the WCF and ASP. NET 4.5 asynchronous support is not perfect, other features fully support. The framework has been supported to the 4.6.1,c# language specification already supported to C # 6.0. For specific details, please refer to the official note of Mono: http://www.mono-project.com/docs/about-mono/compatibility/. It's not easy to have a project that runs on Linux at a recent job, and it's not very simple, but when the American team heard that I was going to adopt Mono, I was reluctant to accept it, and finally chose to use Java. Of course I admit that Java is really good at multi-platform support, but I'd like to practice mono for a little bit, to prove that mono-based solutions can really do well. That's why I'm positioning wetext as a cross-platform. By the way, from the customer's point of view, Microsoft's open source for the solution of the technology selection provides a broader choice, the customer's package does not need to be as before, a part of the use of Microsoft technology, the entire solution is to use Microsoft technology (for example, select the. NET Framework, You need a server running Windows; With Windows Server, LDAP is the most appropriate for Active Directory; with the entity Framework, SQL Server is required to do the database, and the customer I have a whole bunch of service programs running on Linux, why should my server choose Windows? As a result, the customer does not choose the. NET Framework). Of course, this is another topic, and here I continue to introduce the cross-platform features of the Wetext server.

I successfully installed and ran the Wetext server on the Ubuntu 14.04.4 LTS version of Linux and successfully accessed the Linux servers from the Wetext.web project under Windows and ran through all the business logic. Does that sound really exciting? Now, please come with me to see the whole installation and operation process.

Environment preparation

First of all, there must be an Ubuntu 14.04.4 lts machine (if it is another series of Linux, the following installation process will be somewhat different, please refer to the various components in the corresponding version of Linux installation steps to install, but will not affect the subsequent Wetext compilation and execution). After you have finished preparing the machine, you can begin to prepare the environment in a step-by-step manner.

Installing mono

To install mono in a Linux system, refer to http://www.mono-project.com/docs/compiling-mono/linux/. There are basically two ways: one is to compile the installation directly from the release version, and the other is to compile the installation by cloning the codebase. Of course, either way, before compiling, make sure that all required packages are properly installed by using the following command:

sudo apt-get install git autoconf libtool automake build-essential mono-devel gettext

I completed the installation by downloading the release package, which is located at: http://download.mono-project.com/sources/mono/. Select the latest version directly to download the extract.

After the decompression is complete, go to the extracted directory, then execute the following command to complete the compilation installation:

./configure--prefix=/usr/localmakemake Install

The-prefix parameter in the first command can be set according to your own situation.

Installing MongoDB

In Wetext, MongoDB is used as the event Store (in fact the event sourcing is not yet implemented). The reason for using MongoDB is that the event data itself is unstructured, and MongoDB has a good solution for replication. The installation process is as follows:

1. Importing the public key for the package management system

sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv EA312927

2. Create a list file for MongoDB

This will create the Mongodb-org-3.2.list file for MongoDB under the/ETC/APT/SOURCES.LIST.D directory.

echo "Deb Http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 Multiverse" | sudo tee/etc/apt/sources.list.d/mongodb-org-3.2.list

3. Refresh the local package database

sudo apt-get update

4. Install the latest version of MongoDB

sudo apt-get install-y mongodb-org

5. Start MongoDB Service

sudo service Mongod start

6. Execute the MONGO command directly to check if MongoDB is properly installed

If you need more detailed installation steps, please refer to the official documentation directly, or you can search the Internet for relevant Chinese reference information. Note: The default setting is currently recommended for the entire installation process because MongoDB configuration is now written to die in the server code (in the WeTextMongoSetting.cs file under the Wetext.domainrepositories project). If you change the configuration of MongoDB, you also need to change this part of the code accordingly, and then recompile the Wetext service side (the compilation process is described in the latter part of this article). The MongoDB configuration will be moved to the configuration file in the future.

Installing RABBITMQ

1. Add the RABBITMQ apt repository to the/ETC/APT/SOURCES.LIST.D directory using the following command

Echo ' deb http://www.rabbitmq.com/debian/testing main ' | sudo tee/etc/apt/sources.list.d/rabbitmq.list

2. Add RABBITMQ's public key to the list of trusted keys

wget-o-HTTPS://WWW.RABBITMQ.COM/RABBITMQ-SIGNING-KEY-PUBLIC.ASC | sudo apt-key add-

3. Refresh the local package database

sudo apt-get update

4. Installing RABBITMQ

sudo apt-get install Rabbitmq-server

If you need more detailed installation steps, please refer to the official documentation directly.

Install MySQL

1. Refresh the local package database

sudo apt-get update

2. Install MySQL

sudo apt-get install Mysql-server

3. Use the following command to try to connect to the MySQL service

Mysql-u root-p

If you need more detailed installation steps, please refer to this article directly.

Compiling from source code

1. Use the following git command to clone the Wetext source code to a local

git clone https://github.com/daxnet/we-text.git

2. Enter the We-text\scripts directory and execute the mysql–u root–p command to start the MySQL client. and execute the following command in MySQL to initialize the query database that Wetext needs to use:

\. Mysql_query_databases.sql

3. Note: There are still some problems with Nuget.exe under Linux, the nuget.exe Restore command under Wetext cannot download all dependent libraries (I have not found a solution yet). Therefore, you can only use Visual Studio 2015 to compile WeText.sln in Windows before you copy the downloaded packages directory to the WE-TEXT\SRC directory under Linux. You can use the Samba service, or upload the packages directory to a Linux system using FTP

4. Enter the WE-TEXT\SRC directory and use the following command to complete the Wetext server-side compilation:

Xbuild/p:targetframeworkversion=v4.6.1/p:configuration=serverdebug WeText.sln

5. After the compilation is complete, some assembly binding warnings appear, please ignore

Run the Wetext service side

Enter the We-text\bin directory, execute the./wetext.service.exe command, start the Wetext server, and you will see the following screen:

In Windows, open the Wetext project through Visual Studio 2015, modify the Web. config file for the Wetext.web project, and change the settings in to the Wetext server address in Linux:

Start the Wetext.web project and create a new Daxnet User:

After logging in, click the My Texts menu in the menu bar to create a new text:

Now, look at the MongoDB database under Linux:

To view the MySQL query database:

To view RABBITMQ Message Queuing:

OK, there's nothing wrong with the whole process running down. Finally, you can exit the server run (it takes a few seconds to exit) as long as you enter directly in the WeText.Service.exe window.

Summarize

This article details how to compile and run the Wetext client in a Linux environment, and successfully goes through the process. As mentioned above, there are a lot of wetext to improve, I will step by step to improve the adjustment, if there is a new experience, I will continue to share to you.

"Ddd/cqrs/microservices Architecture case" runs the service side of the Wetext project in Ubuntu 14.04.4 LTS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.