AWS Code deploy without appspec.yml - puppet

We are successfully using code deploy for deployment , however we have a request from client to separate deployment script repository and code repository , right now code repository contains the appspec.yml and other script which need to be run and available to coders too.
I tried searching google and stackoverflow but found nothing :( .
Do we need to make use of other tool like chef,puppet etc ? however client want to be solution using aws only.
Kindly help.

I've accomplished this by adding extra step to my build process.
During the build, my CI tool checks out second repository which contains deployment related scripts and appspec.yml file. After that we zip up the code + scripts and ship it to CodeDeploy.
Don't forget that appspec.yml has to be in root directory.
I hope it helps.

Related

Bug in Azure devops pipeline/VS templates/dockerfile?

Trying to deploy a multi-project app to azure using pipelines. After trying various combinations (pipeline log is showing about 75/80 runs in the last couple of days), it looks like the problem is with the Dockerfile by Visual Studio 2019 or with the Azure Pipeline somewhere.
Here's what I've narrowed it down to:
Project A-
create a vs asp.net core webapp project, say test1sp,
select the checkbox which says create solution and project in the same folder,
select docker support (I selected Linux) or add it later
no code added, the boilerplate code runs fine as-is
add it to GitHub
create a project/pipeline in azure, source Github, I use the classic editor without YAML
create a docker build/push task and setup, I choose the most basic options, subscriptions, etc.
build works great, I also added a deploy to app service task and it deploys to the app service
Project B - my project is called demo8
Same as project A, except for step #2 - do NOT select create solution and project in the same folder. Follow the rest of the steps and now you should get this error.
Step 7/17 : COPY ["demo8/demo8.csproj", "demo8/"]
...
...
##[error]COPY failed: file not found in build context or excluded by .dockerignore: stat demo8/demo8.csproj: file does not exist
It works fine on localhost/docker. So, I'm guessing maybe vs2019 uses some more tolerant implementation to patch it over. Or, there's a problem with azure's implementation or something else?
I am relatively new to Dockerfile editing and see lots of detailed/complex scenarios, hopefully, someone can shed some light on how to get it working?
Here's a screenshot of the project files/structure:
UPDATE -
Moving the Dockerfile to the solution folder in project B makes it work in azure BUT
then it does NOT work in Visual Studio, no debugging, etc.
make a copy of Dockerfile in project & parent folders ( + keep in sync )
BUT if your solution has multiple projects like mine then
you have to name the Dockerfile different to have unique names in the parent folder
and modify the pipelines to use respective file names
Posting it here in case it helps someone.
The code in the Dockerfile must have the relative path to the folder level that the Dockerfile is in.
Tow ways to solve the problem. One is the change the code in the Dockerfile, for the project B, you can change the COPY code like this:
COPY ["demo8.csproj", "demo8/"]
Another way is to move the Dockerfile to the path that matches your COPY code. But in this way, it may affect other codes in your Dockerfile.
And you'd better plan your projects in different folders and create the Dockerfile for each project in different folders.
I just ran into this problem with a default console app in VS2022. I fixed it by changin the "Build context" parameter in the ADO build pipeline's Docker "build and push" step from the default of ** to **/.. so that the working directory was the solution folder, which matches VS (AFAIK).
Similar to #Josh's answer above -- I explicitly set
buildContext: '$(Build.SourcesDirectory)'
in the Docker task in the Azure Pipelines YML file, and it worked like a charm.
Something for the Azure pipelines template maintainer(s) to look into perhaps?

IBM Cloud Code Engine: How can I deploy an app from GitLab source without CLI

I create a project and saved it in GitLab.
I tried to download the IBM Cloud CLI to my Windows 10 system and I failed, I try to do it Run as administrator as mention in the CLI docs.
Now, I want to deploy this code project without CLI from source code. I could not find any docs about it.
I read about Dockerfile I should insert into my project but I know nothing about it.
Please help me in 2 ways:
Deploy my project with source code (Gitlab connect to IBM Cloud Code Engine).
Deploy my project using CLI in the windows 10 system.
I just did the same thing as part 1 of your question yesterday. As a prerequisite, you will need a container registry to put things into, such as a free account on Docker Hub.
Start on the Code Engine console.
Choose Start with Source Code, and paste in your on Gitlab URL. (The default is a sample repo which may be useful, especially https://github.com/IBM/hello.
On the next page, you can accept most of the defaults but you will need to create a project. That's free, but it needs a credit card so you can use a Pay As You Go account.
You'll also need to Specify Build Details
Here you tell it about your source repo, and where your Dockerfile lives. If you don't have a Dockerfile, you can probably find a sample one for your chosen runtime (C#? Node.js? Java?), or you can try using the Cloud Native buildpack. The build pack will try and work out how to run your code by inspecting what files you have.
Finally, on the last page of the build details, you will need to tell it where your container registry lives. This is a repository used to store the built images. If you set up a personal account on docker hub, you can just enter the credentials.
Once you've done that, you can choose Done in the sidebar:
and then Create
You should get a page which shows your image is building
and then once the build is done, in the top right you'll get a link to take you to your app's web page:
If you get stuck, there's a good set of documentation.

Concurrently JS application pipeline install and build hangs (Express js for server, Create-React-App for Client)

Problem: I have a project with a server (Express Server that handles file uploading and deleting) and client (Front End Create-React-App). The project structure looks like follows:
Root Folder With Server
Client Folder
Each folder has it's own package.json. Server Package.json. Client package.json
I'm trying to build and deploy onto azure however the pipeline hangs on "npm install and build".
It seems like the build succeeds but this phase just hangs. Here is my server.js (the routes are not included) file and yaml file just in case.
I'd appreciate any kind of help. Thank you!
Troubleshooting suggestions:
In the case of ensuring that the code in github is consistent with the local code, if an exception occurs, it is recommended to replace the linux platform and redeploy.
It is recommended to use my suggestion to recreate the repository, and then check the Action status in github.
Sum up:
In general, it is more appropriate to use Linux in azure than windows. For example, Linux supports npx, and may also support other packages and commands.
When the local code can run normally, there is generally no problem when deploying to github, unless there may be modifications, which we have ignored. So make sure the code is consistent.
General correct deployment steps:
First in the portal, make sure to create a web app application (not a static web app), and select the node environment.
Make sure that the sever program can run normally locally. Create a new repository in github.
->git init
->git add.
->git commit -m'init'
->git remote add origin https://github.com/{your name}/newAppname.git
->git push -u origin master
Connect in the Portal's Deployment center.
Then check the status of Action in github.

One-click deployment solution for my Node.js application (with pm2)

So basically, I have Node.js application locally (WebStorm project) and constantly pushing changes to git. I would like to create one-click desployment solution executable from my WebStorm project what will:
Clone/Pull project from git
Install dependencies
Edit config (database connection, etc...)
Based on config make sure database is ready and if not initialize new one
I achieved parts 1 and 2 by using pm2 deployment function. If I run command, everything is updated from git and dependencies are installed.
Part 3 is problem, because I do not want to push production config into git (even it is private repo) and I have only example config in git repo. I was thinking about script what will copy example config and then prompt me somehow to edit it, but I am not sure now to achieve this without connecting manually into production server and second problem is I need to copy new example config every new version, because there might be changes in config structure between versions.
Any suggestions how to achieve this easily and without need to log into production server manually?
Part 4 is nice to have feature if anyone have suggestions how to achieve this, too.

Teamcity MsBuild generates wrong cspkg file

I am trying to build and Deploy our solution to Azure using TeamCity.
When I Build the azure solution (Web.Azure.ccproj) using TC, it always generates wrong file like Web.Azure.ccproj.cspkg in Release\app.publish folder. I am not understaing why it is generating a file like ccproj.cspkg. Rather it should have just generated Web.Azure.cspkg.
Note: when I try directly in command prompt (msbuild Web.Azure.ccproj /t:Publish) am able to see proper files generated.
Any reason why this is happening?
Thanks in Advance
I don't know why the generated files are different. However, if you are looking to deploy to Azure Cloud Services from TeamCity, maybe this link will help.
The linked post has a powershell script that will deploy the solution and you can include that as a build step in TeamCity. The script deals with having different Live and UAT environments etc, which you may not need.
For what it's worth, we're building the entire solution with a Visual Studio (.sln) runner and it builds the Azure projects fine.
Some of our parameters:
Targets: Rebuild
Configuration: Dev (Could be Stage or Release per our environments)
Command line parameters: /p:TargetProfile=Dev /P:Configuration=Dev
The last set of parameters are where I originally got stuck. We have profiles for Azure projects and configurations for the entire solution. We need both to get the right packages created.

Resources