The background,

With the continuous upgrading of the company’s business, after various aspects of research, it is believed that strangers’ social products can enter the overseas market. Based on the company’s strategy and needs, overseas projects are initiated.

Ii. Migration process of overseas architecture

  1. Architecture changes

  • The technical architecture of the domestic server is shown in the figure below (aliyun server used) :

  • Gateway layer: for processing tasks want to request services for information interaction processing; Verify application request, verify user information, encrypt and decrypt operation.
  • Console: Different service applications have different backgrounds, including scheduled tasks, which are deployed according to different applications.
  • Business layer: The business layer mainly refers to the business services corresponding to each application, and all business logic is processed at this layer.
  • Mid-platform services: Mid-platform services refer to services that provide basic capabilities for different applications; For example, the user center provides user related information and supports various third-party logins, while the social system provides users’ relationship with other users in the application and dynamic correlation functions.
  • Database: Data, as the most important information of the server, will be pulled out of the data layer alone, and the subsequent overseas projects will mention the data related information.
  • Middleware: Middleware refers to open source or other third party component capabilities used in services.
  • Server selection

First, consider overseas projects from the server deployment level, domestic applications, the server is deployed in the country; So overseas projects, the server is not necessarily deployed in the domestic, will find the project to enter the market countries closer to the server deployment position. From the perspective of individual microservices, business services are inherently differentiated by application, one overseas project for one business service.

But the service in Taiwan is not quite the same, by definition, the service in Taiwan is a set of code to support each application, multiple sets of products if they are in the country, deployed on a set of servers can be supported; However, overseas projects must be redeployed (the code must be the same, remember that this is a middle-taiwan service, must be able to support the ability of each product); Therefore, all cti services can only be deployed overseas once. If any follow-up CTI services can be supplemented or modified, they need to be released both at home and abroad.

In terms of the selection of servers, Ali Cloud is also capable of providing overseas servers. If ali Cloud server is selected, the momentum of the deployment of the whole set of services must be minimal. After the investigation and comprehensive consideration of operation and maintenance students in various aspects, as well as the use of overseas servers, AWS server is finally selected.

  • The technical architecture of the foreign server side is shown in the figure below (using AWS server) :

  • Contrast of difference

From the figure above, we can see that there is little difference between overseas and domestic technical architecture. The main differences are as follows:

At different service layers, each service corresponds to one application. Overseas applications do not need to be deployed in China, and domestic applications do not need to be deployed abroad. In addition to the services of the business layer, the other services belong to the middle stage, so naturally both at home and abroad are needed.

Server deployment is different. According to the above description, the overseas environment is deployed on AWS server, including all third-party components, database, console, etc. This is one of the biggest architectural differences.

In fact, our initial goal is to achieve a stable set of overseas projects with minimal changes. It can be seen from the two pictures at home and abroad that there is almost no change in the overall structure, but when establishing overseas projects, Different third-party SDK support, transformation, as well as data initialization, application internationalization work, the business ability of the project has a certain change momentum. For example, ali Cloud provides OSS component for file storage, and AWS provides S3 component for storage. Considering workload and reducing differences, S3 is not used to replace OSS in overseas architectures.

  1. Function changes

  • Log in function

Domestic login using mobile phone number, wechat and other common login methods; According to the survey, it is common for overseas products to use mobile phone numbers, Google, Facebook and other login methods. So we need to reconnect with Google login and Facebook login; In terms of the login method of mobile phone number, you need to add the selection of region and the selection of sending SMS to a third party, which will be explained below.

Google access links: developers.google.com/identity/si…

Facebook access link: cwqqq.com/2017/12/06/…

In the domestic framework of SMS service, we use ali Cloud SMS sending service; At the same time, Ali Cloud also provides overseas services, but the SMS signature, Ali Cloud does not support the application of companies outside the mainland, so we chose a third party. When I connected to the SMS service in AWS SNS, I found that the domestic mobile phone number could not receive SMS during the test. Although it is an overseas project, I still hope to support the domestic mobile phone number. Finally, I chose the short message service of Chuanglan. Although chuanglan’s business personnel need to help configure template information to support domestic mobile phone numbers, it is still relatively convenient. The third party can select the SMS service based on specific requirements.

  • Payment function

Domestic payment, as long as the use of wechat, Alipay, bank card, etc.; For overseas payment, We can use Google Pay for Android, which has integrated various commonly used overseas payment methods for us. For Ios, both at home and abroad, Apple’s own payment is used, so there is no need to modify it.

Google Pay access address: developer.android.com/google/play…

Reference documents: blog.csdn.net/weixin_4387…

  • Internationalization function

Since the product is an overseas project, language becomes an inevitable problem, so both the server and client need to be internationalized; There are many textbooks on the Internet on how to carry out internationalization, and we need to design an internationalization plan based on our own business structure. In the initial stage, according to the above structure, we conducted internationalization for each different service. However, we later found that a large part of the internationalization data was repeated, and the internationalization work was scattered in each micro-service. Therefore, the internationalization information must be processed in a unified way in the future.

  1. Data migration and initialization

Data is one of the most important parts of a project. In the process of project migration overseas, we need to migrate some necessary data, such as tenant information data and resource information. As user data, logging data don’t need to migrate, of course all migration also has nothing to do in the past, because the data we must be differentiated according to the application, cannot use different data confusion together, but after all is invalid, and a large amount of data online, to a certain extent reduce the performance, so there is no necessary data is not synchronized. Data storage components include mysql, ES, Redis and so on.

Mysql:

We need to check each table in the database of each service, sort out the data that need to be synchronized (the fixed data need to be synchronized, such as: system talk of chat, automatic nickname library of user registration, etc.), and finally submit it to the operation and maintenance students for synchronization.

Cache:

Database has some need to be synchronized initialization data, cache are naturally, so I need to a sort of cache, but the way is different from the database, if, because of the cache does not exist, and cause the problem, and the data is not to write to the cache, then the segment code has certain irrationality, need to change.

ES:

It is believed that every company uses ES to store data, so there will also be the problem of initializing data. The data processing scheme in ES is consistent with cache; It is also worth noting that there may be some early written initialization scripts in ES, which are not detected and cause problems when using ES in new projects. So all the initialization scripts need to be found, executed, and combed out to reduce the workload of subsequent new projects.

  1. Daily iteration

Based on the current business of the company, one set of all medium service needs to be deployed on the Domestic Ali Cloud server and another set on the overseas AWS server. All newly added and modified scripts also need to be synchronized at home and abroad. In addition, the current development process, both at home and abroad with development, testing, pre-delivery, online environment; And the development and testing environment has multiple sets. There is no doubt that this significantly increases the cost of testing and publishing.

Before there is no overseas project, each person in charge of requirement development should take the branch required by the current function from the master and develop it. After the development is completed, it is merged into the development environment for self-testing and joint commissioning. After finishing the smoke, merge it into the test environment for the test students to test; After completion, the functions are merged into the pre-release environment for regression and acceptance, and finally published online. Select the execution time based on the release timing and impact of the script if available.

After the addition of overseas projects at present, in all the service processes of middle Taiwan, the overseas services should also be released once in the process of merging the codes into development, testing, pre-delivery and online, and the tests should be confirmed both at home and abroad according to specific functions. And all scripts need to be executed overseas at the appropriate time. After a set of processes, there are basically twice as many steps as the original process, and the number of steps is twice as many. The possible risks are geometrically increased.

Considering from the time cost, the whole process must be automated, in the release to build the corresponding environment, at home and abroad at the same time; Synchronization can also be performed during script execution. This can save a lot of time and reduce the problems caused by manual publishing scripts.

From the perspective of risk, it is necessary to carry out the significance of middle-Taiwan service and the current structure status of the development students in the project; As well as the development students to increase the coverage of test cases in the code, test students to increase the coverage of interface automation, as far as possible to expose the risk through the machine, code, etc.

Third, summary

The above is the main process of the server in the process of establishing overseas projects of Xiaoyu Technology Company. There are many more details that are not listed here. This is also the first time for Xiaoyu to build overseas project architecture and carry out architecture migration. If you have good suggestions, please leave a message. If you also want to build a set of overseas projects, I hope the above information can provide some help to you, thank you!