In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
I have three questions:
Can anyone confirm if the recipe there works?
Where and how do I put that recipe?
I have two folders need to stay across each revisions: /products and /public/images/site_images what recipe should I run to be able to achieve this?
I have near zero experience with Capistrano and all I have been able to do so far was just cap deploy and cap deploy:cold, so a script which I could just copy-paste would be greatly appreciated.
Thank you
Yes, I'm currently using it in my own projects.
You can just append the code at the end of your deploy.rb file
If products is outside the public folder, you can't link it from the public side. Also, public/images is already expected to be checked into your SCM repository
The recipe assumes you want to have a complete new folder available from public side to host the user uploaded documents.
The folder should be excluded from your SCM configuration to prevent accidental commits. You should avoid to use the public/images folder for external uploaded files or you will have many headaches trying to synchronize your development configuration, managed by a SCM, with the public state.
This is how I did it in the end, by manual approach
I hope this will help all the early coders out there:
1. cd to releases to find out folder to synchronize
cd /home/yourapp/rails_apps/main/releases/
2. find the folder to sync, one level above last folder shown with ls
REMEMBER!
With ls, the folder list goes as follows:
folder1 folder5
folder2 folder6
folder3 folder7
folder4 folder8
So in this case, copy from folder7
3. copy the folders
To copy images
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/public/images/ /home/yourapp/rails_apps/main/current/public/images/
To copy products
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/products/ /home/yourapp/rails_apps/main/current/products/
Wondering if they could be automated somehow?
Related
I recently had a low disc space issue in jenkins. Although the home directory has sufficient space, the /tmp did not and it brought my master down.
I tried many ways to fix this
Discard old build and deleting old workspaces
Restarting jenkins
Tried to setup a node with same config and starting it, but that failed saying i dont have sufficient permission for copying remote.jar
Since my server is debian, I could not find any file where I could set set -Djava.io.tmpdir
Many people talked about jenkin file or config file, but I could not find it.
The only thing that worked was https://updates.jenkins-ci.org/download/plugins/tmpcleaner/ , this plugin hpi, which I installed through Advanced tag in plugins.
Also, I went manually to the /tmp folder in root and then deleted it contents to start the jenkins again. So my question is:
How do i change the /tmp folder in jenkins?
The jenkins home directory is /mnt/data/jenkins, however the tmp it uses it root/tmp. Why is it so? The /mnt/data/jenkins has lots of free space and i manually created a /tmp folder there, but it only takes the /tmp from the root
My colleague found the answer out
open '/etc/defaults/jenkins' file using command 'less /etc/defaults/jenkins'
Add argument
JAVA_ARGS="$JAVA_ARGS -Djava.io.tmpdir=yourNewtempLocation"
Once you restart jenkins, you will be able to see the storage of the new space
We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.
I already found:
https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management
https://github.com/microsoft/vscode-dev-containers
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&ssr=false#qna
https://github.com/gantsign/ansible-role-visual-studio-code-extensions
https://code.visualstudio.com/docs/remote/containers
https://github.com/gantsign/ansible-role-visual-studio-code
But non of these provides a good solution to me
We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).
I imagine like having a script like
.... projectname up
or
.... projectname reset
(or
.... projectname down)
to receive/reset the configured settings and newest plugins that have been configured for the project.
Have any ideas or use a similar solution already?
After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!
Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.
Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:
Win: ~\AppData\Roaming\Code\User
Mac: ~/Library/Application Support/Code/User/
Linux: ~/.config/Code/User
You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.
FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.
If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.
When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.
For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.
I don't understand what is the need/use of the git unpack-objects command.
If I have a pack file outside of my repository and run the git unpack-objects on it the pack file will be "decompressed" and all the object files will be placed in .git/objects. But what is the need for this? If I just place the pack and index files in .git/objects I can still see all the commits and have a functional repo and have less space occupied by my .git since the pack file is compact.
So why would anyone need to run this command?
Pack file uses the format that is used with normal transfer over the network. So, I can think of two main reasons to use the manual command instead of network:
having a similar update workflow in an environment without network configuration between the machines or where that cannot be used for other reasons
debugging/inspecting the contents of the transfer
For 1), you could just use a disk or any kind of mobile media for your files. It could be encrypted, for instance.
As the title says (and as it may be visible that I am still a beginner). In my rails app, I have implemented an MVC for support pages to my app.
I wanted to show the pages that I created to my mentor, so I committed and pushed to GitHub, but I noticed that only the images were pushed to GitHub! (I use CKeditor to handle images).
Now I am sure that the pages (that consists of a Title and Contents fields) exist, because when I execute the command db.support_pages.find() in the Mongo Shell, it gives me back a list of the pages with their contents and titles. But when I open those pages (localhost) and edit the content I see that git is not even tracking them!
I don't know what more information I should post, I will post the .gitignore file:
*.rbc
*.sassc
*~
.sass-cache
.project
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/public/assets/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
/spec/coverage/*
**.orig
rerun.txt
pickle-email-*.html
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
.idea
/attic/*
Any tips, leads, advice (or even queries to post more info regarding this issue) are welcomed. :)
Thanks in advance.
Your MongoDB database is composed of multiple data files containing the data and indexes.
If you want to commit the contents of the database to version control you will want to export the data and index definitions using mongodump.
If you want to share your database with your mentor, I would suggest using mongodump to get a full copy of the database, then compress and add that dump into git.
For example (on Linux) .. assuming a database called mydatabase:
cd ~/backup
mongodump -d mydatabase
tar -czvf mydatabase.tgz dump/
git add mydatabase.tgz
Your mentor would need to have MongoDB installed, and could extract the tgz file (tar xzvf mydatabase.tgz) and use mongorestore to load the data. I expect your application might require future configuration, which you would document in a README.
Git will track changes made in its directory. The pages you're talking about are stored in the database which is located somewhere else in your computer. We will need more information to give you some advice as to where you should dig.
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