Install ApiDQ application #
Install docker #
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce
Executing the Docker command without sudo #
If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:
sudo usermod -aG docker ${USER}
To apply the new group membership, log out of the server and back in, or type the following:
su - ${USER}
You will be prompted to enter your user’s password to continue.
Install Docker Compose #
Run this command to download the current stable release of Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Connect to ApiShip Docker Registry #
Run this command to download the current stable release of Docker Compose
export DOCKER_REGISTRY=gitlab.apiship.ru:5050/apidq/apidq
docker login gitlab.apiship.ru:5050
Username: gitlab_login
- login to access the GitLab server
Password: gitlab_password
- password to access the GitLab server
Setting up and running the application #
Create apidq folder
mkdir apidq
cd apidq
Creating of configuration files #
Create address-config.toml
file with content
[main]
ListenAddr = "0.0.0.0" # ip address where the address service will be available
ListenPort = "8083" # port where the address service will be available
Debug = false
[logger]
Facility = "service-address"
[postgresql]
Address = "0.0.0.0" # ip postgresql server
Port = "5432" # port postgresql server
Dbname = "apidq" # apidq database
User = "apidq"
Password = "apidq"
[license]
Key = "1sy6hgXA699LPoatkt2jeu3VCtm1x1sy6hgXA699LPoahchbS9C9OshefuP_v-Ebtvg="
Create gateway-config.toml
file with content
[main]
ListenAddr = "0.0.0.0" # ip address where service will be available
ListenPort = "8080" # port where service will be available
ReadTimeout = 60000
WriteTimeout = 60000
Debug = false
[logger]
Facility = "service-gateway"
[addressService]
Enabled = true
EndpointAddr = "address" # ip address or host service from address-config.toml
EndpointPort = "8083" # port service from address-config.toml
Create docker-compose.yaml
file with content
version: "3.0"
services:
gateway:
image: "gitlab.apiship.ru:5050/apidq/apidq/apidq-service-gateway:latest"
ports:
- "8080:8080"
volumes:
- ./gateway-config.toml:/dist/config.toml
address:
image: "gitlab.apiship.ru:5050/apidq/apidq/apidq-service-address:latest"
volumes:
- ./address-config.toml:/dist/config.toml
Run and check application #
docker-compose up -d
Check clean/address (address standardization)
curl --location --request POST 'http://0.0.0.0:8080/api/v1/clean/address' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "котлас кузнецова 14в 132",
"countryCode": "RU"
}'
Check suggest/address (address suggest / hints)
curl --location --request POST 'http://0.0.0.0:8080/api/v1/suggest/address' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "москва варш","countryCode": "RU","count": 2}'