Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Struggling with the docker support of this project. #300

Closed
Leopere opened this issue Feb 13, 2020 · 27 comments
Closed

Struggling with the docker support of this project. #300

Leopere opened this issue Feb 13, 2020 · 27 comments

Comments

@Leopere
Copy link
Contributor

Leopere commented Feb 13, 2020

Creating a new issue for a bug report

🐛 If you think you've spotted a bug, give as many details as possible by starting with that informations:

  • docker build from source
  • included dockerfile and included versions
  • Details of the error/behavior:
    I posted the details in the Gitter but basically the docker stuff needs a lot of work seemingly. I can't go from a git clone, follow instructions, and get a running appliance.

## Feature Request

Just want to get a kick the tires instance up and running and Docker is usually the route but it seems this project may have abandoned the docker stuff. Either that or the documentation has drifted significantly.

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

I should try. but as nobody care about that project, I didn't take care of the docker file.

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Oh man, I'll use the heck out of this project if it works!

The fact that you can run hooks based on RSS feeds alone is hugely useful for me, I've literally been looking for something that will do this for years!

The biggest flaws I have found in the Docker stuff are as follows:

  • First time installation should create the databases rather than making me run SQL commands.
  • Allowed_Hosts should be set to ALL so that I can put a reverse proxy in front of it so I can add LetsEncrypt using something like Traefik Nginx or CaddyServer
  • The docker-compose.yml should come with more configuration done out of the box almost so that a user can just copy and paste it into a test server to try it right away.
  • Perhaps a demo server should be running somewhere.

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

I followed this page https://trigger-happy.readthedocs.io/en/latest/docker_guide/index.html and all went well

after docker-compose up you can see

web_1    | System check identified no issues (0 silenced).
web_1    | February 13, 2020 - 17:38:21
web_1    | Django version 2.2.10, using settings 'django_th.settings_docker'
web_1    | Starting development server at http://0.0.0.0:8000/
web_1    | Quit the server with CONTROL-C.

so follow the steps

  • Build
  • Database
  • Run

You can meet problem but that could be because of some systemp lib not installed, like libtidy, or the redis server package not installed

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

I will provide a asciinema recording to show my results shortly.

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

It's also very strange that there is more than one FROM line in the default Dockerfile

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

image
Console recording of me following the steps directly as written only adding the undocumented assumed git clone at the beginning.
https://asciinema.org/a/7s4kmYu9SqmBkZr7Jp7alTg4X

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

This here is the broken appliance that is deployed via following the instructions to the letter. http://s.nixc.us:8000/

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

yes ; it's "normal" , As I've written this occurs because you did the step "Run" before the step "Database"

  1. "Build"
  • docker-compose build
  1. "Database"
  • docker-compose run web python manage.py migrate --settings=django_th.settings_docker
  • docker-compose run web python manage.py loaddata initial_services --settings=django_th.settings_docker
  • docker-compose run web python manage.py createsuperuser --settings=django_th.settings_docker
  1. "Run"
  • docker-compose up

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Oh, I see! Can we possibly rewrite the instructions to reflect the better order?

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

yes :)

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Okay still no joy
https://asciinema.org/a/vFKWRztD4ofsFAQuXmS6oTm2m is my latest recording and I'll leave the site running on http://s.nixc.us:8000 for now so you can see.

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

set the var

ALLOWED_HOSTS = ['your.doamin.tld'] 

in the settings_docker.py

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Could it be set in the docker-compose.yml as an environment variable?

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

i don't know I don't thing so.

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Okay so I'm struggling to locate settings_docker.py inside this repository is there a more precise path to see it in?

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

you entered the path of that file 3 times :) it's in django_th folder

django_th/settings_docker.py

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

In here?
image

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

nano django_th/settings_docker.py from where you are

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Ah I'm not sure why using the github search function wasn't showing me that file.

Okay, I'll add that is there any other commands that I should be re-running prior to re-launching?

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

just the "up"

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

  File "/app/django_th/settings_docker.py", line 11
    'ALLOWED_HOSTS = ['s.nixc.us']',
                       ^
SyntaxError: invalid syntax
root@s:/tmp/django-th|master⚡ ⇒  cat django_th/settings_docker.py
from .th_settings import *

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'postgres',
        'USER': 'postgres',
        # 'PASSWORD': 'th_pass',
        'HOST': 'db',
        'PORT': 5432,
        'ALLOWED_HOSTS = ['s.nixc.us']',
    }
}

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

from .th_settings import *

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'postgres',
        'USER': 'postgres',
        # 'PASSWORD': 'th_pass',
        'HOST': 'db',
        'PORT': 5432,
        
    }
}
ALLOWED_HOSTS = ['s.nixc.us']

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

HA I guess I should learn to read Python that makes way more sense. Sorry for the total rookie mistake. I know docker not python :P

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Okay, awesome! Is there a way that we can have that setting either documented or added to that install script that is run in the setup?

The thing is successfully running however sadly it doesn't auto redirect from http://my.tld:8000/ to http://my.tld:8000/th/ so you immediately get a 404 of a sort
image
However, as shown here
image
it's up and running!

@foxmask
Copy link
Owner

foxmask commented Feb 13, 2020

yes yes

now the login user is the superuser you created earlier

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

Yes, that worked perfectly!

@Leopere
Copy link
Contributor Author

Leopere commented Feb 13, 2020

#304 would be the continuation of this.

@Leopere Leopere closed this as completed Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants