Râu Cao
8aa3ca9e23
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #205 Reviewed-by: galfert <garret.alfert@gmail.com> |
||
---|---|---|
.gitea | ||
app | ||
bin | ||
ci | ||
config | ||
db | ||
docker/strfry | ||
extras/strfry | ||
lib | ||
log | ||
public | ||
schemas/ldap | ||
spec | ||
tmp | ||
vendor | ||
.browserslistrc | ||
.drone.yml | ||
.env.example | ||
.env.test | ||
.gitignore | ||
.rspec | ||
.ruby-version | ||
babel.config.js | ||
config.ru | ||
docker-compose.yml | ||
Dockerfile | ||
Gemfile | ||
Gemfile.lock | ||
LICENSE | ||
package.json | ||
postcss.config.js | ||
Procfile.dev | ||
Rakefile | ||
README.md | ||
tailwind.config.js | ||
yarn.lock |
Akkounts
This app allows Kosmos/LDAP users to manage their accounts, including credentials, invites, donations, etc..
Development
Quick Start
The easiest way to get a working development setup is using Docker Compose like so:
- Make sure Docker Compose is installed and Docker is running (included in Docker Desktop)
- Run
docker compose up --build
and wait until all services have started (389ds might take an extra minute to be ready). This will take a while when running for the first time, so you might want to do something else in the meantime. docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"
docker compose run web rails ldap:setup
docker compose run web rails db:setup
After these steps, you should have a working Rails app with a handful of test users running on http://localhost:3000. Log in with username "admin" and password "admin is admin". All users listed on http://localhost:3000/admin/users have the password "user is user".
Rails app
Note: when using Docker Compose, prefix the following commands with docker-compose run web
.
Installing dependencies:
bundle install
yarn install
Migrating the local database (after schema changes):
bundle exec rails db:migrate
Running the dev server, and auto-building CSS files on change (automatic with Docker Compose):
bin/dev
Running the background workers (requires Redis) (automatic with Docker Compose):
bundle exec sidekiq -C config/sidekiq.yml
Running the test suite:
bundle exec rspec
Running the test suite with Docker Compose requires overriding the Rails environment:
docker-compose run -e "RAILS_ENV=test" web rspec
Docker Compose
Services/containers are configured in docker-compose.yml
.
You can run services selectively, for example if you want to run the Rails app
and test suite on the host machine. Just add the service names of the
containers you want to run to the up
command, like so:
docker-compose up ldap redis
LDAP server
After creating the Docker container for the first time (or after deleting it), you need to run the following command once, in order to create the dirsrv back-end:
docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"
Now you can seed the back-end with data using this Rails task:
bundle exec rails ldap:setup
The setup task will first delete any existing entries in the directory tree ("dc=kosmos,dc=org"), and then create our development entries.
Note that all 389ds data is stored in the 389ds-data
volume. So if you want
to start over with a fresh installation, delete both that volume as well as the
container.
Minio / remoteStorage
If you want to run remoteStorage accounts locally, you will have to create the
respective bucket first. With the minio
container running (run by default
when using Docker Compose), follow these steps:
docker compose up web redis minio liquor-cabinet
- Head to http://localhost:9001 and log in with user
minioadmin
, passwordminioadmin
- Create a new bucket called
remotestorage
(or whatever you change theS3_BUCKET
config to) - Create a new key with ID "dev-key" and secret "123456789" (or whatever you
change
S3_ACCESS_KEY
andS3_SECRET_KEY
to). Leave the policy field empty, as it will automatically allow access to the bucket you created.
Adding npm modules to use with Stimulus controllers
The following command downloads the specified npm module to vendor/javascript
and adds an entry for it to config/importmap.rb
.
bin/importmap pin bech32 --download
Solargraph
Solargraph is a Ruby language server, which you may use with your editor to add features like auto-completion and syntax validation. You can add inline documentation for bundled gems with this command:
bundle exec yard gems