mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
commit
b3e869da31
7 changed files with 50 additions and 1 deletions
5
.dockerignore
Normal file
5
.dockerignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
tmp
|
||||
log
|
||||
.vagrant
|
||||
.git
|
||||
coverage
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,3 +16,4 @@
|
|||
/tmp
|
||||
config/morph.yml
|
||||
/coverage
|
||||
.vagrant
|
||||
|
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
|||
FROM ruby:2.2
|
||||
RUN apt-get update && apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs nodejs-legacy
|
||||
|
||||
RUN mkdir -p /app
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY Gemfile Gemfile
|
||||
COPY Gemfile.lock Gemfile.lock
|
||||
RUN bundle install
|
||||
|
||||
ADD . /app
|
||||
WORKDIR /app
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["rails", "server", "-b", "0.0.0.0"]
|
|
@ -8,7 +8,13 @@
|
|||
1. Start Rails server: `bundle exec rails s`
|
||||
1. Visit [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
TODOs: https://github.com/ahx/stadtratmonitor/issues
|
||||
### Using docker
|
||||
|
||||
1. Install docker and docker-compose: https://docs.docker.com/compose/install/
|
||||
1. Start the app: `docker-compose up`
|
||||
1. TODO db:migrate, import data, setup index
|
||||
1. Get the address of the docker host: `docker-machine ip default`
|
||||
1. Point your browser to: 'http://<IP of docker host>:3000'
|
||||
|
||||
## Adding a data source (web scraper)
|
||||
Example scraper: https://morph.io/ahx/city_council_leipzig_recent_papers
|
||||
|
|
4
config/initializers/elasticsearch_config.rb
Normal file
4
config/initializers/elasticsearch_config.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
config = {
|
||||
host: ENV.fetch('ELASTICSEARCH_URL', 'http://localhost:9200')
|
||||
}
|
||||
Elasticsearch::Model.client = Elasticsearch::Client.new(config)
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
web:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/app
|
||||
ports:
|
||||
- "3000:3000"
|
||||
links:
|
||||
- elasticsearch
|
||||
environment:
|
||||
ELASTICSEARCH_URL: 'http://elasticsearch:9200'
|
||||
elasticsearch:
|
||||
image: elasticsearch:1.7
|
6
lib/tasks/index.rake
Normal file
6
lib/tasks/index.rake
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace :index do
|
||||
desc 'Rebuild elasticsearch index for Paper model'
|
||||
task rebuild: :environment do
|
||||
Paper.reset_index!
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue