File tree Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6
6
&& apt-get -y install clang lld \
7
7
&& apt-get autoremove -y && apt-get clean -y \
8
8
&& cargo install --no-default-features -F postgres,rustls sqlx-cli
9
+
10
+ RUN mkdir -p /root/.local/bin/ && curl -s -o /root/.local/bin/mc \
11
+ https://dl.min.io/client/mc/release/linux-amd64/mc \
12
+ && chmod 755 /root/.local/bin/mc
Original file line number Diff line number Diff line change @@ -45,3 +45,19 @@ prepare:
45
45
.PHONY : migrate
46
46
migrate :
47
47
cargo sqlx migrate run
48
+
49
+ # Generate config.toml
50
+ .PHONY : bucket
51
+ bucket :
52
+ @echo " Configuring minio client..."
53
+ mc alias set --quiet mc " http://127.0.0.1:9000" " minioadmin" " minioadmin"
54
+ @echo " Creating bucket..."
55
+ mc mb --region global --ignore-existing --quiet mc/pastebin
56
+ @echo " Setting up access key..."
57
+ mc admin accesskey create \
58
+ --access-key ' <s3 access key!>' \
59
+ --secret-key ' <s3 secret key!>' \
60
+ --policy confs/s3/key-policy.json mc/
61
+ @echo " Configuring anonymous access..."
62
+ mc anonymous set download mc/pastebin
63
+ @echo " Configuration complete"
Original file line number Diff line number Diff line change @@ -20,16 +20,12 @@ Building and running the thing has a few requirements:
20
20
* Be signed into GitHub and click on the green ` Code ` button in the top right corner of the repository
21
21
* Select Codespaces tab and click on the ` Create codespace `
22
22
* Let the thing wriggle and build for a bit! It takes a while for the first time
23
- * Click on forwarded ports and open the address for port 9001 in your browser
24
- * Input ` minioadmin ` for username and password in it!
25
- * Make a new bucket called ` pastebin ` in there and copy ` confs/s3/bucket-policy.json ` into its custom access policy
26
- * Make a new key in there and copy ` confs/s3/key-policy.json ` into its user policy, make sure to note down the access key and secret key!
27
- * Copy config.toml.sample to a file called config.toml and edit for correct values
23
+ * Copy config.toml.sample to a file called config.toml
28
24
* The codespace domain for port 2024 goes in ` static_domain ` in config.toml
29
25
* The codespace address+` pastebin/ ` for port 9000 goes in ` s3_bucket_url ` in config.toml
30
- * Fill in the ` aws_access_key_id ` and ` aws_secret_access_key ` generated above
26
+ * Open the terminal and type ` make bucket ` -- run this only once!
31
27
* Open the terminal and type ` make migrate ` , ` make check ` , and then ` make run `
32
- * Make the forward address for port 9000 public in the codespace!
28
+ * Make the forward address for port 9000 public in the codespace
33
29
* Open the address for the forwarded port 2024 in your browser!
34
30
* Tada! You have a working pastebin!
35
31
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ server {
37
37
}
38
38
39
39
location /pastebin/content/ {
40
+ limit_except GET OPTIONS {
41
+ deny all;
42
+ }
43
+
40
44
proxy_redirect off;
41
45
proxy_http_version 1.1;
42
46
proxy_set_header Host $host;
You can’t perform that action at this time.
0 commit comments