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

Startup Command Field #139

Open
pauljohnstone opened this issue Mar 29, 2024 · 3 comments
Open

Startup Command Field #139

pauljohnstone opened this issue Mar 29, 2024 · 3 comments

Comments

@pauljohnstone
Copy link

pauljohnstone commented Mar 29, 2024

Has there been any further issue with the Startup Command Field?
I need to apply rewrite rules, which from my understanding need to be applied to nginx.conf

Test rewrite rule below:
server { listen 80; server_name your-domain.azurewebsites.net; location /Lib/abc/ { rewrite ^/Lib/abc/(.*)$ /Lib/ABC/$1 break; } }

The startup.sh file is located in the /home/dev/ when reviewing the file it's no script at all, which makes me think that the script is not being applied from the startup command field and is being ignored.

If this is still the case then what is the workaround solution?

Note on the following link
https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/running_post_startup_scripts.md

Note: As of September 2022, the startup script MUST exist at (/home/dev/startup.sh). Further, the value of the Startup Command field in the Azure Portal found under [App Service for Linux] > Configuration > General Settings > Startup Command is ignored. The Azure team is aware of this and working to make this flow more natural.

@samrueby
Copy link

The startup.sh file is located in the /home/dev/ when reviewing the file it's no script at all, which makes me think that the script is not being applied from the startup command field and is being ignored.

I am trying to understand "it's no script at all". By default, it's an empty file. It's empty because it's free for you to use. If you put commands in this file, they will execute when the container boots.

@pauljohnstone
Copy link
Author

Hi @samrueby,

Apologies for any confusion. I've been trying to clarify the process for applying a script within the startup command field in the Azure portal. It seems that when you apply a script, it should ideally write to the current startup.sh file located under the home/dev folder.

As you mentioned, manual addition of the script to the startup.sh file is necessary for it to take effect. Additionally, copying the nginx default.conf file to the /home directory is required for applying updates. Consequently, the startup.sh script will handle copying and replacing any changes to the nginx directory.

Here's a snippet of the script:

echo "Custom script" cp /home/default.conf /etc/nginx/conf.d/default.conf /usr/sbin/nginx -s reload

Note that the echo statement has be added to review logs to confirm whether or not the startup script is being executed.

In recent weeks, upon review, I discovered that the current issue with this particular image lies in how supervisord is configured, which explains why the startup script when applied to the startup command field is being ignored.

@samrueby
Copy link

Ah, yes. On that same page is documented:

Further, the value of the Startup Command field in the Azure Portal found under [App Service for Linux] > Configuration > General Settings > Startup Command is ignored. The Azure team is aware of this and working to make this flow more natural.

So it's a known issue.

Glad like you were able to get through the issue.

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

No branches or pull requests

3 participants