Fix Docker setup

This commit fixes the Docker setup and also the CI build.

Also the contributing guide is updated with the new information related
to Docker. The CONTRIBUTING.md file is used to comply with GitHub
guidelines to help other developers to contribute.
This commit is contained in:
Matteo Giaccone 2018-12-06 20:20:01 +01:00
parent 7884dd9807
commit a15a7d8a95
6 changed files with 38 additions and 89 deletions

29
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,29 @@
# Contributing
All contributions are welcome.
There are different ways in which you can contribute to Tracks.
## Documentation
You can contribute documentation in the [wiki](https://github.com/TracksApp/tracks/wiki).
For example:
- tutorials on installing Tracks in various environments
- tutorials on using Tracks (user manual)
## Issues
If you think having found a problem with Tracks, first search in the [existing issues]((https://github.com/TracksApp/tracks/issues). If you cannot find it, open a new issue and try providing information on your setup and what steps are needed to reproduce the problem.
## Enhancements
It would be great to first discuss them on the [mailing list](https://groups.google.com/group/TracksApp) so you can figure out if it could be merged or not. You may use the wiki too to describe your change if it is too big for an email.
If you want to contribute an enhancement or a fix, you can:
1. [fork the project](https://help.github.com/articles/fork-a-repo)
1. [create a topic branch](http://learn.github.com/p/branching.html).
1. setup the project with [docker-compose](https://docs.docker.com/compose/) by running `docker-compose up`
1. then run `./bin/setup` to setup the first run
1. if you need, you can launch a Rails console with `./bin/rails c` (will run inside Docker)
1. make your changes and adds/updates relevant tests.
1. run the test suite with `./bin/rake test` (will run inside Docker)
1. commit the changes
1. send a pull request.

View file

@ -11,4 +11,6 @@ RUN mkdir /app/log
COPY . /app/ COPY . /app/
RUN cp /app/config/site.yml.tmpl /app/config/site.yml
EXPOSE 3000 EXPOSE 3000

View file

@ -1,41 +0,0 @@
FROM phusion/passenger-ruby22:0.9.18
WORKDIR /home/app/tracks
# Install gems
COPY Gemfile Gemfile.lock ./
RUN bundle install --without development test mysql therubyracer --jobs=3
# Install and configure the app
ENV RAILS_ENV=production
ENV DATABASE_URL=sqlite3:/var/tracks/database.sqlite3
RUN mkdir /var/tracks && chmod 777 /var/tracks
RUN touch /var/tracks/database.sqlite3 && chown app.app /var/tracks/database.sqlite3
COPY . ./
COPY config/site.yml.tmpl /etc/tracks/config/site.yml
RUN ln -sf /etc/tracks/config/site.yml config/site.yml
RUN bundle exec rake assets:precompile
RUN chown -R app.app .
# Configure nginx
RUN echo "env DATABASE_URL;" > /etc/nginx/main.d/env.conf
RUN echo "\
server {\n\
listen 80 default_server;\n\
server_name _;\n\
root /home/app/tracks/public;\n\
passenger_enabled on;\n\
passenger_user app;\n\
passenger_ruby /usr/bin/ruby2.2;\n\
}" > /etc/nginx/sites-enabled/tracks.conf
RUN rm /etc/nginx/sites-enabled/default
RUN rm -f /etc/service/nginx/down
# Migrate the database on startup
RUN echo "#!/bin/sh\nbundle exec rake db:migrate" > /etc/my_init.d/90_tracks.sh
RUN chmod +x /etc/my_init.d/90_tracks.sh
VOLUME ["/etc/tracks", "/var/tracks"]
# Default command for baseimage-docker
CMD ["/sbin/my_init"]

View file

@ -1,43 +0,0 @@
1. Resources
Tracks is using
* GitHub to host the git repository, manage git pull requests, and manage bugs and enhancement requests.
* the mailing list to discuss features and development and interact with users
See README for links to the respective sites
Also see the Development pages on the wiki for details on installing, testing,
upgrading, etc.
2. Dependencies
The dependencies for Tracks are maintained using bundler. Before starting your
tracks instance, you'll need to run 'bundle install' to fetch all the
dependencies
3. Testing
There are some pointers for setting up your Tracks copy for testing at
https://github.com/TracksApp/tracks/wiki/Testing/
By default, tests are configured to run using sqlite3 in memory mode to
increase speed. You will need the sqlite3-ruby gem for this.
To avoid showing the migrations as tests are run, add the following to your
database.yml below 'database: ":memory:"':
verbosity: quiet
If you want to run tests using another database, that's fine, too. Just change
your database.yml accordingly.
Running cucumber/selenium tests in :memory mode does not seem to work.
The rspec tests are not actively maintained.
See the wiki for more information on testing:
https://github.com/TracksApp/tracks/wiki/Testing
4. Contributing
See https://github.com/TracksApp/tracks/wiki/How-to-contribute

View file

@ -3,17 +3,18 @@ services:
db: db:
image: mysql:5.7 image: mysql:5.7
environment: environment:
MYSQL_ALLOW_EMPTY_PASSWORD: '1' MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
volumes: volumes:
- "db-data:/var/lib/mysql" - db-data:/var/lib/mysql
web: web:
build: . build: .
command: rails s
volumes: volumes:
- "${VOLUME:-.:/app/workdir}" - ${VOLUME:-.:/app}
ports: ports:
- "3000:3000" - 3000:3000
depends_on: depends_on:
- db - db
volumes: volumes:
db-data: db-data:

View file

@ -16,6 +16,7 @@ function die() {
trap cleanup EXIT trap cleanup EXIT
export RAILS_ENV=test export RAILS_ENV=test
export TRACKS_DB=tracks_test
# Put a config/site.yml file in place since it's needed for operation # Put a config/site.yml file in place since it's needed for operation
cp config/site.yml.tmpl config/site.yml cp config/site.yml.tmpl config/site.yml