Skip to content

Instantly share code, notes, and snippets.

@laruche
Created July 9, 2021 10:16
Show Gist options
  • Save laruche/3286f31fe604e04711eb0a7965855948 to your computer and use it in GitHub Desktop.
Save laruche/3286f31fe604e04711eb0a7965855948 to your computer and use it in GitHub Desktop.
@laruche
Copy link
Author

laruche commented Aug 6, 2022

Any logs ?

@maietta
Copy link

maietta commented Aug 6, 2022

First of all, great app suggestion.

It took a moment and a couple tweaks to this config before I could get it to work. I had to wait about 30 seconds or so before the app showed. Also, the container port 8080 is not being picked up by Caprover so I had to manually set 8080 on the Container Port setting.

It isn't so obvious to me at first, but it appears this isn't just a single app. No web interface out of the box. I think this is a standalone API server and URL resolver.

The Web UI if you want to add that is at https://github.com/shlinkio/shlink-web-client.

You can also use the https://app.shlink.io option during testing.

Per the docs:

https://shlink.io/documentation/install-docker-image/

captainVersion: '4'
documentation: Read the documentation @ https://shlink.io/documentation/
description: shlink is a URL shortener which provides both REST and CLI interfaces
  to interact with it.
services:
  "$$cap_appname":
    image: shlinkio/shlink:$$cap_shlink_version
    containerHttpPort: 8080
    volumes:
      - $$cap_appname-config:/etc/shlink/config/params
    restart: always
caproverOneClickApp:
  variables:
    - id: $$cap_shlink_version
      label: shlink version tag
      description: Checkout their docker page for the valid tags @ https://hub.docker.com/r/shlinkio/shlink/tags
      defaultValue: 2.0.5
  instructions:
    start: shlink is a self-hosted url shortener server with a web interface.
    end: shlink is deployed and available as $$cap_appname.
  displayName: 'Shlink'

@uhlhosting
Copy link

Any logs ?

First nginx gives a 502: http://o.uhl.cloud

root@pac:/home/pac# docker service logs srv-captain--o.1.qt0s9pwcrmdllr3g0p7h2f4bt --since 5m --follow
srv-captain--o.1.qt0s9pwcrmdl@pac    | Creating fresh database if needed...
srv-captain--o.1.qt0s9pwcrmdl@pac    | Updating database...
srv-captain--o.1.qt0s9pwcrmdl@pac    | Generating proxies...
srv-captain--o.1.qt0s9pwcrmdl@pac    | 
srv-captain--o.1.qt0s9pwcrmdl@pac    | 
srv-captain--o.1.qt0s9pwcrmdl@pac    | [Warning] The use of this script is discouraged. See https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/tools.html#doctrine-console for instructions on bootstrapping the console runner.
srv-captain--o.1.qt0s9pwcrmdl@pac    | Clearing entities cache...
srv-captain--o.1.qt0s9pwcrmdl@pac    | [Warning] The use of this script is discouraged. See https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/tools.html#doctrine-console for instructions on bootstrapping the console runner.
srv-captain--o.1.qt0s9pwcrmdl@pac    | 
srv-captain--o.1.qt0s9pwcrmdl@pac    | 
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.464006+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 16
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.464509+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 17
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.464776+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 18
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.465403+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 19
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.466084+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 20
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.466900+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 21
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.467844+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 22
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.468416+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 23
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.469008+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 25
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.469485+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 26
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.469480+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 24
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.470004+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 27
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.470608+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 28
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.470669+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 29
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.470991+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 30
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.471531+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 31
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.472805+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 0
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.472805+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 1
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.473186+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 3
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.474899+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 7
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.474950+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 6
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.474911+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 4
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.474992+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 5
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.476934+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 8
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.476966+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 12
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.477021+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 11
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.477493+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 13
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.473173+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 2
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.479366+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 14
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.479509+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 9
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.479712+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 15
srv-captain--o.1.qt0s9pwcrmdl@pac    | [2022-08-06T21:38:59.479685+00:00] [NULL] Access.NOTICE - Worker started in /etc/shlink with ID 10

@maietta
Copy link

maietta commented Aug 6, 2022

Hey @uhlhosting, did you set your Container Port to 8080? I literally just tested this earlier and it works. You do have to wait upwards of 30 or more seconds for the app to become available after the change.

@uhlhosting
Copy link

Hey @uhlhosting, did you set your Container Port to 8080? I literally just tested this earlier and it works. You do have to wait upwards of 30 or more seconds for the app to become available after the change.

Hi @maietta You mean here?

image

@uhlhosting
Copy link

I tried it, yet for me does manages to get to a 404 missing page, when I turn on http to https is back on 502 error.

@maietta
Copy link

maietta commented Aug 6, 2022

Yes, @uhlhosting. That is the place you need to set port to 8080.

The 404 page IS the application running correctly.

Your next step I believe is to log into your server via SSH and find the container to run the command to generate the API key that you will use to begin using this application, as outlined in the official docs for this application.

Some applications will generate a new API key on the first run and reveal it early in the logs but this application is not one of them. They designed it so you have to run a command against a running container. Sadly, the name is not predictable so you have to find the container name by running another command.

Once you SSH into your machine running Caprover, run docker ps ls | grep shlink to find the container name.

Then run docker exec -it my_shlink shlink api-key:generate, replacing "my_shlink" with the unique name of your container, as outlined in this document: https://shlink.io/documentation/install-docker-image/.

Like so:

image

@uhlhosting
Copy link

@maietta thanks for the explaining, I managed to generate the API key too, yet still when I add it in the web ui app, it gives error.

@uhlhosting
Copy link

I think I got it working in app.shlink.to, would be nice to add this too in caprover.

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