aboutsummaryrefslogtreecommitdiff
path: root/templates/garage_key.html
blob: e1a9019d5b31534d96c16d3e48c695da70c3515c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
{{define "title"}}Profile |{{end}}

{{define "body"}}
<div class="d-flex">
    <h4>Mes identifiants</h4>
    <a class="ml-auto btn btn-link" href="/garage/website">Mes sites webs</a>
    <a class="ml-4 btn btn-info" href="/">Menu principal</a>
</div>

<ul class="nav nav-tabs" id="proto" role="tablist">
    <li class="nav-item">
        <a class="nav-link active" id="s3-tab" data-toggle="tab" href="#s3" role="tab" aria-controls="s3" aria-selected="true">S3</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="sftp-tab" data-toggle="tab" href="#sftp" role="tab" aria-controls="sftp" aria-selected="false">SFTP</a>
    </li>
</ul>

<div class="tab-content" id="protocols">
    <div class="tab-pane fade show active" id="s3" role="tabpanel" aria-labelledby="s3-tab">
        <table class="table mt-4">
            <tbody>
                <tr>
                    <th scope="row" class="col-md-2">Identifiant de clé</th>
                    <td>{{ .S3KeyInfo.AccessKeyId }}</td>
                </tr>
                <tr>
                    <th scope="row">Clé secrète</th>
		    <td><a href="#" onclick="document.getElementById('secret_key').style.display='inline'; this.style.display='none'">Cliquer pour afficher la clé secrète</a><span id="secret_key" style="display: none">{{ .S3KeyInfo.SecretAccessKey }}</span></td>
                </tr>
                <tr>
                    <th scope="row">Région</th>
                    <td>garage</td>
                </tr>
                <tr>
                    <th scope="row">Endpoint URL</th>
                    <td>https://garage.deuxfleurs.fr</td>
                </tr>
                <tr>
                    <th scope="row">Type d'URL</th>
                    <td>DNS et chemin (préférer chemin)</td>
                </tr>
                <tr>
                    <th scope="row">Signature</th>
                    <td>Version 4</td>
                </tr>
            </tbody>
        </table>

        <p>Configurer votre logiciel :</p>

        <div class="accordion" id="softconfig">
            <div class="card">
                <div class="card-header" id="awscli-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#awscli" aria-expanded="false" aria-controls="awscli">
                            awscli
                        </button>
                    </h2>
                </div>
                <div id="awscli" class="collapse" aria-labelledby="awscli-title" data-parent="#softconfig">
                    <div class="card-body">
                        <p>Créez un fichier nommé <code>~/.awsrc</code> :</p>
                        <pre>
export AWS_ACCESS_KEY_ID={{ .S3KeyInfo.AccessKeyId }}
export AWS_SECRET_ACCESS_KEY={{ .S3KeyInfo.SecretAccessKey }}
export AWS_DEFAULT_REGION='garage'

function aws { command aws --endpoint-url https://garage.deuxfleurs.fr $@ ; }
aws --version
                        </pre>
                        <p>Ensuite vous pouvez utiliser awscli :</p>
                        <pre>
source ~/.awsrc
aws s3 ls
aws s3 ls s3://my-bucket
aws s3 cp /tmp/a.txt s3://my-bucket
...
                        </pre>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header" id="minio-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#minio" aria-expanded="true" aria-controls="minio">
                            Minio CLI
                        </button>
                    </h2>
                </div>

                <div id="minio" class="collapse" aria-labelledby="minio-title" data-parent="#softconfig">
                    <div class="card-body">
                        <p>Vous pouvez configurer Minio CLI avec cette commande :</p>
                        <pre>
mc alias set \
  garage \
  https://garage.deuxfleurs.fr \
  {{ .S3KeyInfo.AccessKeyId }} \
  {{ .S3KeyInfo.SecretAccessKey }} \
  --api S3v4
                        </pre>
                        <p>Et ensuite pour utiliser Minio CLI avec :</p>
                        <pre>
mc ls garage/
mc cp /tmp/a.txt garage/my-bucket/a.txt
...
                        </pre>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header" id="winscp-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#winscp" aria-expanded="true" aria-controls="winscp">
                            WinSCP
                        </button>
                    </h2>
                </div>

                <div id="winscp" class="collapse" aria-labelledby="winscp-title" data-parent="#softconfig">
                    <div class="card-body">
                        Reportez vous <a href="">au guide</a>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header" id="hugo-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#hugo" aria-expanded="false" aria-controls="hugo">
                            Hugo
                        </button>
                    </h2>
                </div>
                <div id="hugo" class="collapse" aria-labelledby="hugo-title" data-parent="#softconfig">
                    <div class="card-body">
                        <p>Dans votre fichier <code>config.toml</code>, rajoutez :</p>
                        <pre>
[[deployment.targets]]
 URL = "s3://bucket?endpoint=garage.deuxfleurs.fr&amp;s3ForcePathStyle=true&amp;region=garage"
                        </pre>
                        <p>Assurez-vous d'avoir un fichier dans lequel les variables <code>AWS_ACCESS_KEY_ID</code> et <code>AWS_SECRET_ACCESS_KEY</code> sont définies,
                        ici on suppose que vous avez suivi les instructions de l'outil awscli (ci-dessus) et que vous avez un fichier <code>~/.awsrc</code> qui défini ces variables.
                        Ensuite : </p>
                        <pre>
source ~/.awsrc
hugo deploy
                        </pre>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header" id="publii-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#publii" aria-expanded="false" aria-controls="publii">
                            Publii
                        </button>
                    </h2>
                </div>
                <div id="publii" class="collapse" aria-labelledby="publii-title" data-parent="#softconfig">
                    <div class="card-body">
                        <em>Bientôt...</em>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- sftp -->
    <div class="tab-pane fade" id="sftp" role="tabpanel" aria-labelledby="sftp-tab">
        <table class="table mt-4">
            <tbody>
                <tr>
                    <th scope="row">Nom d'utilisateur-ice</th>
                    <td>{{ .Login.Info.Username }}</td>
                </tr>
                <tr>
                    <th scope="row">Mot de passe</th>
                    <td>(votre mot de passe guichet)</td>
                </tr>
                <tr>
                    <th scope="row">Hôte</th>
                    <td>sftp://bagage.deuxfleurs.fr</td>
                </tr>
                <tr>
                    <th scope="row">Port</th>
                    <td>2222</td>
                </tr>
            </tbody>
        </table>
        <p>Configurer votre logiciel :</p>

        <div class="accordion" id="softconfig2">
            <div class="card">
                <div class="card-header" id="filezilla-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#filezilla" aria-expanded="false" aria-controls="filezilla">
                            scp
                        </button>
                    </h2>
                </div>
                <div id="filezilla" class="collapse show" aria-labelledby="filezilla-title" data-parent="#softconfig">
                    <div class="card-body">
                        <p>Un exemple avec SCP :</p>
                        <pre>
scp -oHostKeyAlgorithms=+ssh-rsa -P2222 -r ./public {{ .Login.Info.Username }}@bagage.deuxfleurs.fr:mon_bucket/
                        </pre>
                    </div>
                </div>
            </div>
            <div class="card">
                <div class="card-header" id="filezilla-title">
                    <h2 class="mb-0">
                        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#filezilla" aria-expanded="false" aria-controls="filezilla">
                            Filezilla
                        </button>
                    </h2>
                </div>
                <div id="filezilla" class="collapse" aria-labelledby="filezilla-title" data-parent="#softconfig">
                    <div class="card-body">
                        <em>Bientôt</em>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

{{end}}