Skip to content

Commit

Permalink
Hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jan 2, 2024
0 parents commit 6640813
Show file tree
Hide file tree
Showing 132 changed files with 5,652 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: direct
- dependency-type: indirect
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on: [push]

jobs:
verify:
name: Build
runs-on: ubuntu-latest

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: awesome
POSTGRES_DB: awesome_test
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server

steps:
- uses: actions/checkout@v4
- name: Install dependent libraries
run: sudo apt-get install libpq-dev
- name: Set up Node
uses: actions/[email protected]
with:
node-version: 15
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Run tests
env:
RAILS_ENV: test
POSTGRES_DB: awesome_test
POSTGRES_USER: awesome
POSTGRES_PASSWORD: postgres
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
run: bundle exec rake db:create db:migrate test
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key

/data/

*.dump
.env
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.0
20 changes: 20 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cff-version: 1.2.0
title: 'Ecosyste.ms: Awesome'
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Andrew
family-names: Nesbitt
email: [email protected]
orcid: 'https://orcid.org/0009-0007-2710-1118'
repository-code: 'https://github.com/ecosyste-ms/awesome'
url: 'https://awesome.ecosyste.ms'
abstract: >-
An open API service indexing awesome lists of open source software.
keywords:
- open source
- package management
- software
license: AGPL-3.0
73 changes: 73 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Development

## Setup

First things first, you'll need to fork and clone the project to your local machine.

`git clone https://github.com/ecosyste-ms/awesome.git`

The project uses ruby on rails which have a number of system dependencies you'll need to install.

- [ruby 3.3.0](https://www.ruby-lang.org/en/documentation/installation/)
- [postgresql 14](https://www.postgresql.org/download/)
- [redis 6+](https://redis.io/download/)
- [node.js 16+](https://nodejs.org/en/download/)

Once you've got all of those installed, from the root directory of the project run the following commands:

```
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
rails server
```

You can then load up [http://localhost:3000](http://localhost:3000) to access the service.

### Docker

Alternatively you can use the existing docker configuration files to run the app in a container.

Run this command from the root directory of the project to start the service.

`docker-compose up --build`

You can then load up [http://localhost:3000](http://localhost:3000) to access the service.

For access the rails console use the following command:

`docker-compose exec app rails console`

Runing rake tasks in docker follows a similar pattern:

`docker-compose exec app rake projects:sync`

## Importing data

The default set of supported data sources are listed in [db/seeds.rb](db/seeds.rb) and can be automatically enabled with the following rake command:

`rake db:seed`

You can then start syncing data for each source with the following command, this may take a while:

`rake projects:sync`

## Tests

The applications tests can be found in [test](test) and use the testing framework [minitest](https://github.com/minitest/minitest).

You can run all the tests with:

`rails test`

## Rake tasks

The applications rake tasks can be found in [lib/tasks](lib/tasks).

You can list all of the available rake tasks with the following command:

`rake -T`

## Deployment

A container-based deployment is highly recommended, we use [dokku.com](https://dokku.com/).
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ruby:3.3.0-alpine

ENV APP_ROOT /usr/src/app
ENV DATABASE_PORT 5432
WORKDIR $APP_ROOT

# * Setup system
# * Install Ruby dependencies
RUN apk add --update \
build-base \
netcat-openbsd \
git \
nodejs \
postgresql-dev \
tzdata \
curl \
curl-dev \
libc6-compat \
musl-dev \
&& rm -rf /var/cache/apk/*

# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock $APP_ROOT/

RUN bundle config --global frozen 1 \
&& bundle config set without 'test' \
&& bundle install --jobs 2

# ========================================================
# Application layer

# Copy application code
COPY . $APP_ROOT

RUN bundle exec bootsnap precompile --gemfile app/ lib/

# Precompile assets for a production environment.
# This is done to include assets in production images on Dockerhub.
RUN SECRET_KEY_BASE=1 RAILS_ENV=production bundle exec rake assets:precompile

# Startup
CMD ["bin/docker-start"]
54 changes: 54 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.3.0"

gem "rails", "~> 7.1.1"
gem "sprockets-rails"
gem "pg", "~> 1.5"
gem "puma"
gem "jbuilder"
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "bootsnap", require: false
gem "sassc-rails"
gem "counter_culture"
gem "faraday"
gem "faraday-retry"
gem "faraday-follow_redirects"
gem "pagy"
gem "pghero"
gem "pg_query"
gem 'bootstrap'
gem "rack-attack"
gem "rack-attack-rate-limit", require: "rack/attack/rate-limit"
gem 'rack-cors'
gem 'rswag-api'
gem 'rswag-ui'
gem 'jquery-rails'
gem 'faraday-typhoeus'
gem 'sitemap_generator'
gem 'sidekiq'
gem 'sidekiq-unique-jobs'
gem 'sidekiq-status'
gem 'google-protobuf'
gem 'groupdate'
gem 'simple_form'
gem 'cff'
gem 'tokenizers'

group :development, :test do
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem 'dotenv-rails'
end

group :development do
gem "web-console"
end

group :test do
gem "shoulda-matchers"
gem "shoulda-context"
gem "webmock"
gem "mocha"
gem "rails-controller-testing"
end
Loading

0 comments on commit 6640813

Please sign in to comment.