Skip to content

Commit 71b8c58

Browse files
authored
Merge pull request #29 from bluesky-social/bnewbold/fix-dockerfile
README tweaks, dockerfile updates
2 parents 7c13109 + 7c4f8a5 commit 71b8c58

File tree

3 files changed

+124
-83
lines changed

3 files changed

+124
-83
lines changed

Diff for: Dockerfile

+13-25
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
1-
FROM debian:bullseye-slim
1+
FROM node:20.11-alpine3.18
22

3-
ENV TZ=Etc/UTC
4-
ENV DEBIAN_FRONTEND=noninteractive
5-
ENV NODE_VERSION=18
6-
ENV NVM_DIR=/usr/share/nvm
3+
RUN apk add --update dumb-init
74

5+
ENV TZ=Etc/UTC
86
WORKDIR /usr/src/ozone
97

8+
COPY package.json yarn.lock .
9+
RUN yarn
1010
COPY . .
11-
12-
RUN apt-get update && apt-get install --yes \
13-
dumb-init \
14-
ca-certificates \
15-
wget
16-
17-
RUN mkdir --parents $NVM_DIR && \
18-
wget \
19-
--output-document=/tmp/nvm-install.sh \
20-
https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh && \
21-
bash /tmp/nvm-install.sh
22-
23-
RUN \. "$NVM_DIR/nvm.sh" && \
24-
nvm install $NODE_VERSION && \
25-
nvm use $NODE_VERSION && \
26-
npm install --global yarn && \
27-
yarn && \
28-
yarn build
29-
11+
RUN yarn build
12+
RUN chown -R node:node .next
3013

3114
ENTRYPOINT ["dumb-init", "--"]
15+
EXPOSE 3000
16+
USER node
17+
CMD ["yarn", "start"]
3218

33-
CMD ["bash", "-c", "source /usr/share/nvm/nvm.sh && yarn start"]
19+
LABEL org.opencontainers.image.source=https://github.com/bluesky-social/ozone-ui
20+
LABEL org.opencontainers.image.description="Ozone Moderation Service Web UI"
21+
LABEL org.opencontainers.image.licenses=MIT

Diff for: HACKING.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
### General Tips
3+
4+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
5+
6+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
7+
8+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
9+
10+
### Local Integerated Development Setup
11+
12+
Ozone requires a PDS service to talk to, and it is convenient to point it to a local `dev-env` instance for testing during development.
13+
14+
1. In the separate [atproto project](https://github.com/bluesky-social/atproto), run the dev server using `yarn workspace @atproto/dev-env start`. This will run a PDS, seeded with some users and data for you.
15+
2. Run the development server for Ozone using `yarn dev`. This will start running the Ozone frontend at `http://localhost:3000`.
16+
3. Navigate to the login page in your browser, at [http://localhost:3000](http://localhost:3000).
17+
4. Login using the atproto dev-env credentials, which you can find [here](https://github.com/bluesky-social/atproto/blob/a1240f0a37030766dfe0a2ccfdc2810432520ae9/packages/dev-env/src/mock/index.ts#L59-L84). For development some example login credentials that would are:
18+
- Service URL: http://localhost:2583
19+
- Account handle: alice.test
20+
- Password: hunter2
21+
- Admin Token: admin-pass
22+
23+
### Working with unpublished changes to the `@atproto/api` package
24+
25+
In the course of development there may be updates to the atproto client that are not yet published to npm, but you would like to use with Ozone. Here's the workflow for using unpublished changes to the @atproto/api package:
26+
27+
1. Ensure the [atproto/](https://github.com/bluesky-social/atproto) project lives as a sibling to the [ozone/](https://github.com/bluesky-social/ozone) project on your filesystem (or adjust the path used in step 4).
28+
29+
```
30+
~/Documents/bluesky
31+
❯ ls -l
32+
total 19856
33+
drwxr-xr-x 22 user group 704 Jan 19 15:51 atproto
34+
drwxr-xr-x 24 user group 768 Jan 24 19:17 ozone
35+
```
36+
37+
2. Checkout whichever branch you'd like to use in atproto/ for the @atproto/api package.
38+
39+
```
40+
~/Documents/bluesky
41+
❯ cd atproto
42+
~/Documents/bluesky/atproto
43+
❯ git checkout main
44+
```
45+
46+
3. Build the @atproto/api package in atproto/.
47+
48+
```
49+
~/Documents/bluesky/atproto
50+
❯ yarn
51+
```
52+
53+
4. Update the package.json file in ozone/ to reference the local build of @atproto/api.
54+
55+
```diff
56+
"dependencies": {
57+
- "@atproto/api": "^0.0.3",
58+
+ "@atproto/api": "link:../atproto/packages/api/dist",
59+
"@headlessui/react": "^1.7.7",
60+
```
61+
62+
5. Ask yarn to reinstall, creating the link from ozone/ to the local build of @atproto/api.
63+
```
64+
~/Documents/bluesky/ozone
65+
❯ yarn
66+
```
67+
6. Take care not to check-in the changes to package.json and yarn.lock that came from the temporary linking. When you're done, you can reset everything with:
68+
```
69+
~/Documents/bluesky/ozone
70+
❯ git checkout package.json yarn.lock && yarn
71+
```

Diff for: README.md

+40-58
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
Ozone: admin and mod web interface for atproto services
2+
Ozone UI: web interface for atproto moderation services
33
=======================================================
44

5-
Ozone is a Next.js web application which talks directly to a PDS instance, and requires moderator or administrator privileges to function.
5+
Ozone UI is a Next.js web application which talks directly to an Ozone "moderation service". It generally requires moderator or administrator privileges to function.
66

77
Features:
88

@@ -14,9 +14,20 @@ Features:
1414
- browsing app.bsky profiles and post threads, including some taken-down content
1515
- quick-action modal (Ctrl-K)
1616

17+
## Docker Quickstart
18+
19+
```bash
20+
# build image
21+
docker build -t ozone-ui .
22+
23+
# run the image
24+
docker run -p 3000:3000 ozone-ui
25+
```
1726

1827
## Development Quickstart
1928

29+
We recommend [`nvm`](https://github.com/nvm-sh/nvm) for managing Node.js installs. This project requires Node.js version 20. `yarn` is used to manage dependencies. You can install it with `npm install --global yarn`.
30+
2031
First, run the development server:
2132

2233
```bash
@@ -27,75 +38,46 @@ yarn dev
2738

2839
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
2940

30-
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
31-
32-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
33-
34-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
35-
36-
37-
### Local Integration Setup
41+
See [HACKING](./HACKING.md) for other development tricks, like development with a local PDS instance, or working with un-released changes to the `@atproto/api` package.
3842

39-
Ozone requires a PDS service to talk to, and it is convenient to point it to a local `dev-env` instance for testing during development.
43+
## Contributions
4044

41-
1. In the separate [atproto project](https://github.com/bluesky-social/atproto), run the dev server using `yarn workspace @atproto/dev-env start`. This will run a PDS, seeded with some users and data for you.
42-
2. Run the development server for Ozone using `yarn dev`. This will start running the Ozone frontend at `http://localhost:3000`.
43-
3. Navigate to the login page in your browser, at [http://localhost:3000](http://localhost:3000).
44-
4. Login using the atproto dev-env credentials, which you can find [here](https://github.com/bluesky-social/atproto/blob/a1240f0a37030766dfe0a2ccfdc2810432520ae9/packages/dev-env/src/mock/index.ts#L59-L84). For development some example login credentials that would are:
45-
- Service URL: http://localhost:2583
46-
- Account handle: alice.test
47-
- Password: hunter2
48-
- Admin Token: admin-pass
45+
> While we do accept contributions, we prioritize high quality issues and pull requests. Adhering to the below guidelines will ensure a more timely review.
4946
50-
### Working with unpublished changes to the `@atproto/api` package
47+
**Rules:**
5148

52-
In the course of development there may be updates to the atproto client that are not yet published to npm, but you would like to use with Ozone. Here's the workflow for using unpublished changes to the @atproto/api package:
49+
- We may not respond to your issue or PR.
50+
- We may close an issue or PR without much feedback.
51+
- We may lock discussions or contributions if our attention is getting DDOSed.
52+
- We do not provide support for build issues.
5353

54-
1. Ensure the [atproto/](https://github.com/bluesky-social/atproto) project lives as a sibling to the [ozone/](https://github.com/bluesky-social/ozone) project on your filesystem (or adjust the path used in step 4).
54+
**Guidelines:**
5555

56-
```
57-
~/Documents/bluesky
58-
❯ ls -l
59-
total 19856
60-
drwxr-xr-x 22 user group 704 Jan 19 15:51 atproto
61-
drwxr-xr-x 24 user group 768 Jan 24 19:17 ozone
62-
```
56+
- Check for existing issues before filing a new one, please.
57+
- Open an issue and give some time for discussion before submitting a PR.
58+
- If submitting a PR that includes a lexicon change, please get sign off on the lexicon change _before_ doing the implementation.
59+
- Issues are for bugs & feature requests related to the TypeScript implementation of atproto and related services.
60+
- For high-level discussions, please use the [Discussion Forum](https://github.com/bluesky-social/atproto/discussions).
61+
- Stay away from PRs that:
62+
- Refactor large parts of the codebase
63+
- Add entirely new features without prior discussion
64+
- Change the tooling or frameworks used without prior discussion
65+
- Introduce new unnecessary dependencies
6366

64-
2. Checkout whichever branch you'd like to use in atproto/ for the @atproto/api package.
67+
Remember, we serve a wide community of users. Our day-to-day involves us constantly asking "which top priority is our top priority." If you submit well-written PRs that solve problems concisely, that's an awesome contribution. Otherwise, as much as we'd love to accept your ideas and contributions, we really don't have the bandwidth.
6568

66-
```
67-
~/Documents/bluesky
68-
❯ cd atproto
69-
~/Documents/bluesky/atproto
70-
❯ git checkout main
71-
```
69+
## Security disclosures
7270

73-
3. Build the @atproto/api package in atproto/.
71+
If you discover any security issues, please send an email to [email protected]. The email is automatically CCed to the entire team, and we'll respond promptly. See [SECURITY.md](https://github.com/bluesky-social/atproto/blob/main/SECURITY.md) for more info.
7472

75-
```
76-
~/Documents/bluesky/atproto
77-
❯ yarn
78-
```
73+
## License
7974

80-
4. Update the package.json file in ozone/ to reference the local build of @atproto/api.
75+
This project is dual-licensed under MIT and Apache 2.0 terms:
8176

82-
```diff
83-
"dependencies": {
84-
- "@atproto/api": "^0.0.3",
85-
+ "@atproto/api": "link:../atproto/packages/api/dist",
86-
"@headlessui/react": "^1.7.7",
87-
```
77+
- MIT license ([LICENSE-MIT](https://github.com/bluesky-social/ozone-ui/blob/main/LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
78+
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/bluesky-social/ozone-ui/blob/main/LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
8879

89-
5. Ask yarn to reinstall, creating the link from ozone/ to the local build of @atproto/api.
90-
```
91-
~/Documents/bluesky/ozone
92-
❯ yarn
93-
```
94-
6. Take care not to check-in the changes to package.json and yarn.lock that came from the temporary linking. When you're done, you can reset everything with:
95-
```
96-
~/Documents/bluesky/ozone
97-
❯ git checkout package.json yarn.lock && yarn
98-
```
80+
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
9981

10082
## Acknowledgements
10183

0 commit comments

Comments
 (0)