2021-11-25 19:24:56 -06:00
|
|
|
[](https://drone.kosmos.org/kosmos/akkounts)
|
|
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
# Akkounts
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
This app allows Kosmos/LDAP users to manage their accounts, including
|
|
|
|
|
credentials, invites, donations, etc..
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
## Development
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2022-12-07 18:15:04 +01:00
|
|
|
### Quick Start
|
|
|
|
|
|
|
|
|
|
The easiest way to get a working development setup is using Docker Compose like
|
|
|
|
|
so:
|
|
|
|
|
|
|
|
|
|
1. Make sure [Docker Compose is installed][1] and Docker is running (included in
|
|
|
|
|
Docker Desktop)
|
|
|
|
|
3. Run `docker compose up` and wait until 389ds announces its successful start
|
|
|
|
|
in the log output
|
|
|
|
|
4. `docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"`
|
|
|
|
|
5. `docker compose run web rails ldap:setup`
|
2023-02-26 13:10:49 +01:00
|
|
|
6. `docker compose run web rails db:setup`
|
2022-12-07 18:15:04 +01:00
|
|
|
|
|
|
|
|
After these steps, you should have a working Rails app with a handful of test
|
|
|
|
|
users running on [http://localhost:3000](http://localhost:3000).
|
|
|
|
|
Log in with username "admin" and password "admin is admin". All users listed on
|
2023-04-06 16:24:46 +02:00
|
|
|
[http://localhost:3000/admin/users](http://localhost:3000/admin/users)
|
2022-12-07 18:15:04 +01:00
|
|
|
have the password "user is user".
|
|
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
### Rails app
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
Installing dependencies:
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
bundle install
|
|
|
|
|
yarn install
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
Setting up local database (SQLite):
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
bundle exec rails db:create
|
|
|
|
|
bundle exec rails db:migrate
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2022-02-16 10:46:04 -06:00
|
|
|
Running the dev server and auto-building CSS files on change:
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2022-02-16 10:46:04 -06:00
|
|
|
bin/dev
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2021-02-02 21:15:52 +01:00
|
|
|
Running the background workers (requires Redis):
|
|
|
|
|
|
|
|
|
|
bundle exec sidekiq -C config/sidekiq.yml
|
|
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
Running all specs:
|
2020-11-07 14:49:32 +01:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
bundle exec rspec
|
|
|
|
|
|
2022-12-05 13:35:30 +01:00
|
|
|
### Docker (Compose)
|
|
|
|
|
|
2023-06-23 17:32:39 +02:00
|
|
|
There is a working Docker Compose config file, which define a number of services including
|
2022-12-05 13:35:30 +01:00
|
|
|
an app server for Rails as well as a local 389ds (LDAP) server.
|
|
|
|
|
|
2023-06-23 17:21:52 +02:00
|
|
|
For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`,
|
2023-06-23 17:30:00 +02:00
|
|
|
listening on port 389 on your machine.
|
2023-06-23 17:21:52 +02:00
|
|
|
|
|
|
|
|
You can pick and choose your services adding them by name (listed in `docker-compose.yml`) at
|
|
|
|
|
the end of the docker compose command. eg. `docker compose up ldap redis`
|
2022-12-05 13:35:30 +01:00
|
|
|
|
2022-12-07 18:15:04 +01:00
|
|
|
#### LDAP server
|
2022-12-05 13:35:30 +01:00
|
|
|
|
|
|
|
|
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"
|
2020-11-09 09:55:08 +01:00
|
|
|
|
2022-12-05 13:36:33 +01:00
|
|
|
Now you can seed the back-end with data using this Rails task:
|
|
|
|
|
|
2022-12-07 18:15:04 +01:00
|
|
|
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.
|
2022-12-05 13:36:33 +01:00
|
|
|
|
2022-12-07 18:15:04 +01:00
|
|
|
Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over
|
|
|
|
|
with a fresh installation, delete both that directory as well as the container.
|
2022-12-05 13:36:33 +01:00
|
|
|
|
2023-11-01 22:01:14 +01:00
|
|
|
#### Minio / RS
|
|
|
|
|
|
|
|
|
|
If you want to run remoteStorage accounts locally, you will have to create the
|
|
|
|
|
respective bucket first:
|
|
|
|
|
|
|
|
|
|
* `docker compose up web redis minio liquor-cabinet`
|
|
|
|
|
* Head to http://localhost:9001 and log in with user `minioadmin`, password
|
|
|
|
|
`minioadmin`
|
|
|
|
|
* Create a new bucket called `remotestorage` (or whatever you
|
|
|
|
|
change the `S3_BUCKET` config to)
|
|
|
|
|
* Create a new key with ID "dev-key" and secret "123456789" (or whatever you
|
|
|
|
|
change `S3_ACCESS_KEY` and `S3_SECRET_KEY` to). Leave the policy field empty,
|
|
|
|
|
as it will automatically allow access to the bucket you created.
|
|
|
|
|
|
2023-03-07 18:30:09 +08:00
|
|
|
### 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
|
|
|
|
|
|
2023-04-07 20:11:45 +02:00
|
|
|
### Solargraph
|
2023-03-31 18:07:38 +02:00
|
|
|
|
|
|
|
|
[Solargraph](https://solargraph.org/) 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
|
|
|
|
|
|
2020-11-09 09:55:08 +01:00
|
|
|
## Documentation
|
|
|
|
|
|
2023-03-01 17:14:44 +08:00
|
|
|
### Rails
|
|
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
* [Ruby on Rails](https://guides.rubyonrails.org/)
|
2023-03-01 17:14:44 +08:00
|
|
|
* [Pagination](https://ddnexus.github.io/pagy/)
|
2020-11-18 15:28:17 +01:00
|
|
|
|
2021-11-24 11:03:42 -06:00
|
|
|
### Front-end
|
|
|
|
|
|
|
|
|
|
* [Tailwind CSS](https://tailwindcss.com/)
|
2023-03-01 17:14:44 +08:00
|
|
|
* [Sass](https://sass-lang.com/documentation)
|
2023-03-07 18:30:09 +08:00
|
|
|
* [Stimulus](https://stimulus.hotwired.dev/handbook/)
|
2023-08-07 18:16:34 +02:00
|
|
|
* [Tailwind Stimulus Components](https://github.com/excid3/tailwindcss-stimulus-components)
|
2021-11-24 11:03:42 -06:00
|
|
|
|
2020-11-18 15:28:17 +01:00
|
|
|
### Testing
|
|
|
|
|
|
|
|
|
|
* [RSpec](https://rspec.info/documentation/)
|
|
|
|
|
* [Capybara](https://rubydoc.info/github/teamcapybara/capybara/master)
|
|
|
|
|
|
|
|
|
|
### LDAP / Auth
|
|
|
|
|
|
|
|
|
|
* [devise_ldap_authenticatable](https://github.com/cschiewek/devise_ldap_authenticatable)
|
2020-11-09 09:55:08 +01:00
|
|
|
* [net/ldap](https://www.rubydoc.info/gems/net-ldap/Net/LDAP)
|
2020-11-18 15:38:36 +01:00
|
|
|
|
2021-02-02 21:15:52 +01:00
|
|
|
### Asynchronous jobs/workers
|
|
|
|
|
|
|
|
|
|
* [Sidekiq](https://github.com/mperham/sidekiq/wiki/)
|
|
|
|
|
* [ActiveJob](https://github.com/mperham/sidekiq/wiki/Active-Job)
|
|
|
|
|
|
2023-05-23 18:51:29 +02:00
|
|
|
### Feature Flags
|
|
|
|
|
|
|
|
|
|
* [Flipper](https://www.flippercloud.io/docs/get-started/self-hosted)
|
|
|
|
|
|
2020-11-18 15:38:36 +01:00
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/)
|
2022-12-07 18:15:04 +01:00
|
|
|
|
|
|
|
|
[1]: https://docs.docker.com/compose/install/
|