{"id":13587328,"url":"https://github.com/sdr-enthusiasts/docker-shipfeeder","last_synced_at":"2025-04-13T01:52:48.342Z","repository":{"id":103648356,"uuid":"560491546","full_name":"sdr-enthusiasts/docker-shipfeeder","owner":"sdr-enthusiasts","description":"AIS feeder for ShipXplorer, VesselFinder, MarineTraffic, etc. based on AIS-Catcher. Multi-architecture (amd64, armhf, arm64)","archived":false,"fork":false,"pushed_at":"2025-04-11T21:37:18.000Z","size":1226,"stargazers_count":53,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T01:52:38.439Z","etag":null,"topics":["ais","docker","marinetraffic","raspberry-pi","sdr","sdr-enthusiasts","shipxplorer","vesselfinder"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdr-enthusiasts.png","metadata":{"files":{"readme":"README-grafana.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-01T16:07:58.000Z","updated_at":"2025-04-11T21:37:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"93608963-0e93-47ea-81fc-d76d8821fc77","html_url":"https://github.com/sdr-enthusiasts/docker-shipfeeder","commit_stats":null,"previous_names":["sdr-enthusiasts/docker-shipfeeder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdr-enthusiasts%2Fdocker-shipfeeder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdr-enthusiasts%2Fdocker-shipfeeder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdr-enthusiasts%2Fdocker-shipfeeder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdr-enthusiasts%2Fdocker-shipfeeder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdr-enthusiasts","download_url":"https://codeload.github.com/sdr-enthusiasts/docker-shipfeeder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654054,"owners_count":21140235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ais","docker","marinetraffic","raspberry-pi","sdr","sdr-enthusiasts","shipxplorer","vesselfinder"],"created_at":"2024-08-01T15:06:09.573Z","updated_at":"2025-04-13T01:52:48.318Z","avatar_url":"https://github.com/sdr-enthusiasts.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Using ShipXplorer with Grafana and Prometheus\n\n[`Grafana`](https://grafana.com/) is an analytics platform that can provide alternative graphs for `readsb`.\n\nIn this guide we will be using [`Prometheus`](https://prometheus.io/) as the data repository.\n\nUsing Grafana and Prometheus in this configuration does not require a plan, account, or credentials for their respective cloud offerings.\n\n## Hardware requirements\n\nPrometheus will store a lot of data, and Grafana will do a lot of data queries. As a result, it would be better if you run these containers on a different system than your feeder Raspberry Pi. This will leave your Pi focused on data collection and processing, and unbothered by the CPU and Disk IO load that Prometheus/Grafana will cause.\n\nYou *can* do it on a single system. We're assuming below that you are not. If you do it on a single system, then you can combine the `docker-compose.yml` components in a single file\n\n## Step 1: Make Prometheus data available for the ShipXplorer\n\n- Edit your ShipXplorer's `docker-compose.yml` file and ensure that the following is set for the `shipxplorer` service:\n\n```yaml\n    environment:\n      - PROMETHEUS_ENABLE=true\n    ports:\n      - 9273:9273\n```\n\nNow recreate the ShipXplorer container (`docker-compose up -d shipxplorer`) and it will generate Prometheus data.\n\n## Step 2: create a container stack for `prometheus` and `grafana`\n\nYou can skip this if you already have Prometheus and Grafana installed.\n\nOn the machine where you will run Prometheus and Grafana, create a docker-compose file in the `/opt/grafana` directory:\n\n```bash\nsudo mkdir -p -m777 /opt/grafana/grafana/appdata /opt/grafana/prometheus/config /opt/grafana/prometheus/data\ncd /opt/grafana\ncat \u003e docker-compose.yml\n```\n\nNow paste in the following text *):\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u0026lt;\u0026dash;\u0026dash; Click the arrow to see the \u003ccode\u003edocker-compose.yml\u003c/code\u003e text\u003c/summary\u003e\n\n```yaml\nversion: '3.9'\n\nvolumes:\n  grafana:\n    driver: local\n    driver_opts:\n      type: none\n      device: \"/opt/grafana/grafana/appdata\"\n      o: bind\n  prom-config:\n    driver: local\n    driver_opts:\n      type: none\n      device: \"/opt/grafana/prometheus/config\"\n      o: bind\n  prom-data:\n    driver: local\n    driver_opts:\n      type: none\n      device: \"/opt/grafana/prometheus/data\"\n      o: bind\n\nservices:\n  grafana:\n    image: grafana/grafana-oss:latest\n    restart: unless-stopped\n    container_name: grafana\n    hostname: grafana\n    # uncomment the following section and set the variables if you are exposing Grafana to the internet behind a rev web proxy:\n    environment:\n    # snuids-radar-panel plugin is needed for polar plots:\n      - GF_INSTALL_PLUGINS=snuids-radar-panel\n    # uncomment and set the following variables if you are exposing Grafana to the internet behind a rev web proxy:\n    #   - GF_SERVER_ROOT_URL=https://mywebsite.com/grafana/\n    #   - GF_SERVER_SERVE_FROM_SUB_PATH=true\n    ports:\n      - 3000:3000\n    volumes:\n      - grafana:/var/lib/grafana\n\n  prometheus:\n    image: prom/prometheus\n    container_name: prometheus\n    hostname: prometheus\n    restart: unless-stopped\n    tmpfs:\n      - /tmp\n    volumes:\n      - prom-config:/etc/prometheus\n      - prom-data:/prometheus\n    ports:\n      - 9090:9090\n```\n\n\u003c/details\u003e\n\n*) The volume definition structure is written this way purposely to ensure that the containers can place files in the persistent directories. Do not try to \"directly\" map volumes (`/opt/grafana/grafana/appdata:/var/lib/grafana`).\n\nYou should be able to see the following directories:\n\n- `/opt/grafana/grafana/appdata`\n- `/opt/grafana/prometheus/config`\n- `/opt/grafana/prometheus/data`\n\nDownload and create Grafana and Prometheus for the first time with this command:\n\n```bash\ndocker compose up -d\n```\n\n## Step 3: Configuring Prometheus\n\nPrometheus needs to be told where to look for the data from the ShipXplorer. We will create a target prometheus configuration file that does this, please copy and paste the following. Make sure to replace `ip_of_ShipXplorer_machine:90` with the IP address or hostname of the machine and the web port where `shipxplorer` is running:\n\n```bash\ndocker exec -it prometheus sh -c \"echo -e \\\"  - job_name: 'ais'\\n    static_configs:\\n      - targets: ['ip_of_ShipXplorer_machine:90']\\\" \u003e\u003e /etc/prometheus/prometheus.yml\"\ndocker restart prometheus\n```\n\n(If you screw this up, **do NOT** re-run the command. Instead, try `sudo nano /opt/grafana/prometheus/config/prometheus.yml` and fix it that way.)\n\n## Accessing Prometheus and Grafana via your browser\n\nYou should be able to point your web browser at:\n\n- `http://docker.host.ip.addr:9090/` to access the `prometheus` console.\n- `http://docker.host.ip.addr:3000/` to access the `grafana` console, use admin/admin as initial credentials, you should be prompted to change the password on first login.\n\nRemember to change `docker.host.ip.addr` to the IP address of the machine where Prometheus and Grafana are located.\n\n## Configuring data source and dashboard in Grafana\n\nAfter you have logged into the `grafana` console the following manual steps are required to connect to `prometheus` as the data source. **You must do this** even if you are already connected to Prometheus for other purposes (such as for getting `readsb`/`ultrafeeder`/`tar1090` data)\n\n1. In Grafana, click `Configuration` (cogwheel) -\u003e `Data Sources`\n2. Click `Add a new data source` in the main panel\n3. Click `Prometheus` from the list of options provided\n4. Input or select the following options, if the option is not listed, do not input anything for that option:\n\nOption | Input\n------------- | -------------\nName | `ais`\nURL | `http://prometheus:9090/`\n\nClicking `Save \u0026 Test` should return a green message indicating success. The dashboard can now be imported with the following steps\n\n1. Hover over the `four squares` icon in the sidebar, click `+ Import`\n2. Enter `18417` into the `Import via grafana.com` section and click `Load`\n3. Select `readsb` from the bottom drop down list\n4. Click `Import` on the subsequent dialogue box\n\nAt this point you should see a very nice dashboard, you can find it under `General` in the `Dashboards` section.\n![image1](https://user-images.githubusercontent.com/15090643/228942953-ed8b64aa-3a38-4c6f-bd42-e929b72399b2.png)\n![image1](https://user-images.githubusercontent.com/15090643/228943041-7e135856-543a-416a-9331-50853d2e0929.png)\n![image1](https://user-images.githubusercontent.com/15090643/228943083-c017c5a0-f5aa-4d03-b241-8e58f2c8a5f6.png)\n\n## Embedding your Grafana Dashboard to your AIS-Catcher About page\n\nThis description presumes that you already do the following:\n\n- have a working Grafana setup as per the instructions above\n- have configured an About page as per the instructions [here](https://github.com/sdr-enthusiasts/docker-shipxplorer/blob/main/README.md#adding-an-about-page-to-the-ais-catcher-website)\n- If your AIS-Catcher/ShipXplorer website is exposed outside your intranet, you should also have an externally accessible link to your Grafana instance.\n\n### 1 - Create a new Organization in Grafana and import your Data Source and Dashboard\n\nThis is not 100% mandatory, but since \"anonymous\" access enables seeing all Dashboards of an Organization, it's recommendable to isolate your AIS-Catcher dashboard in a separate Organization.\n\n1. Log in to Grafana with an Admin account\n2. Go to `Server Admin` (Shield icon) -\u003e `Organizations`\n3. Click `+ New org` and create a new Organization. You can call it whatever you want; for simplicity, we've called it \"`public`\". Click on it to select it.\n4. Now you have to import your Prometheus Data Source and Grafana Dashboard again. Follow the instructions above; make sure it says \"`Organization: public`\" at the top of the page. If you have made adjustments to your Grafana Dashboard in your other organization, you can go there, export the JSON \"for external use\", and then copy this JSON code into a new Dashboard in the `public` organization.\n\nYou should now be able to see your Grafana AIS-Catcher Dashboard in the `public` organization.\n\n### 2 - Enable your Grafana Config for showing Dashboards without logging in\n\nThis enables Grafana to show and embed dashboards without logging in, limited to a **single organization**.\n\nAdd the following parameters to the `environment:` section of your Grafana Service definition in `docker-compose.yml`. If you have named your Organization something else than `public`, you'll have to adjust that below:\n\n```yaml\n    environment:\n      - GF_AUTH_ANONYMOUS_ENABLED=true\n      - GF_AUTH_ANONYMOUS_ORG_NAME=public\n      - GF_SECURITY_ALLOW_EMBEDDING=true\n```\n\nThen restart the Grafana container with `docker restart grafana`.\n\nOnce you have done this, you need to do a Hard Reload of the Grafana Dashboard in your Web Browser. If you use Chrome, this would be CTRL-SHIFT-R (Windows) or CMD-SHIFT-R (Mac).\n\n### 3 - Get your Grafana Dashboard Link and add it to `about.md`\n\n1. In your Grafana Dashboard page (`public` organization), click the \"Share Dashboard or Panel\" button next to the title of the Dashboard\n2. In the Link tab of the pop-up box, make sure that you **deselect** `Lock time range` and optionally **select** `Shorten URL`. If you usually render a Dark Mode Dashboard, you may want to select \"Light Mode\" because this fits better with the About page. Then copy the resulting URL\n3. Edit `about.md` in the `/data` directory that previously created using the [instructions](https://github.com/sdr-enthusiasts/docker-shipxplorer/blob/main/README.md#adding-an-about-page-to-the-ais-catcher-website). Wherever you want the Dashboard to appear, add the following Markdown/HTML code block:\n\n```html\n\u003ciframe src=\"http://copied/link/from/grafana\" width=\"100%\" height=\"1300\" frameborder=\"0\"\u003e\u003c/iframe\u003e\n```\n\nOf course, replace `http://copied/link/from/grafana` by the Dashboard link you copied.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdr-enthusiasts%2Fdocker-shipfeeder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdr-enthusiasts%2Fdocker-shipfeeder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdr-enthusiasts%2Fdocker-shipfeeder/lists"}