Answer the question
In order to leave comments, you need to log in
What file system should be used to separate the backend and frontend?
I want to spread the backend and frontend to different machines. The machines themselves are located in different DCs with different IP addresses. One Russian hosting - it will have nginx + statics, another bourgeois dzhanga + postgres for the backend.
So, for a convenient applause of media files, I want to mount a remote file system on a VM with a backend. Those. so that in the settings you can simply specify MEDIA_ROOT = /mnt/remotedrive and not add any additional libs to the project code. Thus, the file will be spilled from the backend immediately to another server.
What would you recommend to use and why? NFS, SFTP, FTP etc? Or is there some other option.
Answer the question
In order to leave comments, you need to log in
Everything is logical.
You didn't change the color of the states (over select, etc...)
WPF is not about changing the color of an element through the element's basic properties.
WPF is about styles and interface markup language (XAML)
In its basic form, styles look something like this:
<Grid>
<Grid.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type TabItem}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#FF7C0000"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Margin="0,0,-1,0">
<Grid >
<Rectangle x:Name="interactive" Opacity="0.3"/>
<ContentPresenter HorizontalAlignment="Center" Margin="12,2,12,2" x:Name="ContentSite" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100"/>
<Setter Property="Background" Value="Black" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="Selector.IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Fill" Value="Black" TargetName="interactive"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" TargetName="interactive" />
<Setter Property="Fill" Value="Black" TargetName="interactive" />
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="DarkGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type TabControl}">
<Setter Property="Background" Value="Black"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TabPanel Grid.Row="0" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/>
<Border Padding="12" Background="{TemplateBinding Background}"
Grid.Row="1" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="2">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Grid.Resources>
<TabControl Margin="10" >
<TabItem Header="Файловая система">
<TextBlock>Вкладка 1</TextBlock>
</TabItem>
<TabItem Header="Еще одна система">
<TextBlock> Вкладка 2</TextBlock>
</TabItem>
<TabItem Header="Мегасистема">
<TextBlock> Вкладка 3</TextBlock>
</TabItem>
<TabItem Header="Суперсистема" IsEnabled="False">
<TextBlock> Вкладка в дисабле</TextBlock>
</TabItem>
</TabControl>
</Grid>
There are few options, of course, NFS, but it is possible to hang yourself when accessing the file system (and for a very long time), when it (NFS) is not available, for example, due to lack of communication.
For my part, I would not do this, but would put some kind of CDN service like S3, where I would throw the files. For example minio https://www.minio.io
Here is another interesting project, not S3 a bit, but pretty cool in terms of architecture - https://github.com/chrislusf/seaweedfs
it’s not very clear why the heck is this, all the same, all requests are proxied to the backend and the files themselves will be automatically uploaded there.
Заливайте на бекенд, а дальше пусть nginx на фронте кеширует, он для этого в том числе и нужен
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question