Skip to content

Instantly share code, notes, and snippets.

@cmabastar
Last active January 14, 2020 02:40
Show Gist options
  • Save cmabastar/92e755f39f641f7fbde43c33d8e83eae to your computer and use it in GitHub Desktop.
Save cmabastar/92e755f39f641f7fbde43c33d8e83eae to your computer and use it in GitHub Desktop.
SugarDockerized
diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml
index c45ae579..c47fcf14 100644
--- a/backend/docker-compose.yml
+++ b/backend/docker-compose.yml
@@ -46,6 +46,9 @@ services:
- new_db
- redis
# - corenlp
+ networks:
+ - default
+ - some-net
main_webserver_ssl:
build:
@@ -108,3 +111,7 @@ services:
environment:
FLASK_APP: proxy/__init__.py
FLASK_DEBUG: 1
+
+networks:
+ some-net:
+ driver: bridge
diff --git a/data/app/sugar/.gitkeep b/data/app/sugar/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/stacks/sugar710/php71.yml b/stacks/sugar710/php71.yml
index 919bb84..75f6632 100755
--- a/stacks/sugar710/php71.yml
+++ b/stacks/sugar710/php71.yml
@@ -6,7 +6,7 @@ services:
image: sugar79_php71_web
build: ../../images/php/71/apache
ports:
- - "80:80"
+ - "8880:80"
extra_hosts:
- "docker.local:127.0.0.1"
volumes:
@@ -20,6 +20,9 @@ services:
- mysql
- elasticsearch
- redis
+ networks:
+ - default
+ - backend_some-net
cron:
container_name: "sugar-cron"
image: sugar79_php71_cron
@@ -71,3 +74,7 @@ services:
build: ../../images/permissions
volumes:
- ../../data/app:/var/www/html
+
+networks:
+ backend_some-net:
+ external: true
diff --git a/stacks/sugar79/php71.yml b/stacks/sugar79/php71.yml
index ce4272a..86d277c 100755
--- a/stacks/sugar79/php71.yml
+++ b/stacks/sugar79/php71.yml
@@ -20,6 +20,9 @@ services:
- mysql
- elasticsearch
- redis
+ networks:
+ - default
+ - backend_some-net
cron:
container_name: "sugar-cron"
image: sugar79_php71_cron
@@ -64,3 +67,7 @@ services:
build: ../../images/permissions
volumes:
- ../../data/app:/var/www/html
+
+networks:
+ backend_some-net:
+ external: true
@cmabastar
Copy link
Author

cmabastar commented Feb 21, 2018

Setting CRM datasource credentials

Inspect the bridge of some-net

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
f59384baf86a        backend_default     bridge              local
5e024ab07b8a        backend_some-net    bridge              local
30265b925d91        bridge              bridge              local
33e83a3bb778        host                host                local
8f71cacb4320        none                null                local
1445e26f526c        sugar79_default     bridge              local
$ docker network inspect 5e024ab07b8a
docker network inspect 5e024ab07b8a
[
    {
        "Name": "backend_some-net",
        "Id": "5e024ab07b8a127208cb90bfb6d694c3219ac40fc1b2ea7f6c6c11a043d5592d",
        "Created": "2018-02-21T02:20:50.238999851Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.19.0.0/16",
                    "Gateway": "172.19.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1e35925c317423b326f4a1cb8a263edb43f62b65b0965ffef3364512ed27ea1d": {
                "Name": "sugar-web1",
                "EndpointID": "7d694c3d6cbd73761df2f471360fec95b7fcb32aeb1b59ddfa848cdb02e28029",
                "MacAddress": "02:42:ac:13:00:03",
                "IPv4Address": "172.19.0.3/16",
                "IPv6Address": ""
            },
            "d3cafd318f1369532f0731157f8a6a4f589d6ec285db72d3d0359ba5721f53ee": {
                "Name": "backend_main_webserver_run_1",
                "EndpointID": "1decfab2a8e965677bfb56e2623e98000b45f21fb7551680ed9cc8a1098dc4d7",
                "MacAddress": "02:42:ac:13:00:02",
                "IPv4Address": "172.19.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Use the sugar-web1 IP address for your crm data source. (e.g. "http://172.19.0.3/sugar/")


Frequent Errors

  • If you get wrong credentials, Try changing the settings.SUGARCRM_API_PLATFORM to mobile

  • Socket unreachable: You must specify the correct IP address outputted in the inspect . (Ip address allocation may change upon running/tearing down docker)

  • If you are running worker/celery, add the same interface network into it's docker-compose.yml settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment