Deploying Mattermost with Datacol
At its core, Mattermost is an open source, private cloud alternative to proprietary SaaS messaging for teams. It is a great solution for communities and companies who wants to privately host their own messaging service or for developers who are looking forward to build and evolve their own chat platforms.
In summary, we will
Create a stack
datacol init --project mattermost-at-gcp --stack mattermost
It will authenticate with your Google account and provision a Datacol infrastructure in your account. Enter into the app directory and create a new datacol app -
git clone email@example.com:datacol-io/samples.git && cd samples/mattermost STACK=mattermost datacol apps create
Now you are all set to deploy any container based app into cluster by running
Create a Database backend
Mattermost requires a database backend. We always recommend to use managed services by cloud than by yourself unless you have a good reason to do so. To provision a CloudSQL mysql instance, run
datacol infra create mysql --name mysql-1111
It will provision a MySQL second generation instance along with a database and an user. To see information of a resource -
> datacol infra info mysql-1111 mysql-1111 DATABASE_URL=mysql://mysql:firstname.lastname@example.org:3306/app INSTANCE_NAME=gcs-local:us-east1:mysql-42535
A SQL resource can be linked to multiple apps and automatically provision cloudsql-proxy for secure access. To link
mattermost app, run
datacol infra link mysql-1111
To provide secrets, API keys or configuration, you can use
datacol env to set into environment variables
datacol env set PORT=3000 RAILS_ENV=production
To finally deploy the app into cluster run -
It will use
Dockerfile to build a docker image and save into the Google registry. After a successful build, it will deploy Mattermost into the cluster and wait for the
LoadBalancer for an ip.
You need to run database migrations to create required tables. Run following to get up and running.
datacol run rake db:migrate
We saw how we deployed Mattermost and provision a cloud service using our CLI. I hope this helps if you are looking to get up and running as quickly as possible without worrying about Kubernetes concepts (services, replicationcontrollers, deployemnts) but about apps, builds, and releases.