Skip to content

Commit 71f4916

Browse files
committed
Hello world
0 parents  commit 71f4916

File tree

142 files changed

+4472
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+4472
-0
lines changed

.gitattributes

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored

.github/dependabot.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "bundler"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
allow:
8+
- dependency-type: direct
9+
- dependency-type: indirect
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
- package-ecosystem: "docker"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"

.github/workflows/ci.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
verify:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
10+
services:
11+
postgres:
12+
image: postgres:14
13+
env:
14+
POSTGRES_USER: ost
15+
POSTGRES_DB: ost_test
16+
POSTGRES_PASSWORD: postgres
17+
ports: ["5432:5432"]
18+
options: >-
19+
--health-cmd pg_isready
20+
--health-interval 10s
21+
--health-timeout 5s
22+
--health-retries 5
23+
redis:
24+
image: redis
25+
ports:
26+
- 6379:6379
27+
options: --entrypoint redis-server
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Install dependent libraries
32+
run: sudo apt-get install libpq-dev
33+
- name: Set up Node
34+
uses: actions/[email protected]
35+
with:
36+
node-version: 15
37+
- name: Set up Ruby
38+
uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: 3.2.2
41+
bundler-cache: true
42+
43+
- name: Run tests
44+
env:
45+
RAILS_ENV: test
46+
POSTGRES_DB: ost_test
47+
POSTGRES_USER: ost
48+
POSTGRES_PASSWORD: postgres
49+
POSTGRES_HOST: localhost
50+
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
51+
run: bundle exec rake db:create db:migrate test

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all logfiles and tempfiles.
11+
/log/*
12+
/tmp/*
13+
!/log/.keep
14+
!/tmp/.keep
15+
16+
# Ignore pidfiles, but keep the directory.
17+
/tmp/pids/*
18+
!/tmp/pids/
19+
!/tmp/pids/.keep
20+
21+
# Ignore uploaded files in development.
22+
/storage/*
23+
!/storage/.keep
24+
/tmp/storage/*
25+
!/tmp/storage/
26+
!/tmp/storage/.keep
27+
28+
/public/assets
29+
30+
# Ignore master key for decrypting credentials and more.
31+
/config/master.key

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.2.2

DEVELOPMENT.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Development
2+
3+
## Setup
4+
5+
First things first, you'll need to fork and clone the project to your local machine.
6+
7+
`git clone https://github.com/ecosyste-ms/ost.git`
8+
9+
The project uses ruby on rails which have a number of system dependencies you'll need to install.
10+
11+
- [ruby 3.2.2](https://www.ruby-lang.org/en/documentation/installation/)
12+
- [postgresql 14](https://www.postgresql.org/download/)
13+
- [redis 6+](https://redis.io/download/)
14+
- [node.js 16+](https://nodejs.org/en/download/)
15+
16+
Once you've got all of those installed, from the root directory of the project run the following commands:
17+
18+
```
19+
bundle install
20+
bundle exec rake db:create
21+
bundle exec rake db:migrate
22+
rails server
23+
```
24+
25+
You can then load up [http://localhost:3000](http://localhost:3000) to access the service.
26+
27+
### Docker
28+
29+
Alternatively you can use the existing docker configuration files to run the app in a container.
30+
31+
Run this command from the root directory of the project to start the service.
32+
33+
`docker-compose up --build`
34+
35+
You can then load up [http://localhost:3000](http://localhost:3000) to access the service.
36+
37+
For access the rails console use the following command:
38+
39+
`docker-compose exec app rails console`
40+
41+
Runing rake tasks in docker follows a similar pattern:
42+
43+
`docker-compose exec app rake projects:sync`
44+
45+
## Importing data
46+
47+
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:
48+
49+
`rake db:seed`
50+
51+
You can then start syncing data for each source with the following command, this may take a while:
52+
53+
`rake projects:sync`
54+
55+
## Tests
56+
57+
The applications tests can be found in [test](test) and use the testing framework [minitest](https://github.com/minitest/minitest).
58+
59+
You can run all the tests with:
60+
61+
`rails test`
62+
63+
## Rake tasks
64+
65+
The applications rake tasks can be found in [lib/tasks](lib/tasks).
66+
67+
You can list all of the available rake tasks with the following command:
68+
69+
`rake -T`
70+
71+
## Deployment
72+
73+
A container-based deployment is highly recommended, we use [dokku.com](https://dokku.com/).

Dockerfile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ruby:3.2.2-alpine
2+
3+
ENV APP_ROOT /usr/src/app
4+
ENV DATABASE_PORT 5432
5+
WORKDIR $APP_ROOT
6+
7+
# * Setup system
8+
# * Install Ruby dependencies
9+
RUN apk add --update \
10+
build-base \
11+
netcat-openbsd \
12+
git \
13+
nodejs \
14+
postgresql-dev \
15+
tzdata \
16+
curl \
17+
curl-dev \
18+
libc6-compat \
19+
&& rm -rf /var/cache/apk/*
20+
21+
# Will invalidate cache as soon as the Gemfile changes
22+
COPY Gemfile Gemfile.lock $APP_ROOT/
23+
24+
RUN bundle config --global frozen 1 \
25+
&& bundle config set without 'test' \
26+
&& bundle install --jobs 2
27+
28+
# ========================================================
29+
# Application layer
30+
31+
# Copy application code
32+
COPY . $APP_ROOT
33+
34+
RUN bundle exec bootsnap precompile --gemfile app/ lib/
35+
36+
# Precompile assets for a production environment.
37+
# This is done to include assets in production images on Dockerhub.
38+
RUN SECRET_KEY_BASE=1 RAILS_ENV=production bundle exec rake assets:precompile
39+
40+
# Startup
41+
CMD ["bin/docker-start"]

Gemfile

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
source "https://rubygems.org"
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby "3.2.2"
5+
6+
gem "rails", "~> 7.0.6"
7+
gem "sprockets-rails"
8+
gem "pg", "~> 1.5"
9+
gem "puma"
10+
gem "jbuilder"
11+
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
12+
gem "bootsnap", require: false
13+
gem "sassc-rails"
14+
gem "counter_culture"
15+
gem "faraday"
16+
gem "faraday-retry"
17+
gem "faraday-follow_redirects"
18+
gem "pagy"
19+
gem "pghero"
20+
gem "pg_query"
21+
gem 'bootstrap'
22+
gem "rack-attack"
23+
gem "rack-attack-rate-limit", require: "rack/attack/rate-limit"
24+
gem 'rack-cors'
25+
gem 'rswag-api'
26+
gem 'rswag-ui'
27+
gem 'jquery-rails'
28+
gem 'faraday-typhoeus'
29+
gem 'sitemap_generator'
30+
gem 'sidekiq'
31+
gem 'sidekiq-unique-jobs'
32+
gem 'sidekiq-status'
33+
gem 'google-protobuf', '3.24.2'
34+
gem 'groupdate'
35+
36+
group :development, :test do
37+
gem "debug", platforms: %i[ mri mingw x64_mingw ]
38+
gem 'dotenv-rails'
39+
end
40+
41+
group :development do
42+
gem "web-console"
43+
end
44+
45+
group :test do
46+
gem "shoulda-matchers"
47+
gem "shoulda-context"
48+
gem "webmock"
49+
gem "mocha"
50+
gem "rails-controller-testing"
51+
end

0 commit comments

Comments
 (0)