I tried to run the cap production deploy in a sub-directory and got the exception. Is there any way to run the command without being under root directory?
% cap production deploy (git)-[develop]
Stage not set, please call something such as `cap production deploy`, where production is a stage you have defined.
Related
This is a general question that I have been having for couple of days now and after hours of searching google I am still not sure how it works.
Say I have a single pipeline to look for my IaC code change, deploy if there are any changes, and also then build the code and then deploy to the same infrastructure created in the step before.
So, it will look something like: Pipeline
Step1/stage 1: Look for changes in the IaC code (Terraform) and then deploy if there are any changes to .tf files
step2/stage2: Build the npm application
step3/stage3: Run the tests
step4/stage4: deploy the built application to the Infrastructure.
Now let's say the if the application fails to build (step2) or if the tests (step3) fail, how do we deal with the infrastructure rollback?
You can always deploy previous versions of your application in different release or build
You should have a quality ansurance environment before production environment so as to check if new changes will work
If you want to combine rollback deployment inside the same build you can use stage conditions to add new stage which will run only if previous stages fail
Check failed() condition and combine it with 'and', 'or' keywords
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/stages?view=azure-devops&tabs=yaml#conditions
# stage B runs if A fails
- stage: B
condition: failed()
I have a situation where I need to deploy different stylesheets to different environments (Dev/Test etc).
Is there a way I can edit the publish artefact so I can do a release pipeline for each environment?
So I would have a build pipeline that produces theused.css, dev.css,
test.css
I would have a release pipeline for Dev & Test
The dev pipeline would edit the artefact by deleting theused.css then rename
dev.css to theused.css .. likewise for test
Or is there a better way to do this?
If I would want to rename a file I would probably write a bash/powershell script and execute it as a task in the pipeline.
Bash task
Power Shell Task
Specifically in your case I would copy/rename the dev.css/test.css to theused.css during the deployment step.
I do not know how you deploy but you could either rename the .css before the deployment to an S3 bucket for example or if you deploy on an on premise server copy the file and rename it at the same time.
cp /your/dev.css /your/deployed/path/to/theused.css #copying the file
mv /your/dev.css /your/deployed/path/to/theused.css #move/renaming the file
Meant to add this...
What I ended up doing was the following (with different configs, rather than css, but same idea):
In my app I have configs for Dev, Test & Prod (config.json, config-test.json, config-prod.json)
The first thing the app does is load the config when it runs
I build and deploy to dev
The build folder contains the build files including these config files
I have releases for Test and Prod that do the following:
Task 1: delete the config.json
Task 2: copy the appropriate config file, e.g. config-test in the test release pipeline, and rename it config.json
Task 3: deploy build files to the appropriate environment with the new config
So, i have a docker-compose file that has a build command in each service. In development, docker-compose up works ok. In test enviroment, i want to docker-compose pull and docker-compose build the images, and it works ok, except it needs the folder in build command created in testing server.
Is it really necesary or is there a way to pull and up the containers without create the build folders in the testing server?
There is docker-compose up --no-build
I've put a Dockerfile in the root directory of my project. I know the Dockerfile works because I've built it locally. But when I try to build it in the pipeline, it says Dockerfile not found in project and aborts.
The documentation indicates that it should work so long as the Dockerfile is in the root directory. So I'm really confused.
do I need to supply some additional information in the build job to point it do the Dockerfile?
Thanks.
Sails.js 0.10x: I added an new file "staging.js" to the config/env folder.
Starting the server with >sails lift --staging shows that the staging file was used.
But it still uses the development grunt tasks. e.g. no minification, dev blueprint settings, etc.
I was wondering if there is an easy way to run the the prod grunt tasks with a new environment like staging?
In the sails node module of your application, you can navigate to the Grunt lib file (app_base/node_modules/sails/lib/hooks/grunt/index.js). If you look at the code there, under the initialize method, there's a condition to check if the environment is the production environment and calls the production Grunt task. Even though you could edit this condition to include your staging environment, this file isn't meant to be altered - updating the module in the future would erase any changes you make.
The best thing to do would be to go to app_base/tasks/register/prod.js and move your staging environment tasks to be run at prod and just use the prod environment. Alternatively, you could copy the production tasks over to your staging environment tasks.