mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
env files for compose. fixes to push relays
This commit is contained in:
parent
6fe5e3b849
commit
3ac1f87e12
@ -4,6 +4,9 @@ services:
|
|||||||
mssql:
|
mssql:
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/bitwarden/mssql_data:/var/opt/mssql/data
|
- /etc/bitwarden/mssql_data:/var/opt/mssql/data
|
||||||
|
env_file:
|
||||||
|
- mssql.env
|
||||||
|
- /etc/bitwarden/docker/mssql.override.env
|
||||||
web:
|
web:
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/bitwarden/web:/etc/bitwarden/web
|
- /etc/bitwarden/web:/etc/bitwarden/web
|
||||||
@ -13,10 +16,16 @@ services:
|
|||||||
api:
|
api:
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/bitwarden/core:/etc/bitwarden/core
|
- /etc/bitwarden/core:/etc/bitwarden/core
|
||||||
|
env_file:
|
||||||
|
- global.env
|
||||||
|
- /etc/bitwarden/docker/global.override.env
|
||||||
identity:
|
identity:
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/bitwarden/identity:/etc/bitwarden/identity
|
- /etc/bitwarden/identity:/etc/bitwarden/identity
|
||||||
- /etc/bitwarden/core:/etc/bitwarden/core
|
- /etc/bitwarden/core:/etc/bitwarden/core
|
||||||
|
env_file:
|
||||||
|
- global.env
|
||||||
|
- /etc/bitwarden/docker/global.override.env
|
||||||
nginx:
|
nginx:
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/bitwarden/nginx:/etc/bitwarden/nginx
|
- /etc/bitwarden/nginx:/etc/bitwarden/nginx
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
mssql:
|
|
||||||
volumes:
|
|
||||||
- mssql_data:/var/opt/mssql/data
|
|
||||||
web:
|
|
||||||
volumes:
|
|
||||||
- c:/bitwarden/web:/etc/bitwarden/web
|
|
||||||
attachments:
|
|
||||||
volumes:
|
|
||||||
- c:/bitwarden/core/attachments:/etc/bitwarden/core/attachments
|
|
||||||
api:
|
|
||||||
volumes:
|
|
||||||
- c:/bitwarden/core:/etc/bitwarden/core
|
|
||||||
identity:
|
|
||||||
volumes:
|
|
||||||
- c:/bitwarden/identity:/etc/bitwarden/identity
|
|
||||||
- c:/bitwarden/core:/etc/bitwarden/core
|
|
||||||
nginx:
|
|
||||||
volumes:
|
|
||||||
- c:/bitwarden/nginx:/etc/bitwarden/nginx
|
|
||||||
- c:/bitwarden/letsencrypt:/etc/letsencrypt
|
|
||||||
- c:/bitwarden/ssl:/etc/ssl
|
|
||||||
volumes:
|
|
||||||
mssql_data:
|
|
@ -4,6 +4,9 @@ services:
|
|||||||
mssql:
|
mssql:
|
||||||
volumes:
|
volumes:
|
||||||
- mssql_data:/var/opt/mssql/data
|
- mssql_data:/var/opt/mssql/data
|
||||||
|
env_file:
|
||||||
|
- mssql.env
|
||||||
|
- c:/bitwarden/docker/mssql.override.env
|
||||||
web:
|
web:
|
||||||
volumes:
|
volumes:
|
||||||
- c:/bitwarden/web:/etc/bitwarden/web
|
- c:/bitwarden/web:/etc/bitwarden/web
|
||||||
@ -13,10 +16,16 @@ services:
|
|||||||
api:
|
api:
|
||||||
volumes:
|
volumes:
|
||||||
- c:/bitwarden/core:/etc/bitwarden/core
|
- c:/bitwarden/core:/etc/bitwarden/core
|
||||||
|
env_file:
|
||||||
|
- global.env
|
||||||
|
- c:/bitwarden/docker/global.override.env
|
||||||
identity:
|
identity:
|
||||||
volumes:
|
volumes:
|
||||||
- c:/bitwarden/identity:/etc/bitwarden/identity
|
- c:/bitwarden/identity:/etc/bitwarden/identity
|
||||||
- c:/bitwarden/core:/etc/bitwarden/core
|
- c:/bitwarden/core:/etc/bitwarden/core
|
||||||
|
env_file:
|
||||||
|
- global.env
|
||||||
|
- c:/bitwarden/docker/global.override.env
|
||||||
nginx:
|
nginx:
|
||||||
volumes:
|
volumes:
|
||||||
- c:/bitwarden/nginx:/etc/bitwarden/nginx
|
- c:/bitwarden/nginx:/etc/bitwarden/nginx
|
||||||
|
@ -7,7 +7,6 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- mssql.env
|
- mssql.env
|
||||||
- mssql.override.env
|
|
||||||
ports:
|
ports:
|
||||||
- '1433:1433'
|
- '1433:1433'
|
||||||
|
|
||||||
@ -27,14 +26,12 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- global.env
|
- global.env
|
||||||
- global.override.env
|
|
||||||
|
|
||||||
identity:
|
identity:
|
||||||
image: bitwarden/identity
|
image: bitwarden/identity
|
||||||
container_name: identity
|
container_name: identity
|
||||||
env_file:
|
env_file:
|
||||||
- global.env
|
- global.env
|
||||||
- global.override.env
|
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: bitwarden/nginx
|
image: bitwarden/nginx
|
||||||
|
@ -20,9 +20,9 @@ if($letsEncrypt -eq "y") {
|
|||||||
if(!(Test-Path -Path $letsEncryptPath )){
|
if(!(Test-Path -Path $letsEncryptPath )){
|
||||||
New-Item -ItemType directory -Path $letsEncryptPath
|
New-Item -ItemType directory -Path $letsEncryptPath
|
||||||
}
|
}
|
||||||
docker run -it --rm -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $email --agree-tos -d $domain
|
docker run -it --rm --name letsencrypt -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $email --agree-tos -d $domain
|
||||||
}
|
}
|
||||||
|
|
||||||
docker run -it --rm -v ${outputDir}:/bitwarden bitwarden/setup dotnet Setup.dll -domain ${domain} -letsencrypt ${letsEncrypt} -db_pass ${databasePassword}
|
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup dotnet Setup.dll -domain ${domain} -letsencrypt ${letsEncrypt} -db_pass ${databasePassword}
|
||||||
|
|
||||||
echo "Setup complete"
|
echo "Setup complete"
|
||||||
|
@ -35,7 +35,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("register")]
|
[HttpPost("register")]
|
||||||
public async Task PostRegister(PushRegistrationRequestModel model)
|
public async Task PostRegister([FromBody]PushRegistrationRequestModel model)
|
||||||
{
|
{
|
||||||
CheckUsage();
|
CheckUsage();
|
||||||
await _pushRegistrationService.CreateOrUpdateRegistrationAsync(model.PushToken, Prefix(model.DeviceId),
|
await _pushRegistrationService.CreateOrUpdateRegistrationAsync(model.PushToken, Prefix(model.DeviceId),
|
||||||
@ -50,7 +50,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("add-organization")]
|
[HttpPut("add-organization")]
|
||||||
public async Task PutAddOrganization(PushUpdateRequestModel model)
|
public async Task PutAddOrganization([FromBody]PushUpdateRequestModel model)
|
||||||
{
|
{
|
||||||
CheckUsage();
|
CheckUsage();
|
||||||
await _pushRegistrationService.AddUserRegistrationOrganizationAsync(
|
await _pushRegistrationService.AddUserRegistrationOrganizationAsync(
|
||||||
@ -58,7 +58,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("delete-organization")]
|
[HttpPut("delete-organization")]
|
||||||
public async Task PutDeleteOrganization(PushUpdateRequestModel model)
|
public async Task PutDeleteOrganization([FromBody]PushUpdateRequestModel model)
|
||||||
{
|
{
|
||||||
CheckUsage();
|
CheckUsage();
|
||||||
await _pushRegistrationService.DeleteUserRegistrationOrganizationAsync(
|
await _pushRegistrationService.DeleteUserRegistrationOrganizationAsync(
|
||||||
@ -66,13 +66,13 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("send")]
|
[HttpPost("send")]
|
||||||
public async Task PostSend(PushSendRequestModel model)
|
public async Task PostSend([FromBody]PushSendRequestModel model)
|
||||||
{
|
{
|
||||||
CheckUsage();
|
CheckUsage();
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(model.UserId))
|
if(!string.IsNullOrWhiteSpace(model.UserId))
|
||||||
{
|
{
|
||||||
await _pushNotificationService.SendPayloadToUserAsync(Prefix(model.OrganizationId),
|
await _pushNotificationService.SendPayloadToUserAsync(Prefix(model.UserId),
|
||||||
model.Type.Value, model.Payload, Prefix(model.Identifier));
|
model.Type.Value, model.Payload, Prefix(model.Identifier));
|
||||||
}
|
}
|
||||||
else if(!string.IsNullOrWhiteSpace(model.OrganizationId))
|
else if(!string.IsNullOrWhiteSpace(model.OrganizationId))
|
||||||
|
@ -7,6 +7,7 @@ using System;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Bit.Core.Services
|
namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
@ -24,11 +25,13 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
BaseAddress = new Uri(globalSettings.PushRelayBaseUri)
|
BaseAddress = new Uri(globalSettings.PushRelayBaseUri)
|
||||||
};
|
};
|
||||||
|
PushClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
|
|
||||||
IdentityClient = new HttpClient
|
IdentityClient = new HttpClient
|
||||||
{
|
{
|
||||||
BaseAddress = new Uri(globalSettings.Installation.IdentityUri)
|
BaseAddress = new Uri(globalSettings.Installation.IdentityUri)
|
||||||
};
|
};
|
||||||
|
IdentityClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpClient PushClient { get; private set; }
|
protected HttpClient PushClient { get; private set; }
|
||||||
@ -52,7 +55,7 @@ namespace Bit.Core.Services
|
|||||||
var requestMessage = new HttpRequestMessage
|
var requestMessage = new HttpRequestMessage
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
RequestUri = new Uri(IdentityClient.BaseAddress, "connect/token"),
|
RequestUri = new Uri(string.Concat(IdentityClient.BaseAddress, "/connect/token")),
|
||||||
Content = new FormUrlEncodedContent(new Dictionary<string, string>
|
Content = new FormUrlEncodedContent(new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "grant_type", "client_credentials" },
|
{ "grant_type", "client_credentials" },
|
||||||
|
@ -165,7 +165,7 @@ namespace Bit.Core.Services
|
|||||||
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
RequestUri = new Uri(PushClient.BaseAddress, "send")
|
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/send"))
|
||||||
};
|
};
|
||||||
await PushClient.SendAsync(message);
|
await PushClient.SendAsync(message);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace Bit.Core.Services
|
|||||||
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
RequestUri = new Uri(PushClient.BaseAddress, "register")
|
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/register"))
|
||||||
};
|
};
|
||||||
await PushClient.SendAsync(message);
|
await PushClient.SendAsync(message);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ namespace Bit.Core.Services
|
|||||||
var message = new TokenHttpRequestMessage(AccessToken)
|
var message = new TokenHttpRequestMessage(AccessToken)
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Delete,
|
Method = HttpMethod.Delete,
|
||||||
RequestUri = new Uri(PushClient.BaseAddress, deviceId)
|
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/", deviceId))
|
||||||
};
|
};
|
||||||
await PushClient.SendAsync(message);
|
await PushClient.SendAsync(message);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ namespace Bit.Core.Services
|
|||||||
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Put,
|
Method = HttpMethod.Put,
|
||||||
RequestUri = new Uri(PushClient.BaseAddress, "add-organization")
|
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/add-organization"))
|
||||||
};
|
};
|
||||||
await PushClient.SendAsync(message);
|
await PushClient.SendAsync(message);
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ namespace Bit.Core.Services
|
|||||||
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
|
||||||
{
|
{
|
||||||
Method = HttpMethod.Put,
|
Method = HttpMethod.Put,
|
||||||
RequestUri = new Uri(PushClient.BaseAddress, "delete-organization")
|
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/delete-organization"))
|
||||||
};
|
};
|
||||||
await PushClient.SendAsync(message);
|
await PushClient.SendAsync(message);
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ namespace Setup
|
|||||||
_url = _ssl ? $"https://{_domain}" : $"http://{_domain}";
|
_url = _ssl ? $"https://{_domain}" : $"http://{_domain}";
|
||||||
BuildNginxConfig();
|
BuildNginxConfig();
|
||||||
|
|
||||||
Console.Write("Installation ID: ");
|
Console.Write("Installation id (get it at https://bitwarden.com/host/): ");
|
||||||
_installationId = Console.ReadLine().ToLowerInvariant();
|
_installationId = Console.ReadLine().ToLowerInvariant();
|
||||||
Console.Write("Installation key: ");
|
Console.Write("Installation key (get it at https://bitwarden.com/host/): ");
|
||||||
_installationKey = Console.ReadLine().ToLowerInvariant();
|
_installationKey = Console.ReadLine().ToLowerInvariant();
|
||||||
Console.Write("Do you want to use push notifications? (y/n): ");
|
Console.Write("Do you want to use push notifications? (y/n): ");
|
||||||
_push = Console.ReadLine().ToLowerInvariant() == "y";
|
_push = Console.ReadLine().ToLowerInvariant() == "y";
|
||||||
@ -272,7 +272,7 @@ globalSettings:attachment:baseUrl={_url}/attachments
|
|||||||
globalSettings:dataProtection:directory={_outputDir}/core/aspnet-dataprotection
|
globalSettings:dataProtection:directory={_outputDir}/core/aspnet-dataprotection
|
||||||
globalSettings:logDirectory={_outputDir}/core/logs
|
globalSettings:logDirectory={_outputDir}/core/logs
|
||||||
globalSettings:licenseDirectory={_outputDir}/core/licenses
|
globalSettings:licenseDirectory={_outputDir}/core/licenses
|
||||||
globalSettings:duo:aKey={Helpers.SecureRandomString(32, alpha: true, numeric: true)}
|
globalSettings:duo:aKey={Helpers.SecureRandomString(64, alpha: true, numeric: true)}
|
||||||
globalSettings:installation:id={_installationId}
|
globalSettings:installation:id={_installationId}
|
||||||
globalSettings:installation:key={_installationKey}
|
globalSettings:installation:key={_installationKey}
|
||||||
globalSettings:yubico:clientId=REPLACE
|
globalSettings:yubico:clientId=REPLACE
|
||||||
@ -280,7 +280,8 @@ globalSettings:yubico:key=REPLACE");
|
|||||||
|
|
||||||
if(!_push)
|
if(!_push)
|
||||||
{
|
{
|
||||||
sw.Write("globalSettings:pushRelayBaseUri=REPLACE");
|
sw.Write(@"
|
||||||
|
globalSettings:pushRelayBaseUri=REPLACE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user