Giter Site home page Giter Site logo

docker-polr's Introduction

⚠️ POLR IS UNMAINTAINED SINCE FEBRUARY 2021⚠️
I suggest you to use more up-to-date alternatives such as Shlink or Kutt.it.

Polr on Alpine Linux with Docker

Docker Image Size Docker Pulls Docker Latest Version

A Docker image for Polr.

Usage

Start the Docker container:

docker run -p 8080:8080 \
    -e "DB_HOST=localhost" \
    -e "DB_DATABASE=polr" \
    -e "DB_USERNAME=polr" \
    -e "DB_PASSWORD=password" \
    -e "APP_ADDRESS=example.com" \
    -e "ADMIN_USERNAME=admin" \
    -e "ADMIN_PASSWORD=admin" \
    ajanvier/polr

Or use the example docker-compose.yml.

SSL not included, I made it originally to work with nginx-proxy.

Environment variables

Name Description
DB_CONNECTION Type of database (default: mysql)
DB_HOST (required) Host of the MySQL server
DB_PORT Port of the MySQL server (default: 3306)
DB_DATABASE Name of the MySQL database (default: polr), or path of sqlite file
DB_USERNAME Name of the MySQL user (default: polr)
DB_PASSWORD (required) Password of the MySQL user
APP_NAME Your app's name (shown on interface) (default: My Polr)
APP_PROTOCOL Protocol to access your app. (default: https://)
APP_ADDRESS (required) Your app's external address (ex: example.com)
ADMIN_USERNAME (required) Username of the admin user
ADMIN_PASSWORD (required) Password of the admin user
ADMIN_EMAIL Email of the admin user
SETTING_PUBLIC_INTERFACE Set to true to show an interface to logged off users
If false, set the SETTING_INDEX_REDIRECT
You may login by heading to /login if the public interface is off
(default: true)
SETTING_SHORTEN_PERMISSION Set to true to require users to be logged in before shortening URLs
(default: false)
SETTING_INDEX_REDIRECT You must set SETTING_INDEX_REDIRECT if SETTING_PUBLIC_INTERFACE is false
Polr will redirect logged off users to this URL
SETTING_REDIRECT_404 Set to true if you wish to redirect 404s to SETTING_INDEX_REDIRECT
Polr will redirect logged off users to this URL
SETTING_PASSWORD_RECOV Set to true to enable password recovery (default: false)
SETTING_AUTO_API Set to true to generate API keys for each user on registration (default: false)
SETTING_ANON_API Set to true to allow anonymous API access (default: false)
SETTING_ANON_API_QUOTA Set the anonymous API quota per IP
SETTING_PSEUDORANDOM_ENDING Set to true to use pseudorandom strings rather than using a counter by default (default: false)
SETTING_ADV_ANALYTICS Set to true to record advanced analytics (default: false)
SETTING_RESTRICT_EMAIL_DOMAIN Set to true to restrict registration to a specific email domain (default: false)
SETTING_ALLOWED_EMAIL_DOMAINS A comma-separated list of permitted email domains
POLR_ALLOW_ACCT_CREATION Set to true to allow signups, false to disable (default: false)
POLR_ACCT_ACTIVATION Set to true to require activation by email (default: false)
POLR_ACCT_CREATION_RECAPTCHA Set to true to require reCAPTCHAs on sign up pages
If this setting is enabled, you must also provide your reCAPTCHA keys in POLR_RECAPTCHA_SITE_KEY and POLR_RECAPTCHA_SECRET_KEY
(default: false)
POLR_BASE 32 or 62 (default: 62)
POLR_RECAPTCHA_SITE_KEY reCAPTCHA site key
POLR_RECAPTCHA_SECRET_KEY reCAPTCHA secret key
Set each to blank to disable mail
MAIL_HOST Hostname of the mail server
MAIL_PORT Port of the mail server
MAIL_USERNAME User name on the mail server
MAIL_PASSWORD User password
MAIL_FROM_ADDRESS "From" address
MAIL_FROM_NAME "From" name

docker-polr's People

Contributors

ajanvier avatar craeckie avatar iwex avatar max-sum avatar nightah avatar raphox avatar trafex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-polr's Issues

Links in menu using 443

The links in the menu at the top right are using 443 (example.com:443/admin)

Setting the APP_PROTOCOL to http:// should fix this ?

I'm using the letsencrypt reverse proxy so I want the container to stay non-https and have the reverse proxy manage the security.

Postgres support

Does this docker image support postgres?

docker logs show:

wait-for-it.sh: db:5432 is available after 0 seconds


  [PDOException]
  SQLSTATE[HY000] [2006] MySQL server has gone away



  [PDOException]
  PDO::__construct(): MySQL server has gone away

wait-for-it keeps spinning it's wheels

I think this is an issue of not understanding the install process for this, and I'm hoping you can help clarify if that's the case or not.

I've installed using the following CLI command (passwords redacted)

docker run -d
--name polr
--env DB_HOST='localhost'
--env DB_DATABASE='rdw_polr_docker'
--env DB_USERNAME='rdw_polr_docker'
--env DB_PASSWORD='dbPassword'
--env APP_ADDRESS='rdw.one'
--env ADMIN_USERNAME='heatheriac'
--env ADMIN_PASSWORD='password'
--publish 18180:8080
--restart always
ajanvier/polr`

but in my logs in Portainer, I just get the same three lines repeating over and over:

wait-for-it.sh: waiting 120 seconds for localhost:3306
wait-for-it.sh: timeout occurred after waiting 120 seconds for localhost:3306
wait-for-it.sh: strict mode, refusing to execute subprocess

It's like the database isn't spinning up, and I'm not sure if this means if there's some secondary container I'm supposed to be running or what

Inconsistent environment variable naming

Environment variables used by this docker image sometimes differ from what Polr actually uses (nameley ST_ vs SETTING_). Moreover the readme contains Polr specific names, which won't work once you set them. This is confusing, any particular reason to do it that way?

SETTING_SHORTEN_PERMISSION=${ST_SHORTEN_PERMISSION}

Add wait-for-it.sh to check if database is already running.

The current Dockerfile startup procedure does expect that there is already a database running.
If you try to run docker-compose the service will fail as the initialization of the database takes longer then starting the polr container. Therefore the database does not get migrated with the correct tables if it is empty.
By using the wait-for-it.sh script to start /start.sh in the ENTRYPOINT, you could test if the port of the database is accessible.

I think running polr without a database is never possible? Therefore it should be always usful to check if the database is accessible.

PHP <7.3 bug with MariaDB = 10.2.35, 10.3.26

The container currently does not run if a user is running the aforementioned versions of MariaDB.
It will result in the following error:

  [PDOException]
  SQLSTATE[HY000] General error: 1835 Malformed communication packet




  [PDOException]
  SQLSTATE[HY000] General error: 1835 Malformed communication packet


Updating...


  [ErrorException]
  get_headers(): php_network_getaddresses: getaddrinfo failed: Name does not resolve




  [PDOException]
  SQLSTATE[HY000] General error: 1835 Malformed communication packet

You can find more information regarding the bug here and here.

Looks like just rebuilding the container would force it to update to PHP 7.3 and resolve the issue, however, I noticed when attempting to do so that the container wouldn't start due to the wait-for-it.sh script with the following error(s):

timeout: unrecognized option: t
BusyBox v1.31.1 () multi-call binary.

Usage: timeout [-s SIG] SECS PROG ARGS

Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
Default SIG: TERM.
wait-for-it.sh: timeout occurred after waiting 120 seconds for mariadb:3306
wait-for-it.sh: strict mode, refusing to execute subprocess
timeout: unrecognized option: t
BusyBox v1.31.1 () multi-call binary.

Usage: timeout [-s SIG] SECS PROG ARGS

Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
Default SIG: TERM.
wait-for-it.sh: timeout occurred after waiting 120 seconds for mariadb:3306
wait-for-it.sh: strict mode, refusing to execute subprocess
timeout: unrecognized option: t
BusyBox v1.31.1 () multi-call binary.

Usage: timeout [-s SIG] SECS PROG ARGS

Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
Default SIG: TERM.
wait-for-it.sh: timeout occurred after waiting 120 seconds for mariadb:3306
wait-for-it.sh: strict mode, refusing to execute subprocess

Updating to the latest wait-for-it.sh seems to resolve the issue, and doing so would result in another push to DockerHub which would in turn update PHP so I'll add a PR shortly to fix this.

Class AdminSeeder does not exist

Got the newest version (with the braclet) but it still doesnt quite work :c

Error:
[ReflectionException]
Class AdminSeeder does not exist

Tables are being created but obviously not the "admin" user.

Startup Error in Docker compose example

Hi there.

Sadly there is an error when you start up the docker compose example of yours.
When I want to startup the file the following error is thrown:

[ReflectionException]
Class AdminSeeder does not exist

And of course I can't login afterwards :-)

Cheers

URL Shortening Doesn't Work On Install

Expected Behavior

You enter the URL, click shorten and it should give you the shortened link.

Current Behavior

A red error message appears in the top right corner, saying the link I am trying to shorten already appears to be already shortened. (tried many links from youtube, facebook, google, non work locally but they do in the demo)

Possible Solution

Unaware what could be causing this. Tried on 3 different droplets.

Steps to Reproduce (for bugs)

Tired docker run and tried docker compose

  1. Create docker-compose.yml File
  2. Enter Env Variables
  3. docker compose up

or

  1. Run docker command

Your Environment

Digital Ocean Droplets
Chrome: Latest
Safari: Latest
Server: Ubuntu 18.4
Server 2: Linux Alpine Latest
Server 3: LAMP on Ubuntu 18.4

Polr not using APP_ADDRESS

Hello,
I don't know how active you are on GitHub but it seems like Polr is not using the env variable APP_ADDRESS properly.
Let's say I am running this behing a reverse proxy to give it a domain name, so I have to use APP_ADDRESS.
When I click on a button like "About", the app name button or even just login, it is redirecting me to my localhost.
If I go to sub.domain.tld/admin I'm in the regular admin panel, but if you get redirected after clicking the login button it sends you to 127.0.0.1:(whatever port)

500 Error on /action/lookup instead of 404 when url_ending does not exist

Hi! Thank you for making this docker image - really appreciate it. I ran in to an issue when running a GET/POST on the action/lookup endpoint. When using the endpoint to confirm that a url_ending has been used, it works perfectly if the ending DOES exist in the database, however, if the link DOES NOT exist, then I receive a 500 error instead of a 404 Link does not exist as mentioned in the Polr source code here

I ran this test on the official demo site Polr has: demo.polr.me and this same API call returns a 404 (which is what I expect). Which leads me to believe it's an issue in this image, so I was wondering if anyone else had this problem?

I deployed on DigitalOcean with the following configuration setup using mysql in another container on same host:

DB_HOST=MYHOST
DB_DATABASE=link
DB_USERNAME=root
DB_PASSWORD=MYSECRETPASSWORD
APP_ADDRESS=link.encoreapp.co
ADMIN_USERNAME=root
ADMIN_PASSWORD=MYSECRETPASSWORD

Here's the GET error I receive:

2021-03-13T05:24:39.865756513Z 10.0.1.14 - - [13/Mar/2021:05:24:39 +0000] "GET /api/v2/action/lookup?url_ending=test&key=MYAPIKEY HTTP/1.0" 500 4558 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" "108.214.21.187" 0.081 0.080 . -

This 500 returns HTML and says: Whoops, looks like something went wrong. No other help message unfortunately.

Can anyone else replicate?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.