I am using dockerfile maven plugin to build the docker images. In pom.xml file, 3 args will be sent to the dockerfile. I have added my dockerfile here.
ARG PROJECT_BASE_DIR
ARG TOMCAT_JULI_ADAPTER_VERSION
ARG TOMCAT_JULI_VERSION
FROM tomcat:8.0-jre8
ADD ${PROJECT_BASE_DIR}/target/dependency/log4j-1.2.17.jar /usr/local/tomcat/lib/
ADD ${PROJECT_BASE_DIR}/target/dependency/ojdbc7-12.1.0.2.jar /usr/local/tomcat/lib/
ADD ${PROJECT_BASE_DIR}/target/dependency/tomcat-extras-juli ${TOMCAT_JULI_ADAPTER_VERSION}.jar /usr/local/tomcat/lib/
ADD ${PROJECT_BASE_DIR}/target/dependency/tomcat-juli-${TOMCAT_JULI_VERSION}.jar /usr/local/tomcat/bin/
ADD ${PROJECT_BASE_DIR}/configuration/log4j.properties /usr/local/tomcat/lib/
ADD ${PROJECT_BASE_DIR}/configuration/server.xml /usr/local/tomcat/conf/
ADD ${PROJECT_BASE_DIR}/scripts/setenv.sh /usr/local/tomcat/
RUN chmod +x setenv.sh
RUN rm /usr/local/tomcat/conf/logging.properties
EXPOSE 8080
ENTRYPOINT [ "sh", "-c", "./setenv.sh" ]
pom.xml file
<configuration>
<repository>${docker.image.name}</repository>
<tag>${project.version}</tag>
<buildArgs>
<PROJECT_BASE_DIR>${project.basedir}</PROJECT_BASE_DIR>
<TOMCAT_JULI_VERSION>${tomcat-juli.version}</TOMCAT_JULI_VERSION>
<TOMCAT_JULI_ADAPTER_VERSION>${tomcat-juli-adapters.version}</TOMCAT_JULI_ADAPTER_VERSION>
</buildArgs>
</configuration>
When this is run, It won't take the value in ${TOMCAT_JULI_VERSION} and ${TOMCAT_JULI_ADAPTER_VERSION} but ${PROJECT_BASE_DIR} value is taken. I'm getting following error.
ADD failed: stat
/var/lib/docker/tmp/docker-builder537359917/target/dependency/tomcat-extras-juli-.jar:
no such file or directory
Related
I want to file from .ebextentions/td-agent.conf to /etc/td-agent/td-agent.conf. But its not working and getting below error.
if you see attached image, there are 3 files in .ebextentions. I had put copy command in 01-main.config.
---
container_commands:
01_cron_job:
command: "touch /tmp/is_leader"
leader_only: true
01_tdconfcopy_job:
command: "yes | cp .ebextensions/td-agent.conf /etc/td-agent/td-agent.conf"
error is as given below
Command failed on instance. Return code: 1 Output: cp: cannot create regular file '/etc/td-agent/td-agent.conf': No such file or directory
The issue is you're copying a file to a directory that doesn't exist. You should create the output directory first and then copy config files.
So it would be:
---
container_commands:
01_cron_job:
command: "touch /tmp/is_leader"
leader_only: true
01_create_dir:
command: "sudo mkdir -p /etc/td-agent/"
02_tdconfcopy_job:
command: "yes | cp .ebextensions/td-agent.conf /etc/td-agent/td-agent.conf"
Alternatively, you could to create a file on the server directly with files command.
files:
"/etc/td-agent/td-agent.conf":
mode: "000644"
owner: root
group: root
content: |
content of your config file that you want to copy
I'm running 3 pipelines in jenkins (CI, CD, CDP) when I run the CI pipe the final stage is a trigger for activate the pipe CD (Continuous Deployment), this receive a parameter APP_VERSION from CI (Continuous Integration) PIPE and deploy an instance with packer and run SERVERSPEC TEST, but serverspec test failed.
but the demo-app is installed via salstack
The strange is when I run the CD and pass the parameter APP_VERSION manually this WORK !!
this is the final stage for pipeline CI
stage "Trigger downstream"
echo 'parametro'
def versionApp = sh returnStdout: true, script:"echo \$(git rev-parse --short HEAD) "
build job: "demo-pipeCD", parameters: [[$class: "StringParameterValue", name: "APP_VERSION", value: "${versionApp}"]], wait: false
}
I have passed to serverspec the sbin PATH and not work.
EDIT: I add the code the test.
enter code here
require 'spec_helper'
versionFile = open('/tmp/APP_VERSION')
appVersion = versionFile.read.chomp
describe package("demo-app-#{appVersion}") do
it { should be_installed }
end
Also, i add the job pipeline
#!groovy
node {
step([$class: 'WsCleanup'])
stage "Checkout Git repo"
checkout scm
stage "Checkout additional repos"
dir("pipeCD") {
git "https://git-codecommit.us-east-
1.amazonaws.com/v1/repos/pipeCD"
}
stage "Run Packer"
sh "echo $APP_VERSION"
sh "\$(export PATH=/usr/bin:/root/bin:/usr/local/bin:/sbin)"
sh "/opt/packer validate -var=\"appVersion=$APP_VERSION\" -var-
file=packer/demo-app_vars.json packer/demo-app.json"
sh "/opt/packer build -machine-readable -
var=\"appVersion=$APP_VERSION\" -var-file=packer/demo-app_vars.json
packer/demo-app.json | tee packer/packer.log"
REPEAT .. the parameter APP_VERSION in job pipe is rigth and the demo-app app is installed before the execute the test.
I now have installed new template into my computer.
https://github.com/jodacame/apidocjs-template-dark-Slate-Inspiration-
as per the documentation in the above link shows, I've done the following:
git clone https://github.com/jodacame/apidocjs-template-dark-Slate-Inspiration-.git
cd yourproject
this last line I've changed a bit:
Original as per template documentation:
apidoc --template ../apidocjs-template-dark-Slate-Inspiration-/template/
mine:
apidoc --template apidocjs-template-dark-Slate-Inspiration-/template/
the folder structure:
project folder/
apidocjs-template-dark-Slate-Inspiration-
apidoc.json
api_project.json
api_project.js
api_data.json
api_data.js
vendor
locales
fonts
css
And my apidoc.json looks like this:
{
"name": "XX API Introduction",
"version": "0.1.0",
"description": "wemfdkmesof.......",
"title": "Custom apiDoc browser title",
"url" : "http://xxx/api.php/v1",
"template": {
"withCompare": true,
"withGenerator": true
}
}
and I always run this command to generate documentation after any changes made:
apidoc -f .php -i ./ -o ./
Please guide me why the template not changing to the new one and how do I do that?
try adding -t path/to/template every time you update the doc
eg.
apidoc -f .php -i ./ -o ./ -t ./apidocjs-template-dark-Slate-Inspiration-/template/
I have a problem with my configuration supervisor, my file is in etc/supervisor/conf.d/realtimecolonybit.conf,
When I try command supervisorctl reread, show me the "No config updates to processes" and when I try the other command like this
supervisorctl status realtimecolonybit
Shows me this error
realtimecolonybit FATAL can't find command '/home/ubuntu/realtimecolonybit/bin/start.sh;'
And when try the supervisorctl start realtimecolonybit
show me this error
realtimecolonybit: ERROR (no such file)
My configuration in my file realtimecolonybit.conf is below
[program:realtimecolonybit]
command = /home/ubuntu/realtimecolonybit/bin/start.sh;
user = root
stdout_logfile = /home/ubuntu/realtimecolonybit/logs/realtimecolonybit.log;
redirect_strderr = true;
My configuration from my file start.sh is below
#!/bin/bash
NAME="realtimecolonybit"
DJANGODIR=/home/ubuntu/realtimecolonybit/colonybit
SOCKFILE=/home/ubuntu/realtimecolonybit/run/gunicorn.sock
USER=root
GROUP=root
NUM_WORKERS=3
DJANGO_SETTINGS_MODULE=colonybit.settings
echo "Starting $NAME as `whoami`"
cd $DJANGODIR
source /home/ubuntu/realtimecolonybit/bin/activate
# workon realtimecolonybit
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPAHT=$DJANGODIR:$PYTHONPATH
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR
exec daphne -b 0.0.0.0 -p 8001 colonybit.asgi:application
When I run without supervisor like this
(realtimecolonybit)realtimecolonybit/#/ ./bin/start.sh
it's run ok and working well, but sometimes down the server
I try to run a Django 1.11 and django_channel with supervisor my app is in aws.
I solve my problem, the error was in file .conf, I remove ; and remove the .sh, change the start.sh to start
wrong command
command = /home/ubuntu/realtimecolonybit/bin/start.sh;
correct command
command = /home/ubuntu/realtimecolonybit/bin/start
After installing/configuring whenever-elasticbeanstalk gem, I'm seeing the following error in /var/log/cfn-init.log on my EC2 instance after running git aws.push from my local repo.
Iam using aws elastic benastalk with rails 4.
2014-10-21 08:08:37,602 [DEBUG] Running test for command cron_01_set_leader
2014-10-21 08:08:37,744 [DEBUG] Test command output:
2014-10-21 08:08:37,745 [DEBUG] Test for command cron_01_set_leader passed
2014-10-21 08:08:38,085 [ERROR] Command cron_01_set_leader (su -c "/usr/local/bin/bundle exec create_cron_leader --no-update" $EB_CONFIG_APP_USER) failed
2014-10-21 08:08:38,086 [DEBUG] Command cron_01_set_leader output: bash: /usr/local/bin/bundle: No such file or directory
Traceback (most recent call last):
I have added the whenever-elasticbeanstalk
Below is my cron.config file content..
Any idea ...what am i doing wrong?
files:
# Reload the on deployment
/opt/elasticbeanstalk/hooks/appdeploy/post/10_reload_cron.sh:
mode: "00700"
owner: root
group: root
content: |
#!/usr/bin/env bash
. /opt/elasticbeanstalk/containerfiles/envvars
cd $EB_CONFIG_APP_CURRENT
su -c "/usr/local/bin/bundle exec setup_cron" $EB_CONFIG_APP_USER
# Add Bundle to the PATH
"/etc/profile.d/bundle.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
export PATH=$PATH:/usr/local/bin
encoding: plain
container_commands:
cron_01_set_leader:
test: test ! -f /opt/elasticbeanstalk/containerfiles/.cron-setup-complete
leader_only: true
cwd: /var/app/ondeck
command: su -c "/usr/local/bin/bundle exec create_cron_leader --no-update" $EB_CONFIG_APP_USER
cron_02_write_cron_setup_complete_file:
cwd: /opt/elasticbeanstalk/containerfiles
command: touch .cron-setup-complete
Which solution stack are you using? Can you give the exact name, something like "64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.1 (Puma)".
I think you will need to replace "/usr/local/bin/bundle" with the actual version of bundle that is used for the solution stack.
Can you just try using "bundle" instaed of "/usr/local/bin/bundle"?