W
Wasp2mo ago
A³Learn

16.2 where is wasp on fly-server

in 16.2 is the .build on fly cleared out? fly-server:/app/.wasp/build/server# ls I see this is now just with my node-modules, but where did the wasp project go to? I need this for getting my markdown files. (my blog and privacy policy is gone!)
19 Replies
kapa.ai
kapa.ai2mo ago
Hi @A³Learn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I can offer some insights about the Wasp build process and deployment, but I don't have specific information about version 16.2 or the exact location of Wasp files on the Fly.io server. However, I can provide some relevant information that might help you understand the situation: 1. Wasp generates all the code it deploys to the .wasp/build folder. This includes both the web-app and server folders Discord support thread. 2. The wasp build command generates the complete web app code, which is ready for deployment. The generated code is stored in the .wasp/build folder Docs > General > CLI Reference. 3. Wasp cleans up the build directory before each wasp build to ensure there are no leftovers from previous builds Github Issue: Clean up /build dir before wasp build. 4. When deploying to Fly.io, Wasp builds a fresh build in .wasp/build, so manual changes made to the .wasp/out files during development won't be deployed Discord support thread. Regarding your specific concerns: 1. The Wasp project files should be in the .wasp/build directory on the Fly.io server, but it seems you're only seeing the node_modules folder. 2. If your markdown files for your blog and privacy policy are missing, it's possible that they weren't included in the build process or weren't copied to the correct location during deployment. To address this issue, you might want to: 1. Check your project structure and ensure that your markdown files are in a location that gets included in the build process. 2. Consider using a custom Dockerfile to copy your markdown files to the correct location during the build process. You can do this by creating a Dockerfile in your project root and adding commands to copy your files Discord support thread. 3. Review your deployment process and make sure all necessary files are being included. If you continue to have issues, you might want to reach out to the Wasp community on Discord or GitHub for more specific help with your deployment setup. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @A³Learn, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho2mo ago
I'm not following what's going on 😄
in 16.2 is the .build on fly cleared out?
By 16.2 you mean 0.16.2? .build, you mean .wasp/build?
fly-server:/app/.wasp/build/server# ls
Did you edit the files on the server directly in the build folder? That's not something you should ever do because: 1. Build dir is something that will get overwritten on each wasp build 2. Cloud machines are not something you can rely on to have permanent storage unless you mount a volume
A³Learn
A³LearnOP2mo ago
Yes! 0.16.2 Yes I mean .wasp/build Did you edit the files on the server directly in the build folder? That's not something you should ever do because: No - I was trying to just grab them. I was looking at the .wasp/build and trying to find the markdown files that I would render to make my posts, etc I think now the .wasp/build is somehow being cleared on 0.16.2 I made a solution, I'll report back tomorrow! I mean it's not good practice what I'm doing -- I'm converting a mardown to a page and others would probably do this different and host on cloudflare pages, but here's the solution, maybe it's project specific. as the .wasp/build was cleared and I couldn't find my wasp project in the whole VM - I copied the files
- name: Copy Markdown Files to Fly.io
env:
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
run: |
# Wait for a few seconds to ensure the deployment is complete
sleep 3

# Create temporary directories for both types of files
mkdir -p temp_misc
mkdir -p temp_blog

# Copy the markdown files to their respective temporary directories
cp src/misc/*.md temp_misc/ || true
cp src/blog/posts/*.md temp_blog/ || true

# Create necessary directories on the server
flyctl ssh console -a YOURAPP-server <<-'ENDSSH'
mkdir -p /app/.wasp/build/server/src/misc
mkdir -p /app/.wasp/build/server/src/blog/posts
exit
ENDSSH

# Copy misc markdown files
for file in temp_misc/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "-put ${file} /app/.wasp/build/server/src/misc/${filename}" | flyctl ssh sftp shell -a YOURAPP-server
fi
done

# Copy blog post markdown files
for file in temp_blog/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "-put ${file} /app/.wasp/build/server/src/blog/posts/${filename}" | flyctl ssh sftp shell -a YOURAPP-server
fi
done
shell: bash
- name: Copy Markdown Files to Fly.io
env:
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
run: |
# Wait for a few seconds to ensure the deployment is complete
sleep 3

# Create temporary directories for both types of files
mkdir -p temp_misc
mkdir -p temp_blog

# Copy the markdown files to their respective temporary directories
cp src/misc/*.md temp_misc/ || true
cp src/blog/posts/*.md temp_blog/ || true

# Create necessary directories on the server
flyctl ssh console -a YOURAPP-server <<-'ENDSSH'
mkdir -p /app/.wasp/build/server/src/misc
mkdir -p /app/.wasp/build/server/src/blog/posts
exit
ENDSSH

# Copy misc markdown files
for file in temp_misc/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "-put ${file} /app/.wasp/build/server/src/misc/${filename}" | flyctl ssh sftp shell -a YOURAPP-server
fi
done

# Copy blog post markdown files
for file in temp_blog/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "-put ${file} /app/.wasp/build/server/src/blog/posts/${filename}" | flyctl ssh sftp shell -a YOURAPP-server
fi
done
shell: bash
miho
miho2mo ago
What about copying the files to .wasp/build dir after wasp build and before the deploy step? This way the files will end up on the Fly as well without the complex task of sshing into the server.
A³Learn
A³LearnOP2mo ago
I would also like not to ssh into the server! I'm not sure however what the change was that cleaned the .wasp/build folder
A³Learn
A³LearnOP2mo ago
Uhm! I'm very confused actually -- https://aaalearn.com/blog/ I can't find my image here even though I do see it on localhost For images I didn't do any complex moving or so, they should be on my public/blog/images/ folder For some reason that image is not there and I'm not understanding why
A³Learn™ - Secure Testing & AI Learning Platform
The all-in-one platform for educators to create, monitor, and secure assessments. Features intelligent test monitoring, multi-AI chat, and learning tools - without browser lockdowns.
miho
miho2mo ago
I can't find my image here even though I do see it on localhost
The images loaded for me? 🙂
miho
miho2mo ago
No description
miho
miho2mo ago
@A³Learn could you share your full Github Action so I can maybe give an idea how to avoid SSHing into Fly to copy the extra files 🙂
A³Learn
A³LearnOP2mo ago
I apoligize Miho! I thought after a hard refresh the image would show up -- apparently not? I went to private mode and the images are there, still here's my github code
A³Learn
A³LearnOP2mo ago
Gist
workflow.yml
workflow.yml. GitHub Gist: instantly share code, notes, and snippets.
miho
miho2mo ago
Ok, so what you could do, do the deployment like this:
# Call build manually
wasp build

# Here you can write your code to copy custom files to the `.wasp/build` dir locally
cp ./src/misc/*.md .wasp/build/server/src
cp ./src/blog/posts/*.md .wasp/build/server/src/blog/posts

# Deploy without running build (since build would overwrite our changes from above) - this should upload your .wasp/build/server dir with the blog posts
wasp deploy fly deploy --skip-build
# Call build manually
wasp build

# Here you can write your code to copy custom files to the `.wasp/build` dir locally
cp ./src/misc/*.md .wasp/build/server/src
cp ./src/blog/posts/*.md .wasp/build/server/src/blog/posts

# Deploy without running build (since build would overwrite our changes from above) - this should upload your .wasp/build/server dir with the blog posts
wasp deploy fly deploy --skip-build
Let me know if this works out for you 🙂
miho
miho2mo ago
We want to implement something like lifecycle hooks where you could execute some code after the build finishes e.g. copy over some files you need so you don't need to build and then deploy.
GitHub
Consider having a mechanism for patching the generated code / templ...
@Zeko369 (what a surprise, since he is known for practicing patching/hacking Wasp templates :D) suggested that we might consider adding a mechanism for patching the generated Wasp code / templates....
A³Learn
A³LearnOP2mo ago
I'm not terribly sure what are the directories again? I saw that 0.16.2 made a small change there too
[ Wasp !] npm warn deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1cp: target '.wasp/build/server/src/blog/posts': No such file or directory
Error: Process completed with exit code 1.
[ Wasp !] npm warn deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1cp: target '.wasp/build/server/src/blog/posts': No such file or directory
Error: Process completed with exit code 1.
Here's something I made for my dev enviroment when I found out that the directory changed stucture
join(process.cwd(), '..','sdk','wasp', 'src', 'blog', 'posts'), // Dev environment
join(process.cwd(), '..','sdk','wasp', 'src', 'blog', 'posts'), // Dev environment
Is it in sdk now?
miho
miho2mo ago
We have always copied the src dir into the SDK dir, we did rename it from ext-src to src. You can copy stuff from the SDK or your actual src since you have all the files available.
A³Learn
A³LearnOP2mo ago
This compiled/ran!
cp ./src/misc/*.md .wasp/build/sdk/wasp/dist/src/misc/
mkdir -p .wasp/build/sdk/wasp/dist/src/blog/posts
cp ./src/blog/posts/*.md .wasp/build/sdk/wasp/dist/src/blog/posts/
cp ./src/misc/*.md .wasp/build/sdk/wasp/dist/src/misc/
mkdir -p .wasp/build/sdk/wasp/dist/src/blog/posts
cp ./src/blog/posts/*.md .wasp/build/sdk/wasp/dist/src/blog/posts/
` Whoops but then I lost my markdown content, I'm just going to do the ssh way!
miho
miho2mo ago
Where are you storing the Markdown content? You shouldn't lose it if you keep it in the src dir in Git?
A³Learn
A³LearnOP2mo ago
yes it should be there! Help me understand, if I ssh into the fly server should it be there? Maybe I am misunderstanding some concepts let me know on this, I couldn't get further the ssh command is also unreliable, not copying all the files
MEE6
MEE62mo ago
Wohooo @A³Learn, you just became a Waspeteer level 10!

Did you find this page helpful?