Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

mirego/accent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


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

DemoWebsiteGraphiQL

Actions StatusCoverage StatusJoin the chat at https://gitter.im/mirego/accentDockerDocker Registry

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

  • History. Full history control and actions rollback.Who didwhat,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. It’s easy to build a plugin/cli/library around Accent.

Contents

SectionDescription
🚀 Getting startedQuickly setup a working app
🚧 RequirementsDependencies required to run Accent’ stack
🎛 Mix commandsHow to execute mix task with the Twelve-Factor pattern
🏎 QuickstartSteps to run the project, from API to webapp, with or without Docker
🌳 Environment variablesRequired and optional env var used
✅ TestsHow to run the extensive tests suite
🚀 HerokuEasy deployment setup with Heroku
🌎 ContributeHow 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_developmentDUMMY_LOGIN_ENABLED=1# Required for session management. Must be a 64-byte string.# Generate one using: openssl rand -hex 64SECRET_KEY_BASE=KEY
  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 ~> 26.1
  • elixir ~> 1.15
  • postgres >= 9.4
  • node.js >= 16.19
  • libyaml >= 0.1.7

🎛 Executing mix commands

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

When executingmix commands, you should always make sure that the required environment variables are present. You cansource, usenv 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 namedpostgres listening on port5432 onlocalhost.

Example

Withnv 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 theGetting started instructions

  1. If you don’t already have it, installnodejs withbrew install nodejs
  2. If you don’t already have it, installelixir withbrew install elixir
  3. If you don’t already have it, installlibyaml withbrew install libyaml
  4. If you don’t already have it, installpostgres withbrew install postgres or the Docker setup as described below.
  5. Install dependencies withmake dependencies
  6. Create and migrate your database withmix ecto.setup
  7. Start Phoenix endpoint withmix phx.server

That’s it! You should now be able to open the app athttp://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 don’t 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 authentication setup in theenvironment section indocker-compose.yml file.See the following sections to see available variables to enable third-party logins or dummy login (email only, no password).

  1. Runmake build to build the OTP release with Docker
  2. Runmake dev-start-postgresql to start an instance of Postgresql. The instance will run on port 5432 with thepostgres user. You can change those values in thedocker-compose.yml file.
  3. Runmake 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 indocker-compose.yml)

That’s it! You now have a working Accent instance without installing Elixir or NodeJS!

🌳 Environment variables

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

VariableDefaultDescription
DATABASE_URLpostgres://localhost/accent_developmentA valid database URL
PORT4000A port to run the app on
SECRET_KEY_BASEDEFAULT_UNSAFE_KEYThe secret key that is used to encrypt session (cookie)

Production setup

VariableDefaultDescription
RESTRICTED_PROJECT_CREATOR_EMAIL_DOMAINnoneIf specified, only authenticated users from this domain name will be able to create new projects.
FORCE_SSLfalseIf the app should always be served by https (and wss for websocket)
SENTRY_DSNnoneThesecret Sentry DSN used to collect API runtime errors
WEBAPP_SENTRY_DSNnoneThepublic Sentry DSN used to collect Webapp runtime errors
CANONICAL_URLnoneThe URL of the app. Used in sent emails and to redirect from external services to the app in the authentication flow.
DISABLE_CANONICAL_HOST_REDIRECTnoneRemove the redirect to the canonical host URL. Use with caution.
STATIC_URLnoneThe URL of the app. Default to the CANONICAL_URL value.
WEBAPP_SKIP_SUBRESOURCE_INTEGRITYnoneRemove integrity attributes on link and script tag. Useful when using a proxy that compress resources before serving them.
DATABASE_SSLfalseIf SSL should be used to connect to the database
DATABASE_POOL_SIZE10The size of the pool used by the database connection module
MACHINE_TRANSLATIONS_VAULT_KEYDEFAULT_UNSAFE_VAULT_KEYThe secret key that is used to encrypt machine translations services config key
TZDATA_AUTOUPDATE_DISABLEDnoneTurn off automatic updates for Tzdata, needed when running read-only containers
SECRET_KEY_BASEDEFAULT_UNSAFE_KEYThe secret key that is used to encrypt session (cookie)

Authentication setup

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

VariableDefaultDescription
DUMMY_LOGIN_ENABLEDnoneIf specified, the password-less authentication (with only the email) will be available.
GITHUB_CLIENT_IDnone
GITHUB_CLIENT_SECRETnone
GITLAB_CLIENT_IDnone
GITLAB_CLIENT_SECRETnone
GITLAB_SITE_URLhttps://gitlab.com
GOOGLE_API_CLIENT_IDnone
GOOGLE_API_CLIENT_SECRETnone
SLACK_CLIENT_IDnone
SLACK_CLIENT_SECRETnone
SLACK_TEAM_IDnone
DISCORD_CLIENT_IDnone
DISCORD_CLIENT_SECRETnone
MICROSOFT_CLIENT_IDnone
MICROSOFT_CLIENT_SECRETnone
MICROSOFT_TENANT_IDnone
OIDC_CLIENT_IDnone
OIDC_CLIENT_SECRETnone
OIDC_DISCOVERY_URInone
OIDC_UID_FIELDsub
OIDC_SCOPEopenid profile email

Email setup

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

VariableDefaultDescription
MAILER_FROMnoneThe email address used to send emails.
SENDGRID_API_KEYnoneUse SendGrid to send emails
MANDRILL_API_KEYnoneUse Mandrill to send emails
MAILGUN_API_KEYnoneUse Mailgun to send emails
MAILGUN_DOMAINnoneUse a custom domain in Mailgun
MAILGUN_BASE_URInoneSend emails from a different server
SMTP_ADDRESSnoneUse an SMTP server to send your emails.
SMTP_API_HEADERnoneAn optional API header that will be added to sent emails.
SMTP_PORTnoneThe port ex: (25, 465, 587).
SMTP_PASSWORDnoneThe password for authentification.
SMTP_USERNAMEnoneThe username for authentification.

Metrics and monitoring setup

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

VariableDefaultDescription
NEW_RELIC_APP_NAMEnoneService APM name
NEW_RELIC_LICENSE_KEYnoneLicense key

Or use the built-in metrics UI fromTelemetryUI:

VariableDefaultDescription
METRICS_BASIC_AUTHnoneusername:password to HTTP basic auth login on the pre-configured dashboard

Kubernetes helm chart setup

You can setup the project witha helm chart like this one. This project usesa 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 runmix test.

$ npm --prefix webapp run build$ mix ecto.setup$ mixtest

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

🚀 Deploy on Heroku

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

Deploy on Heroku

Using Heroku CLI

Based onthis guide

$> heroku createCreating app... done, ⬢ peaceful-badlands-85887https://peaceful-badlands-85887.herokuapp.com/ | https://git.heroku.com/peaceful-badlands-85887.git$> heroku addons:create heroku-postgresql:hobby-dev --app peaceful-badlands-85887Creating heroku-postgresql:hobby-dev on ⬢ peaceful-badlands-85887... freeDatabase has been created and is available$> heroku config:set FORCE_SSL=true DATABASE_SSL=true DUMMY_LOGIN_ENABLED=true --app peaceful-badlands-85887Setting FORCE_SSL, DATABASE_SSL, DUMMY_LOGIN_ENABLED and restarting ⬢ peaceful-badlands-85887... done$> heroku container:push web --app peaceful-badlands-85887=== Building webYour image has been successfully pushed. You can now release it with the 'container:release' command.$> heroku container:release web --app peaceful-badlands-85887Releasing images web to peaceful-badlands-85887... done

🌎 Contribute

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

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

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

License

Accent is © 2015-2019Mirego and may be freely distributed under theNew BSD license. See theLICENSE.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. We’re a team oftalented people who imagine and build beautiful Web and mobile applications. We come together to share ideas andchange the world.

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

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors52


[8]ページ先頭

©2009-2025 Movatter.jp