aws code deploy: No such file or directory - appspec.yml - ruby-on-rails

When trying to deploy my rails app through code deploy I get the following error message:
No such file or directory - /opt/codedeploy-agent/deployment-root/b3ff73b4-aa93-4e49-99e4-c26cdcf7a6f0/d-06LE313R9/deployment-archive/appspec.yml
on a "BeforeInstall" error.
I have appspec.yml in my rails app root directory (e.g it is myapp/appspec.yml), and have no idea how to put the appspec file into the deployment-archive directory.

The appspec.yml file should be at the root of the archive you upload to S3 or the GitHub repo you are deploying with. Try moving your appspec up one directory.
\
|-- appspec.yml
`-- myapp
`--- (the rest of your rails app source tree)
Note that the appspec mostly uses paths relative to the archive root, so you might have to adjust them if you move your appspec.
Alternatively, you can create your bundle from inside your myapp directory so that the appspec.yml is still in the root directory of your archive.

Related

Fastlane no such file or directory for files that exist

I'm trying to setup fastlane to use some files for values in my Deliverfile. These files are in a directory under ProjectRoot/fastlane/shared_metadata/
So, in my Deliverfile I'm using: release_notes File.read("./shared_metadata/release_notes.txt") and when I run my lane it fails telling me
No such file or directory # rb_sysopen - ./shared_metadata/release_notes.txt
However, in my lane, if I run the same command, releaseNotes = File.read("./shared_metadata/release_notes.txt") the var releaseNotes contains my file's contents as normal.
I've checked pwd multiple times and it is ProjectRoot/fastlane/ so I can't figure out why fastlane does not see the files.
Fastlane keeps returning no such file or directory, even for files in the /fastlane/ directory. What is causing this behaviour, and how can I fix it?

Include non-electron folder as part of the NSIS installation

I've been trying to add additional functionality to the electron installer, where I copy some files that are packaged inside the installer, but I receive a non-descriptive error when I try to compile my electron project to create the installer i.e. I get:
* writing effective config
* packaging
* building
x [object Object]
Here is what my script looks like:
!macro customInstall
Rename "$APPDATA\myfolder\img" "$APPDATA\myfolder\img-old"
SetOutPath "$APPDATA\myfolder"
File /nonfatal /a /r "additional_files\*"
CreateShortcut "$SMSTARTUP\mylink.lnk" "$INSTDIR\mylink.exe"
!macroend
Basically everything works except the file copy part. When I remove that part the project builds and compiles into an installer with no problems.
I've also tried to use CopyFiles instead of SetOutPath and File and it works as expected when I place the additional_files folder into the same folder as the installation (dist folder), but I want the folder to be packaged inside the installer. However, I cannot get the additional_files to be packaged with the installation.
I believe it's a location issue, that is, that the NSIS script cannot locate the additional_files/ folder. I've tried modifying the package.json file by adding to the files section the additional_files/ folder and placing it in the root of the project.
I've even tried placing it in the build folder where my installer.nsh script resides, but with no luck.
File looks for files relative to the directory where the .nsi is by default. /NOCD can be used to prevent that but I'm not sure if electron uses that switch.
!cd can be used inside a script to change the directory but I'm not sure if that is going to help you much in this case unless you are willing to use a absolute path and in that case you could just use the absolute path with the File instruction instead.
If you only know where your .nsh file is I suppose you could try File /r "${__FILEDIR__}\additional_files\*"
if you are using electron-builder you have two options inside the settings
extraResources this will copy files into the $INST_DIR/resources folder in your app (this is where the app.asar file is too), and you can access via process.resourcesPath, ex:
extraResources: [
{ from: './dist/ThirdPartyNotices.txt', to: 'ThirdPartyNotices.txt' },
]
extraFiles this would do the same but place the files into the $INST_DIR root folder of your installation ex:
extraFiles: [
{ from: './distrib/mytool.exe', to: 'mytool.exe' },
],
to get the root folder you can use something like remote.app.getAppPath().replace('resources\\app.asar', '').replace('resources/app.asar', '');
all info on: https://www.electron.build/configuration/configuration#overridable-per-platform-options

docker-compose project root reference

I have a docker-compose.yml file at the root of my project, and within that project there are several modules in sub-directories.
I find that I can issue docker-compose commands from anywhere within the project root and these work, compose seems to search backwards until it finds the docker-compose file. This is useful.
However, it does not locate the .env file in the project root, it seems to want to find the file in the current folder so docker-compose up commands don't work and I imagine volume mounts that reference folders relative to the docker-compose file may not work either.
How can I change my docker-compose file to such that these references refer to the a location relative to the docker-compose.yml file itself?

how can i use .env file from my root directory?

I am working in a MERN project. I've a .env file in my root directory. I want to use some keys from that file on react app. can I use that .env file or should I make a new .env file?
here is the library "dotenv" that makes it,
also have wrap for webpack "dotenv-webpack"
https://www.npmjs.com/package/dotenv

Ignoring directories, sub-directories and files after that those was initialized

I am using Ruby on Rails, the Capistrano gem and git. Long time ago I initialized git and in the .gitignore file I stated the following:
.bundle
db/*.sqlite3
log/*.log
tmp/
One day I created a sub-directory in the /public directory of my RoR application: /public/users/.... Now in the latter directory I have the following file system structure:
/public/users/001/file1.png
/public/users/001/file2.png
/public/users/001/file3.png
...
/public/users/002/file1.png
/public/users/002/file2.png
/public/users/002/file3.png
...
...
At this time git is tracking all file in the /public directory including all directories and files inside /public/users/. So, when I deploy with Capistrano, all those will be updated on the remote machine, as well.
What I would like to do is to do not track anymore public/users directories, subdirectories and files (on my local machine) so that on the remote machine those will be not updated. That is, I would like to make possible that when I deploy with Capistrano all that is related to the public/users (on the remote machine) is untouched.
How can I do that?
P.S.: I read a lot of other questions and answers (eg: 1, 2, ...) but all them seem do not work for me.
I am almost sure that I must add the following text line to the .gitignore file:
# Ignoring "public/users/" directories, sub-directories and files
public/users/
and then (if the above code is valid) what I should do?
Try to put all user related files into one folder , say system then
You can put public/system/*.* in git ignore..
then your dir structure would be :
public
->404.html
->js.../..,..,..
->css ../..,..,..
->system
->users
->1/something
->2/something
->some-other-user-related-info
Also why is there a need to put development related files into git and then to server ?? No point .. so do not do it.. It will increase your repo size for no reason.
Since you are using capistrano your server dir structure will look like this :
APP
->Current
->releases
->shared
your public/system folder will keep pointing to shared/system
case 1: files in users/ not committed
put all the user related file in .gitignore
case 2: if files have been commited
perform a git delete and then commit
then add it to .git ignore

Resources