ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 8 forks source link

[HELP] Some settings are not working and I'd like some help, thanks! #30

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello,

I'm configuring the hypernode-docker with docker-compose for my local development.

Here's my docker-compose.yml file:

version: '3'
services:
  app:
    build:
      context: docker/images/hypernode
      dockerfile: Dockerfile
    image: smoke/hypernode
    volumes:
      - '.:/data/web/public/:cached'
      - 'hypernode-db:/data/mysql/:cached'
    working_dir: /data/web/
    ports:
      - '80:80'
      - '222:22'
      - '443:443'
      - '3306:3306'
volumes:
  hypernode-db:
    driver: local

You can see that I'm using a custom Dockerfile. That's because I found that the easier way to have some of the configurations I need to be persisted into the codebase.

Here's the Dockerfile

FROM docker.hypernode.com/byteinternet/hypernode-docker:latest

COPY 60_restart_services.sh /etc/my_init.d/60_restart_services.sh
COPY outside.conf /etc/nginx/outside.conf

RUN echo "app     ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN apt-get update && apt-get install -y php-xdebug && chmod +x /etc/my_init.d/60_restart_services.sh

To enable PHP 7.2 I changed the 60_restart_services.sh, here are the changed lines:

/usr/bin/screen -S hypernode_service_php -d -m /usr/sbin/php-fpm7.2 --nodaemonize --fpm-config /etc/php/7.2/fpm/php-fpm.conf
update-alternatives --set php $(which php7.2)

To enable Varnish

I followed the instructions from here Hypernode Docker - Varnish on Docker

Issues

Varnish is not working

Once I applied the changes necessary to make Varnish run the frontend stopped working and I'm getting a 500 error.

I cannot apply the Varnish configurations on the admin panel (System > Cache Management > Apply Varnish Config). I'm getting the following error:

Error determining Varnish version: Got unexpected response code from Varnish: 500
Failed to apply the VCL to 127.0.0.1:6082: Failed to load configurator

hypernode-systemctl is not working

I'm getting the following response:

app@1988ee43035f:~$ hypernode-systemctl
Looks like something went wrong: b'{"detail":"Invalid token."}'
Looks like something went wrong: b'{"detail":"Invalid token."}'
usage: hypernode-systemctl [-h] [--verbose]
                           {settings,whitelist,block_attack,attach_backup} ...

positional arguments:
  {settings,whitelist,block_attack,attach_backup}

optional arguments:
  -h, --help            show this help message and exit
  --verbose, -v         Display debug output

Thank you very much for your help.

ghost commented 5 years ago

Update

One problem is solved and now I was able to enable the Turpentine extension.
The missing piece on the Hypernode guide is to tell that we must get the authentication key from the Varnish config.

vdloo commented 5 years ago

Hi, the hypernode-systemctl tool doesn't work for the docker. It will attempt to connect to the hypernode-api and that can only manage settings for real production Hypernodes. The reason we do include it in the hypernode-docker is so that if you want to use the token of your production Hypernode to perform the hypernode-api calls not on the production Hypernode but from somewhere else (for example your CI), then you can use the hypernode-systemctl software from the container and run it there.

Also, because you have root in the hypernode-docker (but you don't have that in the production environment) you can change any settings that would otherwise be set by our control systems as a result of the API calls performed by hypernode-systemctl yourself.

ghost commented 5 years ago

Thanks for your explanations @vdloo. All good, really nice project 👍🏽