NGINX error when deploying static website with Concourse CI - nginx

I encounter an error when I try to deploy a static website to Pivotal Web Services with Concourse CI. I want to push a static website using the static_buildpack. The index.html is placed in the root folder. When I push the code from the command line directly to Pivotal Web Services using the cf push command everything works fine.
When I use the concourse pipeline the build is terminated successfully however I get an error when accessing the website. I get an nginx 403 Forbidden error when trying to access the website. I tried the following manifest with the following pipeline (see below). When using Concourse CI the container is created successfully, the buildpack is used, nginx is installed and the droplet is uploaded. The app itself starts successfully.
The Cloud Foundry Logs show the following error:
2017/09/05 08:42:54 [error] 70#0: *3 directory index of "/home/vcap/app/public/" is forbidden, client: <ip>, server: localhost, request: "GET / HTTP/1.1", host: "agencydemo.cfapps.io"
manifest.yml
---
applications:
- name: agencyDemo
memory: 64M
buildpack: staticfile_buildpack
host: agencyDemo
pipeline.yml
resources:
- name: app_sources
type: git
source:
uri: https://github.com/smichard/CloudFoundryDemo
branch: master
- name: staging_CloudFoundry
type: cf
source:
api: {{pws_api}}
username: {{pws_user}}
password: {{pws_password}}
organization: {{pws_org}}
space: {{pws_space}}
skip_cert_check: false
jobs:
- name: deploy-website
public: true
serial: true
plan:
- get: app_sources
trigger: true
- put: staging_CloudFoundry
params:
manifest: app_sources/manifest.yml
The source code can be found on GitHub

nginx 403 Forbidden happens mainly when index.html is not found. suggested steps
Check your buildpack (which now is updated as buildpacks in manifest file)
check command or dist folder
cf push -p ./dist/ -f manifest-{your_envireonment}.yml --no-start (if your index.html is directly under dist folder )
or
cf push -p ./dist/{your_app_name} -f manifest-{your_envireonment}.yml --no-start (if your index.html is under dist/{your_app_name} folder )

You must ensure that index.html and other angular static files are directly present inside public/ folder and not in something like public/your-app-name/

Another solution is to fix the path-attribute in your manifest.yml as follows:
---
applications:
- name: agencyDemo
memory: 64M
buildpack: staticfile_buildpack
host: agencyDemo
path: ./dist/your-app-name
Docs

Related

SaltStack : How I can copy file from minion to SaltStack File Server

I need to copy a file from a minion to the saltstack server file (salt://)
How can I achieve this ?
I tried a state like this but is not working.
copy:
file.managed:
- name: salt://a.txt
- source: /tmp/a.txt
Hicham
You can use cp.push:
copy:
module.run:
- name: cp.push
- path: /tmp/a.txt
- upload_path: /tmp
Note that as documented, for security purposes, you have to set file_recv to True in the master configuration file, and restart the master, in order to enable this feature, and even then the minion is only allowed to upload the file to the minion's cache directory (/var/cache/salt/master/minions/minion-id/files). Specifying upload_path would upload the file to a sub-directory inside the cache directory.

I am trying to configure nginx as proxy server but getting an error while composing docker file

I am trying to configure nginx as proxy server but getting an error. I have created below file as part of my work.
DockerFile
FROM nginx:1.10.1-alpine
RUN rm /etc/nginx/conf.d/*
COPY proxy.conf /etc/nginx/conf.d/
Proxy.config
server {
listen 80;
location / {
proxy_pass http://app;
}
}
docker-compose.yml
version: '2'
services:
app:
build: app
proxy:
build: proxy
ports:
- "80:80"
When I build docker-compose file I am getting following error:
Puja:Docker pujadudhat$ docker-compose build
Building app
Step 1/2 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd
Step 2/2 : COPY index.html /usr/share/nginx/html
---> Using cache
---> 9d105a18fb9d
Successfully built 9d105a18fb9d
Building proxy
Step 1/3 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd
Step 2/3 : RUN rm /etc/nginx/conf.d/*
---> Using cache
---> a4e1efc3f050
Step 3/3 : COPY proxy.conf /etc/nginx/conf.d/
ERROR: Service 'proxy' failed to build: lstat proxy.conf: no such file or directory
I am getting this error "Service 'proxy' failed to build: lstat proxy.conf: no such file or directory. Can anyone help me to solve? Thank you.n
Looks like you are missing the proxy.conf in your project where you build the docker container. It looks like you have it named Proxy.conf and it should be named proxy.conf.

Symfony2, Swagger 2 and Bundle TimeIncOSS swagger-bundle error

I work with symfony project and i want to generate documentation for my REST Web Service with swagger 2,so i installed swagger-bundle
and i configurid it.but when i tri to generate the json api documenation with this command
app/console -e=dev swagger:dump
i got this error.
You must call one of in() or append() methods before iterating over a
Finder.
this is my config file
swagger:
version: '2.0'
info:
title: 'My API'
version: '1.0.0'
description: 'My API Description'
host: '127.0.0.1'
base_path: '/v2'
schemes:
- http
produces:
- application/json
consumes:
- application/json
annotations:
bundles:
- BOBundleBundle
any help please.
check if you put the settings in the correct config file (app/config/config_dev.yml)

Duplicate permission setting instructions CodeDeploy

I'm trying to use CodeDeploy to deploy an application onto EC2 but I am facing the following error
Duplicate permission setting instructions for /var/www/html/storage/framework
My appspec.yml is below
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html
permissions:
- object: /var/www/html
owner: apache
group: apache
mode: 644
except:
- storage/*
type:
- directory
- object: /var/www/html/storage
owner: apache
group: apache
mode: 777
type:
- directory
I've tried various formats for except including
Explicitly listing relative paths
except:
- storage
- storage/app
- storage/logs
- storage/framework
- storage/framework/views
- storage/framework/cache
- storage/framework/sessions
Using a wildcard
except:
- storage/*
Using just the folder name
except:
- storage
None of which seem to resolve the issue.
Similar questions
AWS CodeDeploy Duplicate permission
Duplicate permission setting instructions
The except option needs to be specified as an array. (Use [] not a nested list)
You can see it in the permissions examples in the appspec reference guide (scroll down a little): http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html#app-spec-ref-permissions

Redmine under sub-directory on nginx

My vhost configuration: http://pastebin.com/ZyXUmQtx (only one domain on this installation)
I've been racking my head and Google for a solution the last two days and can't quite seem to come up with a solution that works.
My setup (from the above configuration):
IP.Board 3.4 installation in %root_domain%/forums/
IP.Content 2.3 installation in %root_domain/forums/ (with external access index.php on the top-level)
Redmine 2.2.2 install at /usr/share/redmine (this is working because Thin is running and there are no errors in either log file)
Stale phpMyAdmin configuration at /usr/share/phpmyadmin/ that also kinda doesn't load html/css properly.
Symlink to /usr/share/redmine/public to /srv/www/tiberian-genesis.net/public_html/redmine
I'm trying to get redmine setup to run under %root_domain%/redmine/, but I keep getting a 404 page from my IP.Content installation.
Accessing it takes me to the url: /redmine/login?back_url=http://redmine_thin_servers/redmine/ (which now that notice it, it seems to not like my upstream...)
In case someone requests the Thin configuration file:
---
pid: /var/run/thin/redmine.pid
group: tgmod
prefix: /redmine
timeout: 30
log: /var/log/thin/redmine.log
max_conns: 1024
require: []
max_persistent_conns: 512
environment: production
user: tgmod
servers: 1
daemonize: true
chdir: /usr/share/redmine
socket: /var/run/thin/redmine.sock
I'm out of ideas here.
Thanks in advance!
I just ended up setting it up on a sub-domain. I wanted to try to proxy it on a sub-directory, but my main website kept interfering with the rules.

Resources