Services

Services

When you are trying to create a website or web app or generally any real-world programming project, you will some software services to provide specific functionality to your program. For example, when you are building a website, you definitely need a database to store user or product data in it. The database enables your website to store and retrieve information in a structured and safe way. Doprax provides services to your projects. To use a service, you simply add it to your project. In the Getting Started section, we created a simple hello world Flask application. Now let’s add a MySQL service to it.

How do services work?

Services are software and utilities that do a specific job and usually provide some kind of functionality to the main container. A typical example of a service would be a MySQL instance. Each service is a separate container. Services are run in parallel with the main container and are all connected to the same private network. You can manage your services in the services sub-section.

a project in doprax with services

Add a service to the project

To add a service to your project, go to the services subsection. By default, it should be empty, since we don’t have any services yet. Now click on add service button. You will be directed to the add-service page, and you can choose the services you need. It should look like this:

add service page

Add a service to the project

Example: Add a MySQL service

By clicking on any of these services, you can add them to your project. Click on MySQL and a dialog will be opened to ask you for some more information. Let’s take a look at that:

add mysql as a service

Enter required config (root password, database name, username, and password) 

Mysql service needs to get some basic configuration from you. The info is root password, database name, username, and password. If you don’t enter this information, some default values will be used to non-password fields and for passwords, random values will be generated. Click add and the service will be added to our project.

Go back to the services sub-section and now you can see the MySQL service is shown in this sub-section along with all necessary information and configurations. It will look like this:

mysql in services page

Mysql is added to our project.

Services are deployed with your projects as separate containers. The service and the main container of your project are connected using a dedicated private network. The hostname of each service is available in the Services subsection and also in the deploy subsection The process of creation of service containers and networking is automatic, and you don’t have to worry about it, but a solid knowledge of the way it is done in Doprax can help you utilize these services more efficiently. 

Using volumes for services

Services usually need to save data permanently. For example, the MySQL service that we just added to our project needs to persist the database data on the disk, so we could retrieve data later. In a containerized environment, to persist data we use volumes. The volume will be mounted to the path that our service writes to and reads from. The information about the necessary volumes could be found in the official docker image documentation listed under each of the below services.

Example: MySQL data volume

For our MySQL example, we need to create a volume and mount it to /var/lib/mysql path inside the container. Go to the volumes subsection and click on create a volume button. A dialog will appear. Give your volume a title and choose MySQL for volume mount on. Then enter /var/lib/mysql and click create.

List of available services

Mysql

Mysql docker service

MySQL is a popular database powering many of the highest traffic sites in the world. Doprax makes it effortless to deploy production-grade MySQL with just one click. By default, the MySQL version is MySQL-5.7 which is the most popular and used version. Other versions can also be used. When you add MySQL service to your project, the first time that you run your project, the MySQL service will be initialized. Depending on the hardware resource allocated to your service, it could take several seconds to a couple of minutes for MySQL to be initialized. 

For more information about MySQL service on Doprax check out the link below.

Postgresql

PostgreSQL docker service

PostgreSQL, also known as Postgres, is an open-source, powerful, object-relational database system. PostgreSQL could be easily added to your project. 

Redis

redis docker service

Redis is an open-source in-memory data structure project implementing a distributed, in-memory key-value database with optional durability and is one of the most flexible and popular caching and database servers in use today. Doprax makes it easy to run Redis, complete with persistence so your data is always protected against process restarts and failures.

Nginx

Nginx docker service

Nginx (pronounced “engine-x”) is an open-source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The Nginx project started with a strong focus on high concurrency, high performance, and low memory usage. It is licensed under the 2-clause BSD-like license, and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.

For more information about the Nginx service on Doprax click the link below:

Elasticsearch

Elasticsearch docker service

Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data so you can discover the expected and uncover the unexpected.

For more information about Elasticsearch service on Doprax click the link below.

Logstash

logstash docker service

Logstash is a lightweight, open-source, server-side data processing pipeline that allows you to collect data from a variety of sources, transform it on the fly, and send it to your desired destination. It is most often used as a data pipeline for Elasticsearch, an open-source analytics and search engine.

Kibana

Kibana docker service

Kibana is a free and open frontend application that sits on top of the Elastic Stack, providing search and data visualization capabilities for data indexed in Elasticsearch. Commonly known as the charting tool for the Elastic Stack (previously referred to as the ELK Stack after Elasticsearch, Logstash, and Kibana), Kibana also acts as the user interface for monitoring, managing, and securing an Elastic Stack cluster — as well as the centralized hub for built-in solutions developed on the Elastic Stack. Developed in 2013 from within the Elasticsearch community, Kibana has grown to become the window into the Elastic Stack itself, offering a portal for users and companies.

Neo4j

Neo4j docker service

Neo4j is a graph database management system developed by Neo4j, Inc. Described by its developers as an ACID-compliant transactional database with native graph storage and processing, Neo4j is available in a GPL3-licensed open-source “community edition”.

MongoDB

Mongodb docker service

MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemata. MongoDB is developed by MongoDB Inc., and is published under a combination of the Server Side Public License and the Apache License.

Please do tell us, did you find the content above helpful?