- asdf version manager
dockerwithdocker-compose
Install Ruby and Node.js to versions specified in .tool-versions
Ensure to have postgresql-devel and libyaml-devel installed in your system.
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf installCreate own env file `
cp .env .env.localSetup an email with which you will sign in in .env.local
SITE_ADMIN_EMAILS=your-g-suite-sign-up-email@gmail.com- Get / Create OAuth permissions by guide
- don't forget to Add an Authorized Redirect URI
http://localhost:3000/auth/google_oauth2/callback
- don't forget to Add an Authorized Redirect URI
- write permissions to
.env.local, example:
GOOGLE_CLIENT_ID=some-numbers-and-characters.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-and-other-secret-part- Create AAD APP
- don't forget to Add a Redirect URI
http://localhost:3000/auth/microsoft_graph/callback
- don't forget to Add a Redirect URI
- write
Application (client) IDandCertificates & secretsto.env.local, example:
AZURE_APPLICATION_CLIENT_ID=some-numbers-and-characters
AZURE_APPLICATION_CLIENT_SECRET=some-secret- in the portal, open the Manifest tab under Manage section and set the following properties:
"accessTokenAcceptedVersion": 2,
"signInAudience": "AzureADandPersonalMicrosoftAccount"For more details, see the official documentation
docker-compose up./bin/setup
env RAILS_ENV=test ././bin/setup
yarnAfter configuring your admin email and setting up the database, run:
./bin/rails db:seedNote
Make sure you have set SITE_ADMIN_EMAILS in your .env.local file before running the seed command, as this creates the admin account and other initial data.
./bin/dev./bin/rails test./bin/rails c- Generate RSA keypair:
openssl genrsa -out govbox_dev_api_token.private.pem 2048
openssl rsa -in govbox_dev_api_token.private.pem -pubout -out govbox_dev_api_token.public.pem- Set the public key on your tenant, enable API feature, Generate API token (in Rails console):
# bin/rails console
TENANT_ID = 1 # your tenant id
PEM = 'govbox_dev_api_token.private.pem'
tenant = Tenant.find(TENANT_ID)
tenant.api_token_public_key = File.read(PEM)
tenant.feature_flags << :api
tenant.save!
def api_token_private_key
OpenSSL::PKey::RSA.new(File.read(PEM))
end
def generate_api_token(tenant)
JWT.encode({ sub: tenant.id, exp: 5.minutes.from_now.to_i, jti: SecureRandom.uuid }, api_token_private_key, 'RS256')
end
token = generate_api_token(tenant) # max 5 minutes validity- Use the token in API requests:
export GOVBOX_TOKEN=token-from-rails-console
curl -H "Authorization: Bearer $GOVBOX_TOKEN" http://localhost:3000/api/boxes- We use Good Jobs
- See jobs web ui / dashboard
- Your public IP has to be added to whitelist (ask colleague)
- In rails console run
Govbox::SyncBoxJob.perform_later(Box.last)
Execute this script in rail console.
Execute following command in rails console.
Govbox::ApiConnectionWithOboSupport.find_or_create_by!(
tenant: Tenant.first,
sub: "SPL_Irvin_83300252_KK_24022023",
api_token_private_key: File.read(Rails.root + "security/govbox_api_fix.pem")
)