Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails silently if errors with render #23

Open
bendhouseart opened this issue Oct 7, 2020 · 0 comments
Open

fails silently if errors with render #23

bendhouseart opened this issue Oct 7, 2020 · 0 comments

Comments

@bendhouseart
Copy link

Description:

During the use of a cookiecutter template I kept getting some render errors, such that values that I was entering during nuki prompts weren't appearing in the rendered template. I determined that values were getting injected via the default cookiecutter.json so I simply commented it out as seen below:

render:
  type: nukikata
  #context_file: cookiecutter.json
  context_key: cookiecutter
  existing_context: "{{ nuki }}"
  no_input: true

No errors popped up and I was able to make it completely through the nuki menu w/ out incident. However, the project failed to render at all.

What I've run:

Note: the folder base-project should appear in the directory ~/Insight/full-stack-fastapi-postgresql after successfully rendering the template or there should be an error message when the template fails to render.

(full-stack-fastapi-postgresql) anthony@pop-os:~/Insight/full-stack-fastapi-postgresql$ tree -L 1
.
├── CONTRIBUTING.md
├── cookiecutter.json
├── {{cookiecutter.project_slug}}
├── deployments
├── hooks
├── img
├── LICENSE
├── nuki.yaml
├── Pipfile
├── Pipfile.lock
├── README.md
└── this.txt

4 directories, 8 files
(full-stack-fastapi-postgresql) anthony@pop-os:~/Insight/full-stack-fastapi-postgresql$ nukikata .
? Choose a base name for this project  Base Project
? Choose a project slug  base-project
? Enter a domain name if different from the project slug  launchwith.click
? Enter a domain for staging  stag.launchwith.click
? Do you want to customize docker swarm  Yes
? Enter a name for the docker swarm  launchwith-click
? Enter a name for the docker swarm staging  stag-launchwith-click
? Enter a value for the secret key for this project  changethis
? Enter the name of the super user for the site  [email protected]
? Enter a password for this super user  changethis
? Do you want to set up email w/ an smtp server?  Yes
? Enter a port for stmp  587
? Enter a host for stmp  
? Enter a user for stmp  
? What to set  
? Enter a default email to deliver from  [email protected]
? Enter a password for postgres  changethis
? Enter a user for pgadmin  [email protected]
? Enter a password for pgadmin  changethis
? Do you want to setup traefik?  No
? Enter a flower admin and password  admin:changethis
? Enter dsn for sentry  
? Do you want to attach any prefixes to your docker images?  No
? What AWS region?  us-west-2
? Do you want to set up an EKS cluster?  No
? Enter name of VPC otherwise leave blank for none  
? Number of azs  1
? Again number of azs, this needs to be worded better  1
? iam_instance_profile to use  
? Network name  
? Path to private sshkey  mykey2
? Path to public sshkey  mykey2.pub
? Create a security group?  false
? Create a deployment  true
? Create an EBS volume for this deployment (enter true or false)  false
Unable to render variable 'project_slug'
Error message: 'nuki' is undefined
Context: {
    "cookiecutter": {
        "_copy_without_render": [
            "frontend/src/**/*.html",
            "frontend/src/**/*.vue",
            "frontend/node_modules/*",
            "backend/app/app/email-templates/**"
        ],
        "_output_dir": "/home/anthony/Insight/full-stack-fastapi-postgresql",
        "_template": ".",
        "aws_region": {
            "default": "us-west-2",
            "message": "What AWS region?",
            "type": "input"
        },
        "azs": {
            "default": "1",
            "message": "Number of azs",
            "type": "input"
        },
        "backend_cors_origins": {
            "input": "[\"http://localhost\", \"http://localhost:4200\", \"http://localhost:3000\", \"http://localhost:8080\", \"https://localhost\", \"https://localhost:4200\", \"https://localhost:3000\", \"https://localhost:8080\", \"http://dev.{{nuki.domain_main}}\", \"https://{{nuki.domain_staging}}\", \"https://{{nuki.domain_main}}\", \"http://local.dockertoolbox.tiangolo.com\", \"http://localhost.tiangolo.com\"]",
            "type": "stat"
        },
        "create": {
            "default": "true",
            "message": "Create a deployment",
            "type": "input"
        },
        "create_ebs_volume": {
            "default": "false",
            "message": "Create an EBS volume for this deployment (enter true or false)",
            "type": "input"
        },
        "create_sg": {
            "default": "false",
            "message": "Create a security group?",
            "type": "input"
        },
        "debug": {
            "statement": "{{ nuki }}",
            "type": "pprint"
        },
        "deploy_eks_": {
            "chdir": "{{ calling_directory }}",
            "command": "cd {{ nuki.project_slug }}  && echo 'executing deploy_eks_command' >> eks.txt",
            "type": "command"
        },
        "deploy_example_": {
            "chdir": "{{ calling_directory }}",
            "command": "cd {{ nuki.project_slug }} && echo '{{ calling_directory }}' >> this.txt",
            "type": "command"
        },
        "deploy_local_": {
            "chdir": "{{ calling_directory }}",
            "command": "cd {{ nuki.project_slug }} && echo 'executing deploy_local_command' >> local.txt",
            "type": "command"
        },
        "deploy_single_": {
            "chdir": "{{ calling_directory }}",
            "command": "cd {{ nuki.project_slug }}  && echo 'executing deploy_single_command' >> single.txt",
            "type": "command"
        },
        "docker_image_backend": {
            "default": "{{nuki.docker_image_prefix}}backend",
            "message": "Enter prefix for docker image backend",
            "type": "input",
            "when": "{{ nuki.docker_prefixes > 0 }}"
        },
        "docker_image_celeryworker": {
            "default": "{{nuki.docker_image_prefix}}celeryworker",
            "message": "Enter prefix for celery worker",
            "type": "input",
            "when": "{{ nuki.docker_prefixes > 0 }}"
        },
        "docker_image_frontend": {
            "default": "{{nuki.docker_image_prefix}}frontend",
            "message": "Enter Prefix for docker image frontend",
            "type": "input",
            "when": "{{ nuki.docker_prefixes > 0 }}"
        },
        "docker_image_prefix": {
            "message": "Enter prefix for docker image",
            "type": "input",
            "when": "{{ nuki.docker_prefixes > 0}}"
        },
        "docker_prefixes": {
            "message": "Do you want to attach any prefixes to your docker images?",
            "type": "confirm"
        },
        "docker_swarm_setup": {
            "message": "Do you want to customize docker swarm",
            "type": "confirm"
        },
        "docker_swarm_stack_name_main": {
            "default": "{{nuki.domain_main|replace('.', '-')}}",
            "message": "Enter a name for the docker swarm",
            "type": "input",
            "when": "{{ nuki.docker_swarm_setup }}"
        },
        "docker_swarm_stack_name_staging": {
            "default": "{{ nuki.domain_staging | replace('.', '-') }}",
            "message": "Enter a name for the docker swarm staging",
            "type": "input",
            "when": "{{ nuki.docker_swarm_setup  }}"
        },
        "domain_main": {
            "default": "",
            "message": "Enter a domain name if different from the project slug",
            "type": "input"
        },
        "domain_staging": {
            "default": "stag.{{nuki.domain_main}}",
            "message": "Enter a domain for staging",
            "type": "input"
        },
        "eks_cluster_autoscale": {
            "default": "false",
            "message": "Autoscale workers? Enter either true or false",
            "type": "input",
            "when": "{{ nuki.setup_eks }}"
        },
        "eks_cluster_autoscale_max_workers": {
            "default": "1",
            "message": "Enter maximum number of workers",
            "type": "input",
            "when": "{{ nuki.setup_eks }}"
        },
        "eks_cluster_autoscale_min_workers": {
            "default": "1",
            "message": "Enter minimum number of workers",
            "type": "input",
            "when": "{{ nuki.setup_eks }}"
        },
        "eks_cluster_name": {
            "default": "mycluster",
            "message": "What do you want to name your eks cluster?",
            "type": "input",
            "when": "{{ nuki.setup_eks }}"
        },
        "eks_num_workers": {
            "default": "1",
            "message": "Number of workers on cluster?",
            "type": "input",
            "when": "{{ nuki.setup_eks }}"
        },
        "first_superuser": {
            "default": "admin@{{nuki.domain_main}}",
            "message": "Enter the name of the super user for the site",
            "type": "input"
        },
        "first_superuser_password": {
            "default": "changethis",
            "message": "Enter a password for this super user",
            "type": "input"
        },
        "flower_auth": {
            "default": "admin:{{nuki.first_superuser_password}}",
            "message": "Enter a flower admin and password",
            "type": "input"
        },
        "iam_instance_profile": {
            "message": "iam_instance_profile to use",
            "type": "input"
        },
        "network_name": {
            "message": "Network name",
            "type": "input"
        },
        "num_azs": {
            "default": "1",
            "message": "Again number of azs, this needs to be worded better",
            "type": "input"
        },
        "pgadmin_default_user": {
            "default": "{{nuki.first_superuser}}",
            "message": "Enter a user for pgadmin",
            "type": "input"
        },
        "pgadmin_default_user_password": {
            "default": "{{nuki.first_superuser_password}}",
            "message": "Enter a password for pgadmin",
            "type": "input"
        },
        "post_render_action_": {
            "choices": [
                {
                    "deploy": "Deploy the instance?"
                }
            ],
            "message": "What do you want to do next?",
            "type": "checkbox"
        },
        "postgres_password": {
            "default": "changethis",
            "message": "Enter a password for postgres",
            "type": "input"
        },
        "private_key_path": {
            "message": "Path to private sshkey",
            "type": "input"
        },
        "project_name": {
            "default": "Base Project",
            "message": "Choose a base name for this project",
            "type": "input"
        },
        "project_slug": {
            "default": "{{ nuki.project_name|lower|replace(' ', '-') }}",
            "message": "Choose a project slug",
            "type": "input"
        },
        "public_key_path": {
            "message": "Path to public sshkey",
            "type": "input"
        },
        "render": {
            "context_key": "cookiecutter",
            "existing_context": "{{ nuki }}",
            "no_input": true,
            "type": "nukikata"
        },
        "secret_key": {
            "default": "changethis",
            "message": "Enter a value for the secret key for this project",
            "type": "input"
        },
        "sentry_dsn": {
            "message": "Enter dsn for sentry",
            "type": "input"
        },
        "setup_eks": {
            "message": "Do you want to set up an EKS cluster?",
            "type": "confirm"
        },
        "setup_email": {
            "message": "Do you want to set up email w/ an smtp server?",
            "type": "confirm"
        },
        "smtp_emails_from_email": {
            "default": "info@{{nuki.domain_main}}",
            "message": "Enter a default email to deliver from",
            "type": "input",
            "when": "{{ nuki.setup_email }}"
        },
        "smtp_host": {
            "default": "",
            "message": "Enter a host for stmp",
            "type": "input",
            "when": "{{ nuki.setup_email  }}"
        },
        "smtp_password": {
            "default": "",
            "message": "What to set",
            "type": "input",
            "when": "{{ nuki.setup_email }}"
        },
        "smtp_port": {
            "default": "587",
            "message": "Enter a port for stmp",
            "type": "input",
            "when": "{{ nuki.setup_email }}"
        },
        "smtp_user": {
            "default": "",
            "message": "Enter a user for stmp",
            "type": "input",
            "when": "{{ nuki.setup_email }}"
        },
        "traefik_constraint_tag": {
            "default": "{{nuki.domain_main}}",
            "message": "Enter a traefik constraint tag",
            "type": "input",
            "when": "{{ nuki.traefik_setup}}"
        },
        "traefik_constraint_tag_staging": {
            "default": "{{nuki.domain_staging}}",
            "message": "Enter a domain for traefik staging",
            "type": "input",
            "when": "{{ nuki.traefik_setup}}"
        },
        "traefik_public_constraint_tag": {
            "default": "traefik-public",
            "message": "Enter a public tag for traefik",
            "type": "input",
            "when": "{{ nuki.traefik_setup}}"
        },
        "traefik_setup": {
            "message": "Do you want to setup traefik?",
            "type": "confirm"
        },
        "vpc_name": {
            "default": "",
            "message": "Enter name of VPC otherwise leave blank for none",
            "type": "input"
        }
    }
}
(full-stack-fastapi-postgresql) anthony@pop-os:~/Insight/full-stack-fastapi-postgresql$ tree -L 1
.
├── CONTRIBUTING.md
├── cookiecutter.json
├── {{cookiecutter.project_slug}}
├── deployments
├── hooks
├── img
├── LICENSE
├── nuki.yaml
├── Pipfile
├── Pipfile.lock
├── README.md
└── this.txt

4 directories, 8 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant