slim
Version, currently master branch1 version
- master branchlatestNov 15, 2019
github.com/eliasjpr/slim
No description declared in shard.yml.
Installation
# Add this to your shard.yml
dependencies:
slim:
github: eliasjpr/slim
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.31.0- License
- MIT
- Author
- Elias Perez
- Target
slimfrom src/slim.cr
Dependencies
Runtime Dependencies
- onyx*github: onyxframework/onyx
- clear*github: eliasjpr/clear, branch: master
- onyx-http~> 0.8.0github: onyxframework/http
Development Dependencies
- ameba~> 0.10.1github: crystal-ameba/amebadev
README
Slim - A Subscription Management API
Handle your customer subscription billing life cycle from end to end. Automate recurring billing, manage subscriptions, send professional tax-compliant invoices, and get paid on time, every time.
Getting Started
This subcription management API is built using the Crystal Language a statically type checked, compiled language with null reference checks, built in type inference.
Prerequisites
This project uses the following tools
- Crystal programming language
- Docker as container
- Postgres DB as database
- Kubernetes for deployments
MacOS Installation
brew install crystal
brew install kubernetes-cli kubectl
brew install postgres
brew install docker
brew install doctl
Installing
A step by step series of examples that tell you how to get a development env running
Say what the step will be
shards install
make build run
End with an example of getting some data out of the system or using it for a little demo
Running the tests
To run project tests
- Unit Tests -
crystal spec spec/domain - Endpoints Tests -
crystal spec spec/endpoints(Must first run server in separate processmake run)
Code Formatter
For code formatting this project uses Crystal built-in code formatter
crystal tool format
./bin/ameba
Crystal Ameba
A static code analysis tool for Crystal
crystal tool format
./bin/ameba
Deployment
Deployement is performed using GitLab CI/CD. Deployment scripts are available under the ./deploy directory
- Setup a Kubenetes Cluster on Digital Ocean
- Download the Certificate file using
doctlwithdoctl kubernetes cluster kubeconfig save slim-cluster - Add new Kubernetes cluster in GitLab
https://gitlab.com/eliasjpr/slim/clustersfollowing these instructionshttps://docs.gitlab.com/ee/user/project/clusters/add_remove_clusters.html - Install
Helm TillerandGitLab Runner - Create a deploy token
https://gitlab.com/eliasjpr/slim/-/settings/repository - Create a database url secret in kubernetes
kubectl create secret generic databaseurl --from-literal=DATABASE_URL="{CONNECTION_STIRNG_HERE}" - Create a private docker registry secret in kubernetes with deploy token info
create secret docker-registry regcred --docker-server=$CI_REGISTRY --docker-username='$CI_DEPLOY_USER' --docker-password='$CI_DEPLOY_PASSWORD' --docker-email='$GITLAB_USER_EMAIL --dry-run=true -o yaml | kubectl apply -f - - Run the pipeline
Run kubectl apply -f deploy to apply changes to the kubernetes cluster from local machine.
Gitlab AutoDevops on DigitalOcean k8s
Creating k8s cluster on DigitalOcean
- Create a k8s cluster https://cloud.digitalocean.com/kubernetes/clusters
- Install kubectl https://kubernetes.io/docs/tasks/tools/install-kubectl/
- Download config file from cluster page to
~/.kube/config
Adding k8s cluster to Gitlab project
More info here: https://gitlab.com/help/user/project/clusters/index#adding-an-existing-kubernetes-cluster
Go to the group and add Kubernetes cluster https://gitlab.com/groups/urbica/-/clusters/
- Create a gitlab service account in the default namespace:
kubectl create -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab
namespace: default
EOF
- Create a cluster role binding to give the gitlab service account cluster-admin privileges:
kubectl create -f - <<EOF
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-cluster-admin
subjects:
- kind: ServiceAccount
name: gitlab
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
EOF
To determine the API URL, run
kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print $NF}'
To determine the Token, list the secrets by running:
kubectl get secrets
Note the name of the secret you need the token for. Get the token for the appropriate secret by running:
kubectl get secret <SECRET_NAME> -o jsonpath="{['data']['token']}" | base64 -D
To determine the CA certificate, run:
kubectl get secret <SECRET_NAME> -o jsonpath="{['data']['ca\.crt']}" | base64 -D
Don't forget to enable RBAC.
On the cluster settings page install:
- Helm Tiller
- Ingress
- Cert Manager
After installing Ingress, check that external ip is set and pointing to the right load balancer https://gitlab.com/help/user/project/clusters/index.md#getting-the-external-ip-address
Built With
- Crystal - The web framework used
- Crystal Shards - Dependency Management
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Nov 15, 2019
- Crystal
0.31.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/eliasjpr/slim
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1