1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-16 01:51:21 +01:00

env files for compose. fixes to push relays

This commit is contained in:
Kyle Spearrin 2017-08-11 12:22:59 -04:00
parent 6fe5e3b849
commit 3ac1f87e12
11 changed files with 39 additions and 46 deletions

View File

@ -4,6 +4,9 @@ services:
mssql:
volumes:
- /etc/bitwarden/mssql_data:/var/opt/mssql/data
env_file:
- mssql.env
- /etc/bitwarden/docker/mssql.override.env
web:
volumes:
- /etc/bitwarden/web:/etc/bitwarden/web
@ -13,10 +16,16 @@ services:
api:
volumes:
- /etc/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- /etc/bitwarden/docker/global.override.env
identity:
volumes:
- /etc/bitwarden/identity:/etc/bitwarden/identity
- /etc/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- /etc/bitwarden/docker/global.override.env
nginx:
volumes:
- /etc/bitwarden/nginx:/etc/bitwarden/nginx

View File

@ -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:

View File

@ -4,6 +4,9 @@ services:
mssql:
volumes:
- mssql_data:/var/opt/mssql/data
env_file:
- mssql.env
- c:/bitwarden/docker/mssql.override.env
web:
volumes:
- c:/bitwarden/web:/etc/bitwarden/web
@ -13,10 +16,16 @@ services:
api:
volumes:
- c:/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- c:/bitwarden/docker/global.override.env
identity:
volumes:
- c:/bitwarden/identity:/etc/bitwarden/identity
- c:/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- c:/bitwarden/docker/global.override.env
nginx:
volumes:
- c:/bitwarden/nginx:/etc/bitwarden/nginx

View File

@ -7,7 +7,6 @@ services:
restart: always
env_file:
- mssql.env
- mssql.override.env
ports:
- '1433:1433'
@ -27,14 +26,12 @@ services:
restart: always
env_file:
- global.env
- global.override.env
identity:
image: bitwarden/identity
container_name: identity
env_file:
- global.env
- global.override.env
nginx:
image: bitwarden/nginx

View File

@ -20,9 +20,9 @@ if($letsEncrypt -eq "y") {
if(!(Test-Path -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"

View File

@ -35,7 +35,7 @@ namespace Bit.Api.Controllers
}
[HttpPost("register")]
public async Task PostRegister(PushRegistrationRequestModel model)
public async Task PostRegister([FromBody]PushRegistrationRequestModel model)
{
CheckUsage();
await _pushRegistrationService.CreateOrUpdateRegistrationAsync(model.PushToken, Prefix(model.DeviceId),
@ -50,7 +50,7 @@ namespace Bit.Api.Controllers
}
[HttpPut("add-organization")]
public async Task PutAddOrganization(PushUpdateRequestModel model)
public async Task PutAddOrganization([FromBody]PushUpdateRequestModel model)
{
CheckUsage();
await _pushRegistrationService.AddUserRegistrationOrganizationAsync(
@ -58,7 +58,7 @@ namespace Bit.Api.Controllers
}
[HttpPut("delete-organization")]
public async Task PutDeleteOrganization(PushUpdateRequestModel model)
public async Task PutDeleteOrganization([FromBody]PushUpdateRequestModel model)
{
CheckUsage();
await _pushRegistrationService.DeleteUserRegistrationOrganizationAsync(
@ -66,13 +66,13 @@ namespace Bit.Api.Controllers
}
[HttpPost("send")]
public async Task PostSend(PushSendRequestModel model)
public async Task PostSend([FromBody]PushSendRequestModel model)
{
CheckUsage();
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));
}
else if(!string.IsNullOrWhiteSpace(model.OrganizationId))

View File

@ -7,6 +7,7 @@ using System;
using Newtonsoft.Json.Linq;
using Bit.Core.Utilities;
using System.Net;
using System.Net.Http.Headers;
namespace Bit.Core.Services
{
@ -24,11 +25,13 @@ namespace Bit.Core.Services
{
BaseAddress = new Uri(globalSettings.PushRelayBaseUri)
};
PushClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
IdentityClient = new HttpClient
{
BaseAddress = new Uri(globalSettings.Installation.IdentityUri)
};
IdentityClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
protected HttpClient PushClient { get; private set; }
@ -52,7 +55,7 @@ namespace Bit.Core.Services
var requestMessage = new HttpRequestMessage
{
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>
{
{ "grant_type", "client_credentials" },

View File

@ -165,7 +165,7 @@ namespace Bit.Core.Services
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
{
Method = HttpMethod.Post,
RequestUri = new Uri(PushClient.BaseAddress, "send")
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/send"))
};
await PushClient.SendAsync(message);
}

View File

@ -38,7 +38,7 @@ namespace Bit.Core.Services
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
{
Method = HttpMethod.Post,
RequestUri = new Uri(PushClient.BaseAddress, "register")
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/register"))
};
await PushClient.SendAsync(message);
}
@ -54,7 +54,7 @@ namespace Bit.Core.Services
var message = new TokenHttpRequestMessage(AccessToken)
{
Method = HttpMethod.Delete,
RequestUri = new Uri(PushClient.BaseAddress, deviceId)
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/", deviceId))
};
await PushClient.SendAsync(message);
}
@ -76,7 +76,7 @@ namespace Bit.Core.Services
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
{
Method = HttpMethod.Put,
RequestUri = new Uri(PushClient.BaseAddress, "add-organization")
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/add-organization"))
};
await PushClient.SendAsync(message);
}
@ -98,7 +98,7 @@ namespace Bit.Core.Services
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
{
Method = HttpMethod.Put,
RequestUri = new Uri(PushClient.BaseAddress, "delete-organization")
RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/delete-organization"))
};
await PushClient.SendAsync(message);
}

View File

@ -54,9 +54,9 @@ namespace Setup
_url = _ssl ? $"https://{_domain}" : $"http://{_domain}";
BuildNginxConfig();
Console.Write("Installation ID: ");
Console.Write("Installation id (get it at https://bitwarden.com/host/): ");
_installationId = Console.ReadLine().ToLowerInvariant();
Console.Write("Installation key: ");
Console.Write("Installation key (get it at https://bitwarden.com/host/): ");
_installationKey = Console.ReadLine().ToLowerInvariant();
Console.Write("Do you want to use push notifications? (y/n): ");
_push = Console.ReadLine().ToLowerInvariant() == "y";
@ -272,7 +272,7 @@ globalSettings:attachment:baseUrl={_url}/attachments
globalSettings:dataProtection:directory={_outputDir}/core/aspnet-dataprotection
globalSettings:logDirectory={_outputDir}/core/logs
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:key={_installationKey}
globalSettings:yubico:clientId=REPLACE
@ -280,7 +280,8 @@ globalSettings:yubico:key=REPLACE");
if(!_push)
{
sw.Write("globalSettings:pushRelayBaseUri=REPLACE");
sw.Write(@"
globalSettings:pushRelayBaseUri=REPLACE");
}
}