Automatic setup (without user interaction)
- Dominant language
- Shell
- Stars
- 439
- Forks
- 271
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to understand how to make automatic setup with docker distribution of Cachet and it looks nearly impossible now.
I'm setting mostly all environment variables, adding settings and user to database with standalone python script (starts after database and Cachet and updates tables), but Cachet always starts (redirects) with Setup page.
> docker-compose.yml env variables for cachet service
```
- APP_ENV=production
- APP_URL=http://localhost:8000
- APP_KEY=oZ1Z75oeVviviFx1qILoN411Q54RO548
- DEBUG=false
- CACHE_DRIVER=apc
- SESSION_DRIVER=apc
- QUEUE_DRIVER=database
- MAIL_DRIVER=smtp
- MAIL_HOST=smtp.mailgun.org
- MAIL_PORT=465
- MAIL_USERNAME=user@email.com
- MAIL_PASSWORD=somepass
- MAIL_ADDRESS=user@email.com
- MAIL_NAME=Status
- MAIL_ENCRYPTION=tls
- DB_DRIVER=pgsql
- DB_HOST=postgresql
- DB_PORT=5432
- DB_DATABASE=postgres
- DB_USERNAME=postgres
- DB_PASSWORD=postgres
- DB_PREFIX=chq_
- REDIS_HOST=null
- REDIS_DATABASE=null
- REDIS_PORT=null
- GITHUB_TOKEN=null
```
> updating cachet tables in DB (python)
```
def add_cachet_user():
settings = {
'app_name': 'sitename',
'app_domain': 'http://localhost:8000',
'app_timezone': 'America/San_Francisco',
'app_locale': 'en',
'app_incident_days': '7',
}
with psycopg2.connect(
host=config.CACHET_PG_HOST,
port=config.CACHET_PG_PORT,
database=config.CACHET_PG_DATABASE,
user=config.CACHET_PG_USER,
password=config.CACHET_PG_PASSWORD
) as conn:
with conn.cursor() as cursor:
cursor.execute(
'INSERT INTO chq_users (username, password, email, api_key, active, level, created_at, updated_at) '
'VALUES (%s, %s, %s, %s, %s, %s, %s, %s);',
['user', '$xx$xx$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxx',
'user@email.com', 'xxxxxxxxxxxxxx', True, 1, datetime.now(), datetime.now()]
)
with conn.cursor() as cursor:
for key, value in settings.items():
cursor.execute(
'INSERT INTO chq_settings (name, value, created_at, updated_at) '
'VALUES (%s, %s, %s, %s);',
[key, value, datetime.now(), datetime.now()]
)
```
Is any workaround here? What do I need to run Cachet without user interaction?
> Cachet 2.5.0-dev
Contributor guide
Assessment
This issue has not been assessed yet.