rewardenv / reward

Reward is a Swiss Army knife CLI utility for orchestrating Docker based development environments.
https://rewardenv.readthedocs.io
MIT License
89 stars 13 forks source link

nginx error appearing when using "local" env type #31

Closed eoinjamesdineen closed 1 year ago

eoinjamesdineen commented 1 year ago

I'm trying to build a container in the "local" reward env type and I'm running into this issue

ERROR: The Compose file is invalid because:
Service nginx has neither an image nor a build context specified. At least one must be provided.

image

The core folder contains a valid Dockerfile (Dockerfile.dev)

Here is the .env file

REWARD_ENV_NAME=e4
REWARD_ENV_TYPE=local
REWARD_WEB_ROOT=/

TRAEFIK_DOMAIN=e4.test
TRAEFIK_SUBDOMAIN=
TRAEFIK_EXTRA_HOSTS=

here is the .reward/reward-env.yml file

version: "3.5"
services:
  graphql:
    hostname: "{{ .reward_env_name }}-graphql"
    build:
      context: ./core
      dockerfile: Dockerfile.dev
    labels:
      - traefik.enable=true
      - traefik.http.routers.custom.tls=true
      - traefik.http.routers.custom.rule=Host(`{{ default "app" .traefik_subdomain }}.{{ default "custom.test" .traefik_domain }}`)
      - traefik.http.services.custom.loadbalancer.server.port=4000
      - traefik.docker.network={{ .reward_env_name }}_default
      - dev.reward.container.name=custom-container
      - dev.reward.environment.name={{ .reward_env_name }}

I see on https://github.com/davidalger/m2demo/blob/master/.warden/warden-env.yml that an nginx service is defined. Do I always need to provide one by default?

Thanks!

eoinjamesdineen commented 1 year ago

Perhaps this is part of a larger issue around local environment types @janosmiko ?

When I add

  nginx:
    image: nginx

to workaround the issue for now, it seems to be pulling down a bunch of services that I do not want (and wouldn't expect the local environment to contain like rabbitmq, opensearch, varnish etc) and ends in an error message

reward env up
INFO Creating network...                          
Creating network "e4_default" with the default driver
Creating volume "e4_osdata" with default driver
Creating volume "e4_rabbitmq" with default driver
Creating volume "e4_appdata" with default driver
Pulling rabbitmq (docker.io/rewardenv/rabbitmq:3.8)...
3.8: Pulling from rewardenv/rabbitmq
d7bfe07ed847: Pull complete
a8249261ea33: Pull complete
a6308381df18: Pull complete
626529a25d27: Pull complete
20919addf7c9: Pull complete
c61a1fb2610f: Pull complete
1f73e996a37b: Pull complete
90d8751c13b1: Pull complete
8fe6b167bcbe: Pull complete
Digest: sha256:6fd1a0099136a28ec461e96db98047edc671fa29e7510c6a3d826c7f36a84209
Status: Downloaded newer image for rewardenv/rabbitmq:3.8
Pulling opensearch (docker.io/rewardenv/opensearch:1.2)...
1.2: Pulling from rewardenv/opensearch
f964900200fc: Pull complete
b8b221d62429: Pull complete
290b0f004bd4: Pull complete
848c3042df9a: Pull complete
324797986c30: Pull complete
97b6fb1bca8e: Pull complete
96a22e2e461d: Pull complete
Digest: sha256:1163aa7ff7b0448961db8822f04edc472e3677f40cbbbbfbfec8514e3085d3bc
Status: Downloaded newer image for rewardenv/opensearch:1.2
Pulling nginx (nginx:)...
latest: Pulling from library/nginx
bd159e379b3b: Already exists
6659684f075c: Pull complete
679576c0baac: Pull complete
22ca44aeb873: Pull complete
b45acafbea93: Pull complete
bcbbe1cb4836: Pull complete
Digest: sha256:5ffb682b98b0362b66754387e86b0cd31a5cb7123e49e7f6f6617690900d20b2
Status: Downloaded newer image for nginx:latest
Pulling varnish (docker.io/rewardenv/varnish:6.0)...
6.0: Pulling from rewardenv/varnish
f6e04ba65310: Pull complete
e7f39efa80ac: Pull complete
06c3ccc6f120: Pull complete
9b0f068c5e75: Pull complete
a9a9fd812664: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:a9a927d7fda0c67e2f5ee7ab24532f78a9e8f6c6cb0831c420fda462397b2920
Status: Downloaded newer image for rewardenv/varnish:6.0
Pulling e4cs_redis_local (redislabs/redisearch:latest)...
latest: Pulling from redislabs/redisearch
ae13dd578326: Pull complete
d6ee6628aaee: Pull complete
4de9632ab758: Pull complete
f3e052d5739f: Pull complete
d4cad1b1949e: Pull complete
6b31ce66d7e1: Pull complete
ac0163ddfc1c: Pull complete
df7dfe5ed6d8: Pull complete
08d7558c572c: Pull complete
1727474318dc: Pull complete
f334dae2ac55: Pull complete
5e45103ab0b7: Pull complete
1e5b14db11a4: Pull complete
d4c1c919917e: Pull complete
bca242bddab3: Pull complete
Digest: sha256:232858f16c886020a715fff74f9c5db282afa584538158a32efa8080450df322
Status: Downloaded newer image for redislabs/redisearch:latest
Pulling opensearch-dashboards (docker.io/rewardenv/opensearch-dashboards:1.2.0)...
ERROR: manifest for rewardenv/opensearch-dashboards:1.2.0 not found: manifest unknown: manifest unknown
Error: exit status 1
Usage:
  reward env [flags]

Flags:
  -h, --help   help for env

Global Flags:
      --app-dir string       app home directory (default "/home/<removed>/.reward")
  -c, --config string        config file (default "/home/<removed>/.reward.yml")
      --debug                enable debug mode (same as --log-level=debug)
      --disable-colors       disable colors in output
      --docker-host string   docker host (default "unix:///var/run/docker.sock")
      --log-level string     logging level (options: trace, debug, info, warning, error) (default "info")

INFO exit status 1

Let me know if this issue should be closed. I will try and look into the issue until I hear back but I've never worked with GO in particular.

Thanks!

janosmiko commented 1 year ago

Hello @eoinjamesdineen !

The Open Search related issue was a type, I fixed that.

I also updated Reward to make better support for local environments.

Now, the default .env file makes more sense and adds additional configuration possibilities. (Eg: you can enable/disable sync, change the synced container, etc.)

I also tried to configure an environment similar to yours with the following config:

REWARD_ENV_NAME=e4
REWARD_ENV_TYPE=local
REWARD_WEB_ROOT=/

TRAEFIK_DOMAIN=e4.test
TRAEFIK_SUBDOMAIN=
TRAEFIK_EXTRA_HOSTS=

REWARD_SHELL_CONTAINER=graphql      # the container's name is required here
REWARD_SHELL_COMMAND=bash
REWARD_SHELL_USER=root
REWARD_SYNC_CONTAINER=custom-container     # the dev.reward.container.name label is required here
REWARD_SYNC_PATH=/app
REWARD_MUTAGEN_ENABLED=true

REWARD_RABBITMQ=0
REWARD_ELASTICSEARCH=0
REWARD_OPENSEARCH=0
REWARD_VARNISH=0

RABBITMQ_VERSION=3.8
ELASTICSEARCH_VERSION=7.16
OPENSEARCH_VERSION=1.2
REDIS_VERSION=6.0
VARNISH_VERSION=6.5

I hope this helps.

eoinjamesdineen commented 1 year ago

Yeah this works for me.

Thanks for assisting