Skip to content

Commit

Permalink
Merge pull request #2 from cihant/feature/cihant/docker-compose-support
Browse files Browse the repository at this point in the history
Feature/cihant/docker compose support
  • Loading branch information
cihant authored May 9, 2022
2 parents 638ea57 + 33cb98e commit 8b5409b
Show file tree
Hide file tree
Showing 58 changed files with 308 additions and 7,966 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,7 @@ src/Modules/**/launchSettings.json
PublishProfiles/
logs/
src/Modules/**/wwwroot/admin/*.min.js
.vscode
.vscode

**/data/*
**/logs/*
16 changes: 15 additions & 1 deletion SimplCommerce.sln
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Module.Paymen
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Db.MsSql", "src\SimplCommerce.Db.MsSql\SimplCommerce.Db.MsSql.csproj", "{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplCommerce.Db.PgSql", "src\SimplCommerce.Db.PgSql\SimplCommerce.Db.PgSql.csproj", "{61985132-75C9-4601-9030-6E2B76781E0F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Db.PgSql", "src\SimplCommerce.Db.PgSql\SimplCommerce.Db.PgSql.csproj", "{61985132-75C9-4601-9030-6E2B76781E0F}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker\docker-compose.dcproj", "{59ACBE78-9B5D-4386-8291-253898925E48}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -724,6 +726,18 @@ Global
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x64.Build.0 = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x86.ActiveCfg = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x86.Build.0 = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|x64.ActiveCfg = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|x64.Build.0 = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|x86.ActiveCfg = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Debug|x86.Build.0 = Debug|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|Any CPU.Build.0 = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|x64.ActiveCfg = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|x64.Build.0 = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|x86.ActiveCfg = Release|Any CPU
{59ACBE78-9B5D-4386-8291-253898925E48}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 8 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ASPNETCORE_ENVIRONMENT=Development

VOLUMES_BASEPATH=./storage

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres

3 changes: 3 additions & 0 deletions docker/create_docker_folders.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
md docker\storage
md docker\storage\postgres
md docker\storage\postgres\data
3 changes: 3 additions & 0 deletions docker/create_docker_folders.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mkdir -p ./docker/storage/postgres/data

chmod -R 777 ./docker/storage
55 changes: 55 additions & 0 deletions docker/docker-compose.dcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>59acbe78-9b5d-4386-8291-253898925e48</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>SimplCommerce</DockerServiceName>
<DockerComposeProjectName>SimplCommerce</DockerComposeProjectName>
</PropertyGroup>
<ItemGroup>
<None Include="..\.env" />
<None Include="..\.dockerignore" />
<None Include=".env" />
<None Include="storage\logs\nginx\access.log" />
<None Include="storage\logs\nginx\error.log" />
<None Include="storage\neo4j\conf\neo4j.conf" />
<None Include="storage\neo4j\logs\debug.log" />
<None Include="storage\nginx\certs\pm_cert.crt" />
<None Include="storage\nginx\certs\pm_cert.csr" />
<None Include="storage\nginx\certs\pm_cert.key" />
<None Include="storage\nginx\certs\RootCA.crt" />
<None Include="storage\nginx\certs\RootCA.key" />
<None Include="storage\nginx\certs\RootCA.pem" />
<None Include="storage\nginx\certs\RootCA.srl" />
<None Include="storage\nginx\nginx\conf.d\default.conf" />
<None Include="storage\nginx\nginx\nginx.conf" />
<None Include="..\domains.ext" />
<None Include="create_docker_folders.bat" />
<None Include="create_docker_folders.sh" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
</ItemGroup>
<ItemGroup>
<Folder Include="storage\postgres\" />
</ItemGroup>
<ItemGroup>
<None Remove="storage\pgadmin\**" />
</ItemGroup>
<ItemGroup>
<None Remove="storage\postgres\data\**" />
</ItemGroup>
<ItemGroup>
<None Remove="storage\logs\**" />
</ItemGroup>
<ItemGroup>
<None Remove="storage\neo4j\**" />
</ItemGroup>
<ItemGroup>
<None Remove="storage\nginx\**" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions docker/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: '3.4'
29 changes: 29 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.4'

services:
simplcommerce:
build:
context: ../
dockerfile: src/SimplCommerce.WebHost/Dockerfile
environment:
ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT}
ASPNETCORE_URLS: ${ASPNETCORE_URLS:-http://+:80;https://+:443}
ConnectionStrings__DefaultConnection: Host=postgres;Database=${POSTGRES_DB};Username=${POSTGRES_USER};Password=${POSTGRES_PASSWORD};
volumes:
- ${VOLUMES_BASEPATH}/logs:/app/logs
ports:
- "5000:80"
- "5001:443"

postgres:
image: postgres:latest
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "15432:5432"
- "8085:8080"
volumes:
- ${VOLUMES_BASEPATH}/postgres/data:/var/lib/postgresql/data
4 changes: 2 additions & 2 deletions src/Database/StaticData-TR.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
INSERT [dbo].[Localization_Culture] ([Id], [Name]) VALUES ('tr-TR', N'Turkish')
GO

INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Register', N'Kayıt olmak')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Register', N'Kayıt olun')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Hello {0}!', N'Merhaba {0}!')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Log in', N'Oturum aç')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Log off', N'Oturumu Kapat')
Expand Down Expand Up @@ -197,7 +197,7 @@ INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-T
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Account Information', N'Hesap Bilgileri')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Edit', N'Düzenle')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Security', N'Güvenlik')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Create', N'yaratmak')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Create', N'Oluştur')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'External Logins', N'Harici Girişler')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Manage', N'Yönet')
INSERT [dbo].[Localization_Resource] ([CultureId], [Key], [Value]) VALUES ('tr-TR', N'Default shipping address', N'Varsayılan kargo adresi')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task Handle(EntityViewed notification, CancellationToken cancellati
EntityId = notification.EntityId,
EntityTypeId = notification.EntityTypeId,
UserId = user.Id,
CreatedOn = DateTimeOffset.Now
CreatedOn = DateTimeOffset.UtcNow
};

_activityRepository.Add(activity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ private async Task AddOrDeleteProductVariation(User loginUser, ProductForm mode
}

productLink.LinkedProduct.LatestUpdatedById = loginUser.Id;
productLink.LinkedProduct.LatestUpdatedOn = DateTimeOffset.Now;
productLink.LinkedProduct.LatestUpdatedOn = DateTimeOffset.UtcNow;
productLink.LinkedProduct.Sku = productVariationVm.Sku;
productLink.LinkedProduct.Gtin = productVariationVm.Gtin;
productLink.LinkedProduct.Price = productVariationVm.Price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public async Task<IActionResult> Post([FromBody] ProductCloneFormVm model)
newProduct.Slug = model.Slug;
newProduct.CreatedById = currentUser.Id;
newProduct.LatestUpdatedById = currentUser.Id;
newProduct.CreatedOn = DateTimeOffset.Now;
newProduct.LatestUpdatedOn = DateTimeOffset.Now;
newProduct.CreatedOn = DateTimeOffset.UtcNow;
newProduct.LatestUpdatedOn = DateTimeOffset.UtcNow;

var productPriceHistory = CreatePriceHistory(currentUser, newProduct);
newProduct.PriceHistories.Add(productPriceHistory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ProductPriceHistory : EntityBase
{
public ProductPriceHistory()
{
CreatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
}

public Product Product { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public CalculatedProductPrice CalculateProductPrice(decimal price, decimal? oldP
var percentOfSaving = 0;
var calculatedPrice = price;

if (specialPrice.HasValue && specialPriceStart < DateTimeOffset.Now && DateTimeOffset.Now < specialPriceEnd)
if (specialPrice.HasValue && specialPriceStart < DateTimeOffset.UtcNow && DateTimeOffset.UtcNow < specialPriceEnd)
{
calculatedPrice = specialPrice.Value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task<IActionResult> Put(long id, [FromBody] PageForm model)
page.MetaDescription = model.MetaDescription;
page.Body = model.Body;
page.IsPublished = model.IsPublished;
page.LatestUpdatedOn = DateTimeOffset.Now;
page.LatestUpdatedOn = DateTimeOffset.UtcNow;
page.LatestUpdatedBy = currentUser;

await _pageService.Update(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Comment : EntityBase
public Comment()
{
Status = CommentStatus.Approved;
CreatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
}

public long UserId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Contact : EntityBase
{
public Contact()
{
CreatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
}

[StringLength(450)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public async Task<IActionResult> Put(long id, [FromBody] CustomerGroupForm model
customerGroup.Name = model.Name;
customerGroup.Description = model.Description;
customerGroup.IsActive = model.IsActive;
customerGroup.LatestUpdatedOn = DateTimeOffset.Now;
customerGroup.LatestUpdatedOn = DateTimeOffset.UtcNow;

await _customerGroupRepository.SaveChangesAsync();
return Accepted();
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/SimplCommerce.Module.Core/Models/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public abstract class Content : EntityBase

protected Content()
{
CreatedOn = DateTimeOffset.Now;
LatestUpdatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
LatestUpdatedOn = DateTimeOffset.UtcNow;
}

[Required(ErrorMessage = "The {0} field is required.")]
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/SimplCommerce.Module.Core/Models/CustomerGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class CustomerGroup : EntityBase
{
public CustomerGroup()
{
CreatedOn = DateTimeOffset.Now;
LatestUpdatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
LatestUpdatedOn = DateTimeOffset.UtcNow;
}

[Required(ErrorMessage = "The {0} field is required.")]
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/SimplCommerce.Module.Core/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class User : IdentityUser<long>, IEntityWithTypedId<long>, IExtendableObj
{
public User()
{
CreatedOn = DateTimeOffset.Now;
LatestUpdatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
LatestUpdatedOn = DateTimeOffset.UtcNow;
}

public const string SettingsDataKey = "Settings";
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/SimplCommerce.Module.Core/Models/Vendor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Vendor : EntityBase
{
public Vendor()
{
CreatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
}

[Required(ErrorMessage = "The {0} field is required.")]
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/SimplCommerce.Module.Core/Models/Widget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Widget : EntityBaseWithTypedId<string>
public Widget(string id)
{
Id = id;
CreatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
}

public string Code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class WidgetInstance : EntityBase
{
public WidgetInstance()
{
CreatedOn = DateTimeOffset.Now;
LatestUpdatedOn = DateTimeOffset.Now;
CreatedOn = DateTimeOffset.UtcNow;
LatestUpdatedOn = DateTimeOffset.UtcNow;
}

[StringLength(450)]
Expand Down Expand Up @@ -45,7 +45,7 @@ public bool IsPublished
{
get
{
return PublishStart.HasValue && PublishStart.Value < DateTimeOffset.Now && (!PublishEnd.HasValue || PublishEnd.Value > DateTimeOffset.Now);
return PublishStart.HasValue && PublishStart.Value < DateTimeOffset.UtcNow && (!PublishEnd.HasValue || PublishEnd.Value > DateTimeOffset.UtcNow);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public class CurrencyService : ICurrencyService
public CurrencyService(IConfiguration config)
{
_config = config;
var currencyCulture = _config.GetValue<string>("Global.CurrencyCulture");
var currencyCulture = "tr-TR";// _config.GetValue<string>("Global.CurrencyCulture");
CurrencyCulture = new CultureInfo(currencyCulture);
}

public CultureInfo CurrencyCulture { get; }

public string FormatCurrency(decimal value)
{
var decimalPlace = _config.GetValue<int>("Global.CurrencyDecimalPlace");
var decimalPlace = 2;// _config.GetValue<int>("Global.CurrencyDecimalPlace");
return value.ToString($"C{decimalPlace}", CurrencyCulture);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public WidgetInstanceService(IRepository<WidgetInstance> widgetInstanceRepositor

public IQueryable<WidgetInstance> GetPublished()
{
var now = DateTimeOffset.Now;
var now = DateTimeOffset.UtcNow;
return _widgetInstanceRepository.Query().Where(x =>
x.PublishStart.HasValue && x.PublishStart < now
&& (!x.PublishEnd.HasValue || x.PublishEnd > now));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task UpdateStock(StockUpdateRequest stockUpdateRequest)
AdjustedQuantity = stockUpdateRequest.AdjustedQuantity,
Note = stockUpdateRequest.Note,
CreatedById = stockUpdateRequest.UserId,
CreatedOn = DateTimeOffset.Now,
CreatedOn = DateTimeOffset.UtcNow,
};

_stockHistoryRepository.Add(stockHistory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public async Task<IActionResult> Put(long id, NewsItemForm model)
newsItem.ShortContent = model.ShortContent;
newsItem.FullContent = model.FullContent;
newsItem.IsPublished = model.IsPublished;
newsItem.LatestUpdatedOn = DateTimeOffset.Now;
newsItem.LatestUpdatedOn = DateTimeOffset.UtcNow;
newsItem.LatestUpdatedBy = currentUser;

AddOrDeleteCategories(model, newsItem);
Expand Down
Loading

0 comments on commit 8b5409b

Please sign in to comment.