Skip to content

Instantly share code, notes, and snippets.

View mleszcz's full-sized avatar

Mateusz Leszczyński mleszcz

View GitHub Profile
### Keybase proof
I hereby claim:
* I am mleszcz on github.
* I am mleszcz (https://keybase.io/mleszcz) on keybase.
* I have a public key ASCZE_hZlnjIFOuQHvjMzpp63fLHg3UmfX97F1A7g8H0_Ao
To claim this, I am signing this object:
set :capose_file, ["docker-compose.yml"]
set :capose_commands, ["run --rm app bundle install", "up -d"]
version: '3'
services:
db:
image: postgres
volumes:
- postgres-data:/var/lib/postgresql/data
app: &app
build: .
image: some-app
command: bundle exec rails s -p 3000 -b '0.0.0.0'
#
# Test the app before deployment
#
desc "Check if the application is releasable => run tests"
before :deploy, :test_app do
unless system("bundle install") &&
system("bundle exec rake db:drop db:create db:migrate db:seed") &&
system("bundle exec rake")
puts "===> FIX SPECS AND RETRY <==="
exit
@mleszcz
mleszcz / auto-deploying.md
Created June 4, 2018 14:15 — forked from nickbclifford/auto-deploying.md
How to automatically deploy code to a server using Travis CI

Auto-Deploying via Travis CI

Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:

  • Set up SSH keys
  • Add the server's copy of the repository as a Git remote
  • Push to the remote
  • SSH into the server and execute any installation/compilation/miscellaneous commands

Before even touching .travis.yml...

Users

# higher level
class Copy
def self.call(reader, writer)
writer.call(reader.call)
end
end
# lower level
Copy.call(WriteToSSD, ReadFromSSD)
# higher level
class Copy
def self.call(reader, writer)
writer.call(reader.call)
end
end
# lower level
Copy.call(WriteToHDD, ReadFromHDD)
# higher level
class Copy
def self.call
WriteToSSD.call(ReadFromSSD.call)
end
end
# lower level
Copy.call
# higher level
class Copy
def self.call
WriteToHDD.call(ReadFromHDD.call)
end
end
# lower level
Copy.call
shapes = [ Rectangle.new, Square.new ]
shapes.each { |shape| shape.set_width(100) }