mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
Added docker compose
This commit is contained in:
committed by
Dan Christian Bogos
parent
ff9046d82f
commit
ca0b7af14e
@@ -35,6 +35,7 @@
|
||||
cgrates_dir: "{{ golang_gopath }}/src/github.com/cgrates/cgrates"
|
||||
cgrates_branch: "master"
|
||||
cgrates_distribution: "nightly"
|
||||
docker_tag: "latest"
|
||||
|
||||
dependencies:
|
||||
- build-essential
|
||||
@@ -109,7 +110,7 @@
|
||||
|
||||
- name: git clone cgrates
|
||||
git:
|
||||
repo: https://github.com/cgrates/cgrates.git
|
||||
repo: https://github.com/Trial97/cgrates.git
|
||||
dest: '{{ cgrates_dir }}'
|
||||
update: yes
|
||||
force: yes
|
||||
@@ -129,34 +130,69 @@
|
||||
remote_src: yes
|
||||
src: "{{ cgrates_dir }}/data/conf/cgrates/cgrates.json"
|
||||
dest: "{{ cgrates_dir }}/data/docker/scratch/cgrates.json"
|
||||
|
||||
|
||||
- name: get git tag
|
||||
shell: "git tag -l --points-at HEAD"
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}'
|
||||
register: gitTagVar
|
||||
|
||||
- name: get commit
|
||||
shell: git log -n1 --format=format:%h
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}'
|
||||
register: gitCommit
|
||||
when: cgrates_branch == "master" or gitTagVar.stdout_lines|length == 0
|
||||
|
||||
- name: get commit
|
||||
shell: date +%Y%m%d%H%M%S --date="@$(git log -n1 --format=format:%ct)"
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}'
|
||||
register: gitDate
|
||||
when: cgrates_branch == "master" or gitTagVar.stdout_lines|length == 0
|
||||
|
||||
- name: set cgrates docker_tag
|
||||
set_fact:
|
||||
docker_tag: "{{ gitDate.stdout }}{{ gitCommit.stdout }}"
|
||||
when: cgrates_branch == "master" or gitTagVar.stdout_lines|length == 0
|
||||
|
||||
|
||||
- name: build Docker image
|
||||
become: yes
|
||||
shell:
|
||||
docker build -t cgr-engine -f="cgr-engine.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t cgr-console -f="cgr-console.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t cgr-loader -f="cgr-loader.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t cgr-migrator -f="cgr-migrator.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t cgr-tester -f="cgr-tester.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-engine:{{ docker_tag }} -f="cgr-engine.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-console:{{ docker_tag }} -f="cgr-console.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-loader:{{ docker_tag }} -f="cgr-loader.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-migrator:{{ docker_tag }} -f="cgr-migrator.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
docker build -t 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-tester:{{ docker_tag }} -f="cgr-tester.doker" {{ cgrates_dir }}/data/docker/scratch/;
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/docker/scratch'
|
||||
|
||||
- name: tag docker image
|
||||
become: yes
|
||||
shell:
|
||||
docker tag cgr-engine 127.0.0.1:5000/cgr-engine:{{ cgrates_distribution }};
|
||||
docker tag cgr-console 127.0.0.1:5000/cgr-console:{{ cgrates_distribution }};
|
||||
docker tag cgr-loader 127.0.0.1:5000/cgr-loader:{{ cgrates_distribution }};
|
||||
docker tag cgr-migrator 127.0.0.1:5000/cgr-migrator:{{ cgrates_distribution }};
|
||||
docker tag cgr-tester 127.0.0.1:5000/cgr-tester:{{ cgrates_distribution }};
|
||||
|
||||
- name: push docker image to repo
|
||||
become: yes
|
||||
shell:
|
||||
docker image push 127.0.0.1:5000/cgr-engine:{{ cgrates_distribution }};
|
||||
docker image push 127.0.0.1:5000/cgr-console:{{ cgrates_distribution }};
|
||||
docker image push 127.0.0.1:5000/cgr-loader:{{ cgrates_distribution }};
|
||||
docker image push 127.0.0.1:5000/cgr-migrator:{{ cgrates_distribution }};
|
||||
docker image push 127.0.0.1:5000/cgr-tester:{{ cgrates_distribution }};
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-engine:{{ docker_tag }};
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-console:{{ docker_tag }};
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-loader:{{ docker_tag }};
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-migrator:{{ docker_tag }};
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-tester:{{ docker_tag }};
|
||||
|
||||
- name: tag docker master image
|
||||
become: yes
|
||||
shell:
|
||||
docker tag 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-engine:{{ docker_tag }} 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-engine:latest;
|
||||
docker tag 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-console:{{ docker_tag }} 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-console:latest;
|
||||
docker tag 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-loader:{{ docker_tag }} 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-loader:latest;
|
||||
docker tag 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-migrator:{{ docker_tag }} 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-migrator:latest;
|
||||
docker tag 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-tester:{{ docker_tag }} 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-tester:latest;
|
||||
when: cgrates_branch == "master"
|
||||
|
||||
- name: push docker master image to repo
|
||||
become: yes
|
||||
shell:
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-engine:latest;
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-console:latest;
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-loader:latest;
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-migrator:latest;
|
||||
docker image push 127.0.0.1:5000/{{ cgrates_distribution }}/cgr-tester:latest;
|
||||
when: cgrates_branch == "master"
|
||||
|
||||
112
data/conf/samples/docker/cgrates.json
Normal file
112
data/conf/samples/docker/cgrates.json
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
"reply_timeout": "50s",
|
||||
},
|
||||
|
||||
|
||||
"listen": {
|
||||
"rpc_json": "0.0.0.0:2012", // RPC JSON listening address
|
||||
"rpc_gob": "0.0.0.0:2013", // RPC GOB listening address
|
||||
"http": "0.0.0.0:2080", // HTTP listening address
|
||||
"rpc_json_tls" : "0.0.0.0:2022", // RPC JSON TLS listening address
|
||||
"rpc_gob_tls": "0.0.0.0:2023", // RPC GOB TLS listening address
|
||||
"http_tls": "0.0.0.0:2280", // HTTP TLS listening address
|
||||
},
|
||||
|
||||
|
||||
"data_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
|
||||
"rals": {
|
||||
"enabled": true,
|
||||
"thresholds_conns": ["*internal"],
|
||||
"max_increments":3000000,
|
||||
},
|
||||
|
||||
|
||||
"schedulers": {
|
||||
"enabled": true,
|
||||
"cdrs_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true,
|
||||
"chargers_conns":["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"attributes": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"resources": {
|
||||
"enabled": true,
|
||||
"store_interval": "-1",
|
||||
"thresholds_conns": ["*internal"]
|
||||
},
|
||||
|
||||
|
||||
"stats": {
|
||||
"enabled": true,
|
||||
"store_interval": "-1",
|
||||
"thresholds_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"thresholds": {
|
||||
"enabled": true,
|
||||
"store_interval": "-1",
|
||||
},
|
||||
|
||||
|
||||
"suppliers": {
|
||||
"enabled": true,
|
||||
"prefix_indexed_fields":["Destination"],
|
||||
"stats_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"rals_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"listen_bijson": "0.0.0.0:2014",
|
||||
"suppliers_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"attributes_conns": ["*internal"],
|
||||
"rals_conns": ["*internal"],
|
||||
"cdrs_conns": ["*internal"],
|
||||
"chargers_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"apiers": {
|
||||
"enabled": true,
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"filters": {
|
||||
"apiers_conns": ["*internal"],
|
||||
},
|
||||
|
||||
}
|
||||
13
data/docker/scratch/cgr-console.yaml
Normal file
13
data/docker/scratch/cgr-console.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: "3.7"
|
||||
services:
|
||||
cgr-console:
|
||||
image: dkr.cgrates.org/nightly/cgr-console
|
||||
container_name: cgr-console
|
||||
command: /cgr-console -server=cgr-engine:2012
|
||||
# stdin_open: true
|
||||
tty: true
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: cgrates-net
|
||||
15
data/docker/scratch/cgr-engine.yaml
Normal file
15
data/docker/scratch/cgr-engine.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
version: "3.7"
|
||||
services:
|
||||
cgr-engine:
|
||||
image: dkr.cgrates.org/nightly/cgr-engine
|
||||
container_name: cgr-engine
|
||||
ports:
|
||||
- 2012:2012
|
||||
- 2080:2080
|
||||
volumes:
|
||||
- ../../conf/samples/docker/:/etc/cgrates/:ro
|
||||
command: /cgr-engine --logger=*stdout -httprof_path=/pprof
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: cgrates-net
|
||||
Reference in New Issue
Block a user