Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Publish API #22

Merged
merged 14 commits into from
Jan 13, 2025
Merged

feat: Publish API #22

merged 14 commits into from
Jan 13, 2025

Conversation

sdankel
Copy link
Member

@sdankel sdankel commented Jan 10, 2025

Related #9

This PR exposes a /publish endpoint that accept all metadata about a package and stores it in the database. There is also a bit of refactoring and code cleanup.

This PR also:

  • adds an API for showing the most recent packages/versions published, and populates a rudimentary home screen/dashboard for forc.pub
  • support for .env.local which @zees-dev had previously suggested
  • switched to timestamptz and chrono as @zees-dev suggested
  • better error handling, now the server surfaces the detailed error message to the client
    Closes Replace SystemTime with something timezone-aware #21

There is still more to do on the publishing front:

  1. Publish to a github repo for forc indexing
  2. Publish to a new block explorer endpoint (dependent on @FuelLabs/frontend )

Copy link

vercel bot commented Jan 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
forc-pub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 11:47pm

@sdankel sdankel marked this pull request as ready for review January 11, 2025 08:10
@sdankel sdankel requested a review from a team January 11, 2025 08:11
.gitignore Show resolved Hide resolved
src/api/publish.rs Outdated Show resolved Hide resolved
src/db/user_session.rs Outdated Show resolved Hide resolved
src/util.rs Show resolved Hide resolved
src/util.rs Show resolved Hide resolved
tests/db_integration.rs Outdated Show resolved Hide resolved

This guide will help you set up and interact with the database.

## Installing Diesel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in quickstart(s) we should try to push for ephemeral tooling - which is most cases is containers.
E.g. postgres in container; pgadmin UI as a way to view the db, provide a docker-compose.yml which would spin up db, pgadmin, and run startup script (or inline) which would perform the migrations.
This would give external dev(s) a great quick start point to get the whole infra running locally.

Can be in future PR(s) btw.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't really used pgadmin; I have used psql but I prefer DBeaver. I think it's up to the developer what DB client they want to use. I could mention more of them here or just omit this section. Why do you think pgadmin is better/ should be recommended?

The migrations are performed automatically by diesel when the server starts.

This would give external dev(s) a great quick start point to get the whole infra running locally.

There are two scripts that serve this purpose:

  • start_local_db.sh: starts the DB in docker
  • start_local_server.sh: starts both the DB and server in docker, in a shared network

docker-compose would be better but I don't have much experience writing it and found it more convenient to write/user these bash scripts. We should circle back to it: #24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pgadmin is good just because everything can be run via docker-compose (it's all ephemeral).
Agree about the db-client being a developer opinion/option; I just think we should provide something which is ephemeral (not required on the machine) - even better if can just be provided by docker (whatever it is - pgadmin comes to mind first for me atleast).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice makes sense; yeap an issue is good start point - someone else (or even myself) can look into it 😄

zees-dev
zees-dev previously approved these changes Jan 12, 2025
Copy link

@zees-dev zees-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🚀
Suggested a few improvements; core functionality is there though!

src/api/publish.rs Outdated Show resolved Hide resolved
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this.

@sdankel sdankel merged commit e17de78 into master Jan 13, 2025
11 checks passed
@zees-dev zees-dev deleted the sophie/publish-api branch January 13, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace SystemTime with something timezone-aware
3 participants