Compare commits

...

50 Commits
master ... test

Author SHA1 Message Date
unknown 4a86cb563d update email again:
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2024-10-28 22:50:29 -06:00
unknown cb9425b627 update email
continuous-integration/drone/push Build is passing Details
2024-10-28 22:35:15 -06:00
Dan b5fa0e62f9 update environment for email sender
continuous-integration/drone Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-10 16:18:57 -06:00
Dan 6ebb32306f update production email address for missionary forms
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-01 14:09:36 -06:00
Dan c51bdf1221 Convert string to enum and string to boolean
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is failing Details
2023-08-01 14:06:08 -06:00
Dan e40fe7e37f update cors
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-01 12:06:03 -06:00
Dan 2f7e600372 update missionary email address
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-01 11:56:37 -06:00
Dan 1123dd83bc update email sender credentials
continuous-integration/drone/push Build is passing Details
2023-08-01 11:54:27 -06:00
Dan 17d56d3435 move pipelines into steps so they don't run in paralell
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-01 11:33:27 -06:00
Dan 81ae8fa297 update drone.io
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-01 11:23:18 -06:00
Dan b31fd4c945 Add docker sock to build step
continuous-integration/drone/push Build is failing Details
2023-08-01 11:12:00 -06:00
Dan db35563e6f Add promotions in drone.io"
continuous-integration/drone/push Build is failing Details
2023-08-01 11:10:09 -06:00
Dan 9693fb92d5 update environment
continuous-integration/drone/push Build is passing Details
2023-08-01 10:58:25 -06:00
Dan 3c86ac190c Update to .net core 7
continuous-integration/drone/push Build is passing Details
2023-08-01 10:40:57 -06:00
Dan 8c04849be2 Change default network for api
continuous-integration/drone/push Build is passing Details
2023-07-31 09:27:25 -06:00
Dan d0ad5fa52c connect api to proxy network in docker
continuous-integration/drone/push Build is passing Details
2023-07-31 09:18:03 -06:00
Dan cdba94de2b Update database
continuous-integration/drone/push Build is passing Details
2023-07-31 09:13:54 -06:00
Dan 9e781af82b Update deployment
continuous-integration/drone Build is passing Details
2023-07-31 09:04:22 -06:00
dan ef6c38189b update db u and p 2020-10-31 00:43:59 -06:00
dan 5c56db2625 Change port number 2020-10-31 00:37:44 -06:00
dan e9c12acfbe run detached 2020-10-30 22:46:39 -06:00
dan b958d04bc5 Test 2020-10-30 22:40:45 -06:00
dan d10d402779 Test 2020-10-30 22:39:04 -06:00
dan 590cae684d Test 2020-10-30 22:36:14 -06:00
dan 28c07b3afe Another test 2020-10-30 22:35:02 -06:00
dan 29b15d38c7 Test 2020-10-30 22:34:10 -06:00
dan b8de599a11 test 2020-10-30 22:07:07 -06:00
dan 463e38cbaf Another test 2020-10-30 22:05:58 -06:00
dan 56310a4d99 Test 2020-10-30 22:05:07 -06:00
dan ea77183b7a Another Test 2020-10-30 21:59:57 -06:00
dan eb481285b5 Secret test 2020-10-30 21:58:27 -06:00
dan 4eeda7392e Test 2020-10-30 21:57:05 -06:00
dan befb1111ac docker test 2020-10-30 21:55:31 -06:00
dan b434524dd0 drone test 2020-10-30 21:54:28 -06:00
dan b51eb5c962 docker test 2020-10-30 21:53:35 -06:00
dan 510378e0e5 docker env setup 2020-10-30 21:45:21 -06:00
dan f377ee6c98 docker env 2020-10-30 21:44:18 -06:00
dan 5a4a08b16e docker test 2020-10-30 21:42:13 -06:00
dan f175611a2c docker args 2020-10-30 21:39:53 -06:00
dan 4aa8be56b1 drone arg 2020-10-30 21:38:25 -06:00
dan 358c816300 drone arg 2020-10-30 21:37:17 -06:00
dan 302c1366a1 pass connection string to container with drone pass 2020-10-30 21:34:22 -06:00
dan fbd56d4e33 Db_connection_string 2020-10-30 20:49:18 -06:00
dan 1d47da55c7 move port to arg 2020-10-30 19:42:44 -06:00
dan b8f77ecdf2 docker updates 2020-10-30 19:35:45 -06:00
dan fef20cbfc9 Fix name issue 2020-10-30 19:32:30 -06:00
dan d517d883a8 restore each project independantly 2020-10-30 19:31:25 -06:00
dan ad9687083b ls 2020-10-30 19:21:25 -06:00
dan 75c2e530e0 csproj test 2020-10-30 19:20:33 -06:00
dan 0fadf3bc21 add drone and docker files 2020-10-30 19:16:06 -06:00
22 changed files with 272 additions and 313 deletions

2
.dockerignore 100644
View File

@ -0,0 +1,2 @@
bin/
obj/

3
.vscode/settings.json vendored 100644
View File

@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "OFBButte.sln"
}

View File

@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using OFBButte.Application.Configuration;
using OFBButte.Application.Database;
using OFBButte.Application.Email;
using OFBButte.Application.Missionary;
using OFBButte.Entities;
namespace OFBButte.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class MissionaryController : ControllerBase
{
private readonly AppSettings appSettings;
private readonly IOFBContext context;
private readonly IEmailSender emailSender;
public MissionaryController(IOptions<AppSettings> options, IOFBContext context, IEmailSender emailSender)
{
this.appSettings = options.Value;
this.context = context;
this.emailSender = emailSender;
}
[HttpPost]
public async Task<ActionResult<MissionarySupport>> Post([FromBody] MissionarySupport value)
{
var adder = new AddAndSendMissionaryForm(context, emailSender);
var result = await adder.Handle(value, appSettings.MissionaryEmailAddress);
return result;
}
[HttpGet("{id}")]
public ActionResult<MissionarySupport> Get(int id)
{
throw new NotImplementedException();
var getter = new GetMissionarySupportForm(context);
var result = getter.Handle(id);
return result;
}
}
}

View File

@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using OFBButte.Application.Configuration;
namespace OFBButte.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
private readonly AppSettings appSettings;
public ValuesController(IOptions<AppSettings> options)
{
this.appSettings = options.Value;
}
// GET api/values
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
return new string[] { "value1 updated", "value2", appSettings.Environment };
}
// GET api/values/5
[HttpGet("{id}")]
public ActionResult<string> Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

View File

@ -0,0 +1,23 @@
using System.Text.Json;
using System.Text.Json.Serialization;
public class JsonStringBooleanConverter : JsonConverter<bool>
{
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var val = reader.GetString();
if (val == "true")
return true;
if (val == "false")
return false;
throw new Exception($"Cannot convert {val} to boolean");
}
public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
{
writer.WriteBooleanValue(value);
}
}

View File

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using OFBButte.Application.Configuration;
using OFBButte.Application.Database;
using OFBButte.Application.Email;
using OFBButte.Application.Missionary;
using OFBButte.Entities;
public static class MissionaryRoutes
{
public static WebApplication MapMissionaryRoutes(this WebApplication app)
{
app.MapGet("/missionary/{id}", GetMissionarySupport);
app.MapPost("/missionary", PostMissionarySupport);
return app;
}
public static MissionarySupport GetMissionarySupport(int id)
{
return new MissionarySupport(){
Id = id
};
}
public static async Task<MissionarySupport> PostMissionarySupport([FromBody] MissionarySupport value, AppSettings appSettings, IOFBContext context, IEmailSender emailSender)
{
var adder = new AddAndSendMissionaryForm(context, emailSender);
var result = await adder.Handle(value, appSettings.MissionaryEmailAddress);
return result;
}
}

View File

@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@ -15,12 +16,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OFBButte.Application\OFBButte.Application.csproj" />
<ProjectReference Include="..\OFBButte.Database\OFBButte.Database.csproj" />

View File

@ -1,54 +1,56 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.Extensions.Options;
using OFBButte.Application.Configuration;
using OFBButte.Application.Database;
using OFBButte.Application.Email;
using OFBButte.Database;
using OFBButte.Infrastructure.Email;
namespace OFBButte.Api
var builder = WebApplication.CreateBuilder(args);
string CorsPolicy = "OFBCorsPolicy";
builder.Services.AddCors(options =>
{
public class Program
options.AddPolicy(CorsPolicy, policy =>
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args, false).Run();
}
/// <summary>
/// This method is for entity framework
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public static IWebHost BuildWebHost(string[] args)
{
return CreateWebHostBuilder(args, true);
}
public static IWebHost CreateWebHostBuilder(string[] args, bool fromEF)
{
var hostBuilder = WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
policy.WithOrigins("http://localhost:4200", "https://test.ofbbutte.com", "https://ofbbutte.com")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
if (args.Length >= 1)
{
hostBuilder.UseUrls($"http://localhost:{args[0]}");
}
builder.Services.ConfigureHttpJsonOptions(options => {
options.SerializerOptions.Converters.Add(new JsonStringEnumConverter());
options.SerializerOptions.Converters.Add(new JsonStringBooleanConverter());
});
var host = hostBuilder.Build();
// App Settings
var appSettings = builder.Configuration.GetSection("App").Get<AppSettings>();
builder.Services.AddSingleton(appSettings);
if (fromEF)
return host;
// DB Context
builder.Services.AddDbContext<OFBContext>(o =>
{
OFBContext.UseMySql(o, builder.Configuration.GetConnectionString("OFBContext"));
});
builder.Services.AddScoped<IOFBContext, OFBContext>(s => s.GetService<OFBContext>());
using (var scope = host.Services.CreateScope())
{
var db = scope.ServiceProvider.GetService<Database.OFBContext>();
db.Database.Migrate();
}
// Email Service
builder.Services.AddScoped<IEmailSender, EmailSender>(s =>
{
return new EmailSender(appSettings.Environment != "Prod");
});
return host;
}
}
}
var app = builder.Build();
app.UseCors(CorsPolicy);
app.MapGet("/", () => $"OFB API - {app.Environment.EnvironmentName} - {appSettings.Environment}");
app.MapMissionaryRoutes();
app.Run();

View File

@ -1,30 +1,37 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50405",
"applicationUrl": "http://localhost:49131",
"sslPort": 44314
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "http://localhost:5030",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OFBButte.Api": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:7214;http://localhost:5030",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}

View File

@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OFBButte.Application.Configuration;
using OFBButte.Application.Database;
using OFBButte.Application.Email;
using OFBButte.Database;
using OFBButte.Infrastructure.Email;
namespace OFBButte.Api
{
public class Startup
{
private readonly string CorsPolicy = "OFBCorsPolicy";
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// CORS - This needs to be before services.AddMvc
services.AddCors(options =>
{
options.AddPolicy(CorsPolicy, policy =>
{
policy.WithOrigins("http://localhost:4200", "https://test.ofbbutte.com", "https://ofbbutte.com")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
// App Settings
services.Configure<AppSettings>(Configuration.GetSection("App"));
// DB Context
services.AddDbContext<OFBContext>(o =>
{
OFBContext.UseMySql(o, Configuration.GetConnectionString("OFBContext"));
});
services.AddScoped<IOFBContext, OFBContext>(s => s.GetService<OFBContext>());
// Email Service
services.AddScoped<IEmailSender, EmailSender>(s =>
{
var options = s.GetService<IOptions<AppSettings>>();
return new EmailSender(options.Value.Environment != "Prod");
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseCors(CorsPolicy);
app.UseHttpsRedirection();
app.UseMvc();
}
}
}

View File

@ -1,9 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"App": {
@ -11,6 +10,6 @@
"MissionaryEmailAddress": "admin@oldfashionbaptistbutte.com"
},
"ConnectionStrings": {
"OFBContext": "server=localhost;database=ofb2_test;user=ofbapi2_test;password=Look to the LORD and his strength seek his face always"
"OFBContext": "server=localhost;database=ofb_missionary;user=admin_ofbbutte;password=87hjdusiodksyeunsjkdis7"
}
}

View File

@ -1,9 +1,10 @@
{
"App": {
"Environment": "Prod",
"MissionaryEmailAddress": "contact@oldfashionbaptistbutte.com"
},
"ConnectionStrings": {
"OFBContext": "server=localhost;database=ofb2;user=ofbapi2;password={{db_pass}};"
"App": {
"Environment": "Prod",
"MissionaryEmailAddress": "mail@ofbbutte.com"
},
"ConnectionStrings": {
"OFBContext": "server=localhost;database=admin_ofb_missionary;user=admin_ofbbutte;password={{dbpass}};"
}
}
}

View File

@ -2,8 +2,7 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",

View File

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
</ItemGroup>
<ItemGroup>

View File

@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -15,7 +15,7 @@ namespace OFBButte.Database
public static void UseMySql(DbContextOptionsBuilder optionsBuilder, string connString)
{
optionsBuilder.UseMySql(connString);
optionsBuilder.UseMySql(connString, ServerVersion.AutoDetect(connString));
}
public DbSet<User> Users { get; set; }

View File

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -23,15 +23,15 @@ namespace OFBButte.Infrastructure.Email
{
message.SetBodyFromTemplate(isTest);
var mm = new MimeMessage();
mm.From.Add(new MailboxAddress(message.From));
mm.To.Add(new MailboxAddress(message.To));
mm.From.Add(new MailboxAddress(message.From, message.From));
mm.To.Add(new MailboxAddress(message.To, message.To));
mm.Subject = message.Subject;
var bodyBuilder = new BodyBuilder();
bodyBuilder.HtmlBody = message.Body;
mm.Body = bodyBuilder.ToMessageBody();
client.Connect("smtp.webfaction.com", 465, true);
client.Authenticate("ofbcontact", "2014OfbPwd");
client.Connect("smtp.ionos.com", 587, false);
client.Authenticate("mail@ofbbutte.com", "@2014OfbPwd");
await client.SendAsync(mm);
client.Disconnect(true);
}

View File

@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.2.0" />
<PackageReference Include="MailKit" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.9" />
</ItemGroup>
<ItemGroup>

View File

@ -1,19 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Api", "OFBButte.Api\OFBButte.Api.csproj", "{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Api", "OFBButte.Api\OFBButte.Api.csproj", "{57949138-1831-4BEB-B89A-66C5034CCFF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Application", "OFBButte.Application\OFBButte.Application.csproj", "{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Application", "OFBButte.Application\OFBButte.Application.csproj", "{86647588-E6F1-4D24-98FB-F98ED02BF3CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Console", "OFBButte.Console\OFBButte.Console.csproj", "{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Database", "OFBButte.Database\OFBButte.Database.csproj", "{4BE1B263-6D9F-4ACC-8FA9-1AA2165BCCB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Database", "OFBButte.Database\OFBButte.Database.csproj", "{64A05F44-4BB2-45CE-A343-6307EA8F099A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Entities", "OFBButte.Entities\OFBButte.Entities.csproj", "{9FF67157-2D1C-4B6C-9C9C-90067875E931}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Infrastructure", "OFBButte.Infrastructure\OFBButte.Infrastructure.csproj", "{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Entities", "OFBButte.Entities\OFBButte.Entities.csproj", "{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Infrastructure", "OFBButte.Infrastructure\OFBButte.Infrastructure.csproj", "{E7B66D8A-3431-4FD3-84A5-8037A2A5404C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,35 +19,31 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}.Release|Any CPU.Build.0 = Release|Any CPU
{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}.Release|Any CPU.Build.0 = Release|Any CPU
{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}.Release|Any CPU.Build.0 = Release|Any CPU
{64A05F44-4BB2-45CE-A343-6307EA8F099A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64A05F44-4BB2-45CE-A343-6307EA8F099A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64A05F44-4BB2-45CE-A343-6307EA8F099A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64A05F44-4BB2-45CE-A343-6307EA8F099A}.Release|Any CPU.Build.0 = Release|Any CPU
{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}.Debug|Any CPU.Build.0 = Debug|Any CPU
{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}.Release|Any CPU.ActiveCfg = Release|Any CPU
{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}.Release|Any CPU.Build.0 = Release|Any CPU
{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}.Release|Any CPU.Build.0 = Release|Any CPU
{57949138-1831-4BEB-B89A-66C5034CCFF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57949138-1831-4BEB-B89A-66C5034CCFF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57949138-1831-4BEB-B89A-66C5034CCFF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57949138-1831-4BEB-B89A-66C5034CCFF5}.Release|Any CPU.Build.0 = Release|Any CPU
{86647588-E6F1-4D24-98FB-F98ED02BF3CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86647588-E6F1-4D24-98FB-F98ED02BF3CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86647588-E6F1-4D24-98FB-F98ED02BF3CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86647588-E6F1-4D24-98FB-F98ED02BF3CB}.Release|Any CPU.Build.0 = Release|Any CPU
{4BE1B263-6D9F-4ACC-8FA9-1AA2165BCCB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BE1B263-6D9F-4ACC-8FA9-1AA2165BCCB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BE1B263-6D9F-4ACC-8FA9-1AA2165BCCB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BE1B263-6D9F-4ACC-8FA9-1AA2165BCCB3}.Release|Any CPU.Build.0 = Release|Any CPU
{9FF67157-2D1C-4B6C-9C9C-90067875E931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FF67157-2D1C-4B6C-9C9C-90067875E931}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FF67157-2D1C-4B6C-9C9C-90067875E931}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FF67157-2D1C-4B6C-9C9C-90067875E931}.Release|Any CPU.Build.0 = Release|Any CPU
{E7B66D8A-3431-4FD3-84A5-8037A2A5404C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7B66D8A-3431-4FD3-84A5-8037A2A5404C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7B66D8A-3431-4FD3-84A5-8037A2A5404C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7B66D8A-3431-4FD3-84A5-8037A2A5404C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD719D07-AABB-44D8-84CD-705EDF224EB9}
SolutionGuid = {CFE73C56-C2A6-4CC4-8F7A-2AC6843F160C}
EndGlobalSection
EndGlobal

40
dockerfile 100644
View File

@ -0,0 +1,40 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /app
# API Restore
WORKDIR /app/OFBButte.Api
COPY OFBButte.Api/*.csproj ./
RUN dotnet restore
# Application Restore
WORKDIR /app/OFBButte.Application
COPY OFBButte.Application/*.csproj ./
RUN dotnet restore
# Database Restore
WORKDIR /app/OFBButte.Database
COPY OFBButte.Database/*.csproj ./
RUN dotnet restore
# Entities Restore
WORKDIR /app/OFBButte.Entities
COPY OFBButte.Entities/*.csproj ./
RUN dotnet restore
# Infrastructure Restore
WORKDIR /app/OFBButte.Infrastructure
COPY OFBButte.Infrastructure/*.csproj ./
RUN dotnet restore
# Copy everything else and build
WORKDIR /app
COPY . ./
WORKDIR /app/OFBButte.Api
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=build-env /app/OFBButte.Api/out .
ENTRYPOINT ["dotnet", "OFBButte.Api.dll"]

41
drone.yml 100644
View File

@ -0,0 +1,41 @@
kind: pipeline
type: docker
name: build-deploy
steps:
- name: build
image: docker
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker build --tag ofb_api .
- name: deploy_test
image: docker
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker rm -f ofb_api_test || true
- docker run --name ofb_api_test --network=proxy --restart always -d -e ASPNETCORE_ENVIRONMENT="Development" -e ConnectionStrings__OFBContext="server=mysql;database=ofb_missionary;user=admin_ofbbutte;password=87hjdusiodksyeunsjkdis7;" ofb_api
- docker network connect mysql ofb_api_test
- name: deploy_prod
image: docker
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker rm -f ofb_api || true
- docker run --name ofb_api --network=proxy --restart always -d -e ASPNETCORE_ENVIRONMENT="Production" -e ConnectionStrings__OFBContext="server=mysql;database=ofb_missionary;user=admin_ofbbutte;password=87hjdusiodksyeunsjkdis7;" ofb_api
- docker network connect mysql ofb_api
when:
event:
- promote
target:
- production
volumes:
- name: docker_sock
host:
path: /var/run/docker.sock