V
V
Valentine2017-09-08 10:48:46
WPF
Valentine, 2017-09-08 10:48:46

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

6 answer(s)
C
cyber_roach, 2019-05-21
@cyber_roach

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>

In this example, I've defined styles within a Grid
. This means that all tab controls within that Grid will use this look and feel.
You can also define a style at the window level or at the application level (in App.xaml)
You can name styles (without a name = default)
Everything looks alive like this:
Accordingly, after the style is there, you can already redefine the basic properties in it as needed via Setters
This line sets the redefinition of all properties of the base style (well, or you can manually rewrite them all):
And this is to pixel-align:
In this way, you can bind a separate component inside the style with the base property:
And I added this component as an example: To show that interactive states can be implemented in any way and that the structure of the component can be different. (Somewhere in my locker I have a Tab-Control in the form of a circle (like an iron man with a radial arrangement of tabItems) using Triggers, you can do a property change reaction. I also specially made Overmouse through a multitrigger, to understand how You can also add animations here, or you can add interactive without triggers at all through VisualState, the principles are similar.
Proper use of styles makes it possible not to overload the layout of the pages, the visual, the margins, the grid is all automatically dragged, which can be seen at the very end of the code, the tabs themselves are designed to a minimum

A
Alexey Cheremisin, 2017-09-08
@vvpoloskin

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

I
Ivan, 2017-09-08
@LiguidCool

SSHFS

P
Puma Thailand, 2017-09-08
@opium

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.

C
chupasaurus, 2017-09-08
@chupasaurus

Заливайте на бекенд, а дальше пусть nginx на фронте кеширует, он для этого в том числе и нужен

Валентин, 2017-09-14
@ProFfeSsoRr

Во-первых - такие монтирования аукнутся во внештатных ситуациях. Во-вторых - nginx ведь кэшировать умеет, ну вот пусть и кэширует.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question