Skip to content

Commit

Permalink
More changes to the docker setup for development
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Vincent committed Oct 30, 2017
1 parent ebac374 commit 264371b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 26 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -43,3 +43,16 @@ Please feel free to contact us directly at info@rekrei.org or through the [conta
## Contributing
Please read the [contributing guide](./CONTRIBUTING.md).

### Setting up the application
In the root of the application, run:
```bash
bin/setup
```

And then go to http://rekrei.dev and you should find the application running. Hack away and have fun!

You can run the specs with:

```
bin/test
```
3 changes: 3 additions & 0 deletions bin/purge
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker-compose-wrapper down --rmi all -v
59 changes: 36 additions & 23 deletions bin/setup
@@ -1,29 +1,42 @@
#!/usr/bin/env ruby
require 'pathname'
#!/usr/bin/env bash
set -e
export PATH="$(dirname "$0")/../bin:$PATH"
PURGE=0
BUILD_LOCAL=0

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
while getopts ":pl" opt; do
case $opt in
p)
PURGE=1
;;
l)
BUILD_LOCAL=1
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done

Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
if [ "$PURGE" -eq 1 ]; then
bin/purge
fi

puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"
if [ "$BUILD_LOCAL" -eq 0 ]; then
echo "== Pulling docker images =="
docker-compose-wrapper pull
else
echo "== Building docker images =="
docker-compose-wrapper -f docker-compose-build.yml build
fi

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end
echo "== Preparing database =="
docker-compose-wrapper run app bin/rake db:create db:setup db:seed

puts "\n== Preparing database =="
system "bin/rake db:setup"
echo "== Setting up Pow"
test -h ~/.pow/rekrei && rm ~/.pow/rekrei
echo "3000" > ~/.pow/rekrei

puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"

puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
end
echo "Web: http://rekrei.dev"
echo "Done."
3 changes: 3 additions & 0 deletions bin/stop
@@ -0,0 +1,3 @@
#!/bin/bash

docker-compose-wrapper down
4 changes: 1 addition & 3 deletions docker-compose.yml
Expand Up @@ -24,9 +24,7 @@ services:
# - '3737:80'
# - '3738:443'
app:
build:
context: .
dockerfile: ./Dockerfile
image: rekrei/rekrei:master
command: bundle exec puma -C config/puma.rb
volumes:
- .:/rekrei
Expand Down

0 comments on commit 264371b

Please sign in to comment.