How to link folder / GitHub repository to Heroku? - github

I am hosting a Discord bot on Heroku so it stay live 24/7. I have the code local on my computer and update the code by running the below code. My only question is how can I access the code on another computer to work away from home.
git add .
git commit -am "making it better"
git push Heroku master

There isn't a way to "make the folder a GitHub link". Heroku builds your application and its runtime into a slug and this slug is what runs on your dynos. There is no way to update the code you're running without building a new slug.
However, you can deploy directly from GitHub, either manually or automatically when new commits are added to a branch. I strongly recommend having a good test suite in either case, but this is especially important if you want to do automatic deployments.

Related

How to manage Django Project and its modules with git?

I've been looking for a solution how to manage my project with git for quite some time now. I want to have one instance as the main repo for connecting the entire project. Each app should be its own git instance.
During my search I found both git submodule and git subtree. For both tools I found an instruction how to insert an existing reppo. However, I am interested in how to proceed from the beginning. I mean here from the command $ django-admin startproject myproject Where do I enter the git init? When I create a new app
$ django-admin startapp new-app and how do I use this as subtree/submodule?
Until now I have always found instructions that refer to a remote repo. Is this always necessary? I am not sure if I want to publish every Django app on Github. But I want a version control system just for me. Is this possible?
I have to say that so far it has been enough to manage my "projects" locally. Now I want to work together with others and I don't want to install the whole Django Project locally but only provide me with single functions or modules.
It would be a great help if you could explain to me how that works.
TL;DR
How to manage (start and expand) a Django Project with git. The apps should be their own git repos.
The purpose of submodules is to allow you to graft an existing repo/library into your git. Rarely do you want to do this. Instead you want to use PIP tools to install your libraries as part of library management.
This is essentially a git question. If you don't have a remote repository, you can still use git. With that said, the reason you want a remote repository is so that you can collaborate with others, and have a stored version of the code separate from your workstation.
There are services that let you have private repos even without a paid account. Bitbucket is the most well known of these services and is comparable to Github in most ways.

How to integrate LazyBones with VCS?

I just learned about LazyBones and absolutely love it! The problem is that it generates a "code skeleton" for you before your app's VCS repo exists. And I see there is some integration capability with Git, but what about other VCSes?
Specifically, I'm using Mercurial. So ordinarily, I'd create the hg repo for my new app (on the server), clone it out locally, and some code to the cloned working copy, commit & push it.
So I ask: what is the proper workflow (or set of commands) to create a new app from a LazyBones template and integrate it with a new hg repo?
I suppose, slightly more elegant way may be:
Generate skeleton by LazyBones in SomeDir
Init Mercurial repo after it in SomeDir
Add needed files from working directory into (empty) repository
Create remote repo on server
Add remote repository URL into [path] section of local repo's .hgrc (maybe also auth. credential into [auth])
Push

github - attempting to push/pull/update (not sure of the terminology) updated code from github to remote server via terminal/ssh mac os

So I have my local computer - where I've updated my (html/js/css) code, github (where I've pushed the updated code already by doing a git add + git commit + git push origin master) and then the server of the actual website which the code is for.
I've connected to the server via the command line terminal. I've already previously cloned the code to the server (by running the command git clone [REPO URL]) while logged in to the server via SSH, so the (un-updated-)files are there.
But now that I've updated the code, and pushed that update to github, how do I now update or push the repo/code/updated-github-code to the server???
I'm currently looking at the terminal with
[~]#
^ showing. I tried to git clone [REPO URL] again, but then I get the msg:
fatal: destination path 'name of my file' already exists and is not an empty directory
Am I missing or overlooking a step? Well obviously I am but I could use some help please. Like I said I'm trying to update the code to the server so the actual website will reflect the changes I made to the code and so everything is in sync (local code, code pushed to github and hopefully/eventually the code on the server/website).
I am just learning this obviously, so go easy on me (I've spent almost the entire day learning to connect to the server via SSH in terminal)...
Also, feel free to correct my terminology...
Pull from github while ssh'd into the server using the link from the github repo "copy to clipboard" button on the web interface. If that doesn't work you could try wiping the repos folder on the server and cloning from scratch. But use that option with caution if downtime is unacceptable for this particular web app.

git hub and coding processes

Ive been programming for a little while now and have built a little application which is now hosted on a dedicated server.
Now i have been rolling out different versions of my app with no real understanding on how to manage the process properly.
Is this the proper way to manage a build of an application when using a product like git hub ?
Upload my entire application onto github.
Each time i work on it, download it and install it on my dev server.
When im done working on it and it appears to be ok, do i then upload the changed files with the current project i am working on or am i meant to update the entire lot or am i mean to create a new version of the project?
once all my changes are updated, is there anyway of pushing these to a production machine from git hub or generating a listing of the newly changed files so i can update production machine easily with a checklist of some kind ?
My application has about 900 files associated with it and is stored in various folder structures and is a server based app (coldfusion to be precise) and as i work alone majority of the time, im struggling to understand how to manage the development of an app...
I also have no idea on using the command line and my desktop machine is a mac, with a VM running all my required server apps (windows server 2012, MSSQL 2012 etc)
I really want to make sure i can keep my dev process in order, but ive struggled with how to understand how to manage a server side apps development when im using a mac my dev machine is a windows machine i feel like im stuck in the middle.
You make it sound more complicated than it is.
Upload my entire application onto github.
Well, this is actually 2 steps: First, create a local git repo (git init), then push your repo up to github.
Each time i work on it, download it and install it on my dev server.
Well, you only need to "download" it once to a new dev box. After that, just git pull (or git fetch depending on workflow), which ensures any changes on the server are pulled down. Just the deltas are sent.
Git is a distributed version control system. That means every git repo has the full history of the entire project. So only deltas need to be sent. (This really helps when multiple people are hacking on a project).
When im done working on it and it appears to be ok, do i then upload the changed files with the current project i am working on or am i meant to update the entire lot or am i mean to create a new version of the project?
Hmm, you are using fuzzy terminology here. When you are done editing, you first commit locally (git add ...; git commit), then you push the changes to github (git push). Only the deltas are sent. Every commit is "a new version" if you squint.
Later on, if you want to think in terms of "software releases" (i.e. releasing "version 1.1" after many commits), you can use git tags. But don't worry about that right away.
once all my changes are updated, is there anyway of pushing these to a production machine from git hub or
generating a listing of the newly changed files so i can update production machine easily with a checklist of some kind ?
Never manually mess around with files manually on your server. The server should ONLY be allowed to run a valid, checked-out version of your software. If your production server is running random bits of code, nobody will be able to reproduce problems because they aren't in the version control system.
The super-simple way to deploy is to do a git clone on your server (one time), then git pull to update the code. So you push a change to github, then pull the change from your server.
More advanced, you will want something like capistrano that will manage the checkouts for you, and break up "checking out" from "deploying" to allow for easier rollback, etc. There may be windows-specific ways of doing that too. (Sorry, I'm a Linux guy.)

Pushing to bitbucket and deploying to heroku

I have Play! application in Bitbucket. I have my local repo linked to both Bitbucket and Heroku and everything works fine (whenever I push to heroku master, the application re-builds and I can see the changes online). Now, I want only to push to bitbucket and deploy to Heroku, i.e. I want to push to Bitbucket, and my Heroku app to pick the changes from Bitbucket and rebuilds the app. The reason I want this is because Bitbucket now offers online code editing and I do not always have Git or Heroku Toolbelt installed in the systems I work. It will also be nice to manage a single repo.
I know that Heroku maintains it's own git system and from Heroku's Settings tab, I can see following info -
Region: United States
Stack: Cedar
Framework: Play 2.x - Scala
Git URL: git#heroku.com:xyz-abc.git
Repo size: 139 MB
Slug size: 117 MB of 200 MB
Also, I have changed the GitHub Repo settings in Heroku to git#bitbucket.org:user-xyz/xyz-abc.git. I have found this and this SO issues and this Heroku documentation related to my requirement, but couldn't make it work. Is it even possible?
You could have used Bitbucket Services; unfortunately, there is none for Github. Maybe you could try to build one and submit to Bitbucket.
The Github Repo setting in Heroku simply displays the commit diffs in the activity log - there's a note to that effect just in the Github repo text
Link your app to a GitHub repository to see commit diffs in the activity log.
It doesn't provide any other functionality at present.
I'm not familiar with Play myself, but with Rails and the add Codeship.io (and others I imagine) you can do continuous deployment where you push to github/bitbucket and that then uses a webhook to trigger codeship to pick up your code, test it and then deploy it to Heroku. I'm sure there are Play hosted testing services out there which may help.