The first developer-oriented translation tool. True asynchronous flow between translators and your team.
Go to file
Simon Prévost dddd0e68b9 v1.10.5
2022-03-30 08:51:14 -04:00
.github/workflows Add correct node engine in package.json 2022-02-28 21:14:11 -05:00
cli Fix lint cli ellpsis display 2022-03-30 08:39:30 -04:00
config Add db timeout error grouping in sentry 2022-03-18 07:01:03 -04:00
hooks Add docker hub hook and k8s helm chart reference by @andreymaznyak 2019-10-03 17:22:09 -04:00
jipt Update deps 2020-04-08 08:44:52 -04:00
lib Fix credo 2022-03-30 08:51:12 -04:00
priv Update NodeJS deps for webapp and cli 2022-02-28 11:41:08 -05:00
test Add machine translations document translate 2022-03-15 06:18:21 -04:00
vendor Update webapp deps and fix heavy conflicts list 2021-06-04 07:19:04 -04:00
webapp Fix lint without master value 2022-03-30 08:37:11 -04:00
.credo.exs Update deps 2019-08-16 11:15:31 -04:00
.dockerignore Add gleam library to implement type-safe linting module 2020-06-10 13:04:13 -04:00
.eslintignore Fix eslint for webapp prod build 2019-07-22 14:51:08 -04:00
.eslintrc.js Update NodeJS deps for webapp and cli 2022-02-28 11:41:08 -05:00
.formatter.exs Add uberauth to handle authentication to allow multiple providers login (google, github and slack) 2019-05-20 21:45:25 -04:00
.gitignore Remove gen folder from git 2020-08-29 16:31:44 -04:00
.prettierignore Refactor Google login to use redirect instead of popup 2019-03-31 16:16:54 -04:00
.prettierrc Update icons 2019-04-07 16:28:15 -04:00
.tool-versions Update NodeJS deps for webapp and cli 2022-02-28 11:41:08 -05:00
app.json Fix heroku deployment(via deploy button) failure (#268) 2021-09-06 09:28:50 -04:00
CHANGELOG.md Update changelog 2021-06-23 12:43:29 -04:00
CODE_OF_CONDUCT.md Add uberauth to handle authentication to allow multiple providers login (google, github and slack) 2019-05-20 21:45:25 -04:00
coveralls.json Fix coveralls merge 2019-01-11 09:48:09 -05:00
docker-compose.yml Fix docker compose build with default build args 2019-09-07 16:27:26 -04:00
Dockerfile Update deps 2021-12-22 21:43:45 -05:00
heroku.yml Remove git based Heroku deploy files (#170) 2020-05-01 08:48:06 -04:00
LICENSE.md Rename LICENSE to LICENSE.md 2018-05-05 14:11:28 -04:00
logo.svg Initial commit 💥 2018-04-05 16:47:36 -04:00
Makefile Update NodeJS deps for webapp and cli 2022-02-28 11:41:08 -05:00
mix.exs v1.10.5 2022-03-30 08:51:14 -04:00
mix.lock Add GitLab OAuth provider 2022-03-15 06:27:34 -04:00
package-lock.json Update NodeJS deps for webapp and cli 2022-02-28 11:41:08 -05:00
package.json Add correct node engine in package.json 2022-02-28 21:14:11 -05:00
README.md Fix login forms styles issues 2022-03-15 09:23:01 -04:00


The first developer-oriented translation tool
True asynchronous flow between translators and your team.

DemoWebsiteGraphiQL

Actions Status Coverage Status Join the chat at https://gitter.im/mirego/accent Docker Docker Registry

Accent provides a powerful abstraction around the process maintaining translations in a web/native app.

  • History. Full history control and actions rollback. Who did what, when.
  • UI. Simple yet powerful UI to enable translator and developer to be productive.
  • CLI. Command line tool to easily add Accent to your developer flow.
  • Collaboration. Centralize your discussions around translations.
  • GraphQL. The API that powers the UI is open and documented. Its easy to build a plugin/cli/library around Accent.

Contents

Section Description
🚀 Getting started Quickly setup a working app
🚧 Requirements Dependencies required to run Accent stack
🎛 Mix commands How to execute mix task with the Twelve-Factor pattern
🏎 Quickstart Steps to run the project, from API to webapp, with or without Docker
🌳 Environment variables Required and optional env var used
Tests How to run the extensive tests suite
🚀 Heroku Easy deployment setup with Heroku
🌎 Contribute How to contribute to this repo

🚀 Getting started

Easiest way to run an instance of Accent is by using the offical docker image: https://hub.docker.com/r/mirego/accent

  1. The only external dependancy is a PostgreSQL database.
  2. Create a .env file. Example:
DATABASE_URL=postgresql://postgres@docker.for.mac.host.internal/accent_development
DUMMY_LOGIN_ENABLED=1
  1. Run the image
$ docker run --env-file .env -p 4000:4000 mirego/accent

This will start the webserver on port 4000, migrate the database to have an up and running Accent instance!

🚧 Requirements

  • erlang ~> 24.0
  • elixir ~> 1.13
  • postgres >= 9.4
  • node.js >= 16.13
  • libyaml >= 0.1.7

🎛 Executing mix commands

The app is modeled with the Twelve-Factor App architecture, all configurations are stored in the environment.

When executing mix commands, you should always make sure that the required environment variables are present. You can source, use nv or a custom l33t bash script.

Every following steps assume you have this kind of system.

But Accent can be run with default environment variables if you have a PostgreSQL user named postgres listening on port 5432 on localhost.

Example

With nv you inject the environment keys in the context with:

$ nv .env mix <mix command>

🏎 Quickstart

This is the full development setup. To simply run the app, see the Getting started instructions

  1. If you dont already have it, install nodejs with brew install nodejs
  2. If you dont already have it, install elixir with brew install elixir
  3. If you dont already have it, install libyaml with brew install libyaml
  4. If you dont already have it, install postgres with brew install postgres or the Docker setup as described below.
  5. Install dependencies with make dependencies
  6. Create and migrate your database with mix ecto.setup
  7. Start Phoenix endpoint with mix phx.server

Thats it! You should now be able to open the app at http://localhost:4000

Makefile

The Makefile should be the main entry for common tasks such as tests, linting, Docker, etc. This simplifies the development process since you dont have to search for which service provides which command. mix, npm, prettier, docker, stylelint, etc are all used in the Makefile.

Docker

For the production setup, we use Docker to build an OTP release of the app. With docker-compose, you can run the image locally. Here are the steps to have a working app running locally with Docker:

When running the production env, you need to provide a valid GOOGLE_API_CLIENT_ID in the docker-compose.yml file.

  1. Run make build to build the OTP release with Docker
  2. Run make dev-start-postgresql to start an instance of Postgresql. The instance will run on port 5432 with the postgres user. You can change those values in the docker-compose.yml file.
  3. Run make dev-start-application to start the app! The release hook of the release will execute migrations and seeds before starting the webserver on port 4000 (again you can change the settings in docker-compose.yml)

Thats it! You now have a working Accent instance without installing Elixir or Node!

🌳 Environment variables

Accent provides a default value for every required environment variable. This means that with the right PostgreSQL setup, you can just run mix phx.server.

Variable Default Description
DATABASE_URL postgres://localhost/accent_development A valid database URL
PORT 4000 A port to run the app on

Production setup

Variable Default Description
RESTRICTED_PROJECT_CREATOR_EMAIL_DOMAIN none If specified, only authenticated users from this domain name will be able to create new projects.
FORCE_SSL false If the app should always be served by https (and wss for websocket)
SENTRY_DSN none The secret Sentry DSN used to collect API runtime errors
WEBAPP_SENTRY_DSN none The public Sentry DSN used to collect Webapp runtime errors
CANONICAL_URL none The URL of the app. Used in sent emails and to redirect from external services to the app in the authentication flow.
WEBAPP_SKIP_SUBRESOURCE_INTEGRITY none Remove integrity attributes on link and script tag. Useful when using a proxy that compress resources before serving them.
DATABASE_SSL false If SSL should be used to connect to the database
DATABASE_POOL_SIZE 10 The size of the pool used by the database connection module

Authentication setup

Various login providers are included in Accent using Ueberauth to abstract services.

Variable Default Description
DUMMY_LOGIN_ENABLED none If specified, the password-less authentication (with only the email) will be available.
GITHUB_CLIENT_ID none
GITHUB_CLIENT_SECRET none
GITLAB_CLIENT_ID none
GITLAB_CLIENT_SECRET none
GITLAB_SITE_URL https://gitlab.com
GOOGLE_API_CLIENT_ID none
GOOGLE_API_CLIENT_SECRET none
SLACK_CLIENT_ID none
SLACK_CLIENT_SECRET none
SLACK_TEAM_ID none
DISCORD_CLIENT_ID none
DISCORD_CLIENT_SECRET none
MICROSOFT_CLIENT_ID none
MICROSOFT_CLIENT_SECRET none
MICROSOFT_TENANT_ID none

Email setup

If you want to send emails, youll have to configure the following environment variables:

Variable Default Description
MAILER_FROM none The email address used to send emails.
SENDGRID_API_KEY none Use SendGrid to send emails
MANDRILL_API_KEY none Use Mandrill to send emails
MAILGUN_API_KEY none Use Mailgun to send emails
SMTP_ADDRESS none Use an SMTP server to send your emails.
SMTP_API_HEADER none An optional API header that will be added to sent emails.
SMTP_PORT none The port ex: (25, 465, 587).
SMTP_PASSWORD none The password for authentification.
SMTP_USERNAME none The username for authentification.

Metrics and monitoring setup

If you want to track performance of Accent, you can configure NewRelic with the following environment variables:

Variable Default Description
NEW_RELIC_APP_NAME none Service APM name
NEW_RELIC_LICENSE_KEY none License key

Kubernetes helm chart setup

You can setup the project with a helm chart like this one. This project uses a fork by andreymaznyak and not this canonical repository. The specs and values may need to be updated if you use this repo.

Tests

API

Accent provides a default value for every required environment variable. This means that with the right PostgreSQL setup (and a few setup commands), you can just run mix test.

$ npm --prefix webapp run build
$ mix run ./priv/repo/seeds.exs
$ mix test

The full check that runs in the CI environment can be executed with ./priv/scripts/ci-check.sh.

🚀 Deploy on Heroku

An Heroku-compatible app.json makes it easy to deploy the application on Heroku.

Deploy on Heroku

Using Heroku CLI

Based on this guide

$> heroku create
Creating app... done, ⬢ peaceful-badlands-85887
https://peaceful-badlands-85887.herokuapp.com/ | https://git.heroku.com/peaceful-badlands-85887.git

$> heroku addons:create heroku-postgresql:hobby-dev --app peaceful-badlands-85887
Creating heroku-postgresql:hobby-dev on ⬢ peaceful-badlands-85887... free
Database has been created and is available

$> heroku config:set FORCE_SSL=true DUMMY_LOGIN_ENABLED=true --app peaceful-badlands-85887
Setting FORCE_SSL, DUMMY_LOGIN_ENABLED and restarting ⬢ peaceful-badlands-85887... done

$> heroku container:push web --app peaceful-badlands-85887
=== Building web
Your image has been successfully pushed. You can now release it with the 'container:release' command.

$> heroku container:release web --app peaceful-badlands-85887
Releasing images web to peaceful-badlands-85887... done

🌎 Contribute

Before opening a pull request, please open an issue first.

Once youve made your additions and the test suite passes, go ahead and open a PR!

Dont forget to run the ./priv/scripts/ci-check.sh script to make sure that the CI build will pass :)

License

Accent is © 2015-2019 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. Were a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.