git clone problem - ruby-on-rails

i have create clone of project on local machine with
git clone git#github.com:test/abc.git
Now i want to deploy my project on my ubuntu server .
so i have created a script which install git on my ubuntu server.
And now i want to deploy my rails project on server.
like git clone git#github.com:test/abc.git but i have not set ssh key on my server.
Is there any way i can create clone without set up ssh key on my server.
Is compulsotion that we have to create to ssh each on every server?
What if i have 20 server ? i need to set up ssh key for every server to clone?
Is there any way just ask the password than it will create a clone?
Or any other way?

You can use the read-only version. Next to the name of your repository you can select the http protocol. This url can be used without ssh key. If it is a private repository you'll need to add your username to the url.
$ git clone http://myname#github.com:test/abc.git
Initialized empty Git repository in /Users/myname/Projects/abc/.git/
password:
Then you type your password and a bit later you have your clone. A disadvantage is that you need to enter your password if you use a private repo.
Although I fail to see the problem of adding a few ssh-keys. If you really need to deploy to 20 servers you might consider thinking of using a packaging method with good OS support for automatic updating.

It is a mistake to try to use a configuration management tool in order to deploy an installation. Do you really intend to update the code from each of those 20 systems? Why then are you granting them write access to the code?
Create a tarball or use whatever package management systems are available in the language you are developing in (e.g. in Perl, you could use Dist::Zilla, Module::Install or ExtUtils::MakeMaker).

We created a php script which built RPMs (and Using Alien also built DEBs) for updating our 200+ machine fleet. As a url like "http://repo/fetch/rpm/" was called a script checked if there had been a new git tag inserted in package_name repository and if so use an RPM template we created on a per repo basis (typically put in .build/rpm.spec) to build the RPM, save it to a local cache directory and read the contents out as a file header.
I realize for your application that won't work since you're using GitHub - but it's just an idea for those who have their own remote repositories. A cron on the boxes would query once a day those URLs and run rpm -Uvh on the output.
For your instance it might be wise to tarball each release and either put that in a public accessible URL or create a script to rsync it to each server + exec

If you're deploying rails projects, you should check out Capistrano - http://www.capify.org/index.php/Getting_Started

Related

Can't run Rails app after "deploying" hidden file

I was trying to hide my credentials before pushing the repository publicly, as I should.
For that, I've used this resource, which worked perfectly on development mode.
For short, I've assigned global variables inside a ".api_keys.rb" file, called them on the appropriate file (devise.rb on this case) and added it to .gitignore.
Then I pushed it to GitHub. Later on, I needed to clone this one last commit. But then when I try running it, it responds with "cannot load such file -- /path/.api_keys.rb".
What am I missing? I can provide any more details if needed. Thank you.
Adding a file to .gitignore means that the file is removed from the repository and only exists locally because the file is ignored by git completely.
Because it is not stored in your git repository anymore it is not available to remote servers or other developers when pulling the repository from GitHub.
To fix this your need to remove the file from .gitignore and push it again when it still exists on your machine or you need to recreate it.
Btw the way to store, for example, API keys securely in Rails is to use encrypted files. I suggested reading in the [Rails Guides about Environmental Security and Custom Credentials].(https://edgeguides.rubyonrails.org/security.html#environmental-security)

How do I use this config.yml file to run a web scraper that someone else built?

My end goal: I want to fetch data from a retail site on an hourly schedule to see if a specific product is back in stock or not.
I tried using xpath in python to scrape the site myself, but I'm not too familiar, and why reinvent the wheel if someone built a scraper already? In this case, Diggernaut has a github repo.
https://github.com/Diggernaut/configs/tree/master/bananarepublic.gap.com
I'm using the above github repo to try and run a pre-existing web scraper on the banana republic retail site. All that's included in the folder is a config.yml file. I don't even know where to start to try and run it... I am not familiar with using .yml files at all, barely know my way around a terminal (I can do basic "ls" and "cd" and "brew install", otherwise, no idea).
Help! I have docker and git installed (not that I know how to use docker). I have a Mac version 10.13.6 (High Sierra).
I'm not sure why you're looking at using Docker for this, as the config.yml is designed for use on Diggernaut.com and not as part of a docker container deployment. In fact, there is no docker container for Diggernaut that exists as far as I can see.
On the main Github config page for Diggernaut they list the following instructions:
All configs can be used with Diggernaut service to retrieve products information.
You need to create free account at Diggernaut
Login to your account
Create a project with any name and description you want
Get into your new project by clicking it and create new digger with any name
Then you will see 3 options suggested to you, you need to use one where you will use meta-language
Config editor will open and you can simply copy and paste config code and click on save button.
Switch mode for digger from Debug to Active and then run your digger.
Wait for completion.
Download data.
Schedule your runs if required.

Same VSCode-Settings for the whole crew?

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.

Is git unpack-objects of any use?

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.

Preparing an Installation and Installing on client machine

As I have done my first project on Ruby on Rails.
I want to know what should I do to prepare installation from my machine the code i generated in a project and other thing is that what should I do to install that all on client machine the I prepare from my machine.
You should probably put your code in a repository - probably git via GitHub is best. If the setup is going to be different then perhaps gitignore the database.yml but include a .sample of it. Then to install on someone's machine just checkout the repo bundle install and run the relevant rake tasks (db:setup probably).
Updates can then be applied by pulling from the repo.
Other than that zip it up and unzip on there machine making sure to install everything required.

Resources